iconview.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. import IconView from '../../src/icon/iconview';
  6. describe( 'IconView', () => {
  7. let view;
  8. beforeEach( () => {
  9. return ( view = new IconView() ).init();
  10. } );
  11. describe( 'constructor()', () => {
  12. it( 'creates element from template', () => {
  13. expect( view.element.tagName ).to.equal( 'svg' );
  14. expect( view.element.getAttribute( 'class' ) ).to.equal( 'ck-icon' );
  15. expect( view.element.getAttribute( 'viewBox' ) ).to.equal( '0 0 20 20' );
  16. } );
  17. } );
  18. describe( '<svg> bindings', () => {
  19. describe( 'viewBox', () => {
  20. it( 'should react to changes in view#viewBox', () => {
  21. expect( view.element.getAttribute( 'viewBox' ) ).to.equal( '0 0 20 20' );
  22. view.viewBox = '1 2 3 4';
  23. expect( view.element.getAttribute( 'viewBox' ) ).to.equal( '1 2 3 4' );
  24. } );
  25. } );
  26. describe( 'inline svg', () => {
  27. it( 'should react to changes in view#content', () => {
  28. view.content = '<svg version="1.1" xmlns="http://www.w3.org/2000/svg"><g id="test"></g></svg>';
  29. expect( view.element.innerHTML = '<g id="test"></g>' );
  30. } );
  31. } );
  32. } );
  33. } );