boxededitoruiview.js 1.9 KB

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