boxededitoruiview.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. import BoxedEditorUIView from '/ckeditor5/ui/editorui/boxed/boxededitoruiview.js';
  6. import Locale from '/ckeditor5/utils/locale.js';
  7. describe( 'BoxedEditorUIView', () => {
  8. let boxedEditorUIView, element, topRegionEl, mainRegionEl;
  9. beforeEach( () => {
  10. boxedEditorUIView = new BoxedEditorUIView( new Locale( 'en' ) );
  11. boxedEditorUIView.init();
  12. element = boxedEditorUIView.element;
  13. const regions = boxedEditorUIView.regions;
  14. topRegionEl = regions.get( 'top' ).element;
  15. mainRegionEl = regions.get( 'main' ).element;
  16. } );
  17. describe( 'constructor', () => {
  18. it( 'creates the regions', () => {
  19. expect( topRegionEl.parentNode ).to.equal( boxedEditorUIView.element );
  20. expect( mainRegionEl.parentNode ).to.equal( boxedEditorUIView.element );
  21. } );
  22. it( 'bootstraps the view element from template', () => {
  23. expect( boxedEditorUIView.element.classList.contains( 'ck-editor' ) ).to.be.true;
  24. } );
  25. it( 'setups accessibility of the view element', () => {
  26. expect( element.attributes.getNamedItem( 'aria-labelledby' ).value ).to.equal(
  27. boxedEditorUIView.element.firstChild.id );
  28. expect( element.attributes.getNamedItem( 'role' ).value ).to.equal( 'application' );
  29. expect( element.attributes.getNamedItem( 'lang' ).value ).to.equal( 'en' );
  30. } );
  31. it( 'bootstraps the view region elements from template', () => {
  32. expect( topRegionEl.classList.contains( 'ck-editor__top' ) ).to.be.true;
  33. expect( mainRegionEl.classList.contains( 'ck-editor__main' ) ).to.be.true;
  34. } );
  35. it( 'setups accessibility of the view region elements', () => {
  36. expect( topRegionEl.attributes.getNamedItem( 'role' ).value ).to.equal( 'presentation' );
  37. expect( mainRegionEl.attributes.getNamedItem( 'role' ).value ).to.equal( 'presentation' );
  38. } );
  39. } );
  40. } );