boxededitoruiview.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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/boxededitorui/boxededitoruiview.js';
  7. import Model from '/ckeditor5/ui/model.js';
  8. import Locale from '/ckeditor5/utils/locale.js';
  9. describe( 'BoxedEditorUIView', () => {
  10. let boxedEditorUIView, element, topRegionEl, mainRegionEl;
  11. beforeEach( () => {
  12. boxedEditorUIView = new BoxedEditorUIView( new Model(), new Locale( 'en' ) );
  13. boxedEditorUIView.init();
  14. element = boxedEditorUIView.element;
  15. const regions = boxedEditorUIView.regions;
  16. topRegionEl = regions.get( 'top' ).element;
  17. mainRegionEl = regions.get( 'main' ).element;
  18. } );
  19. describe( 'constructor', () => {
  20. it( 'creates the regions', () => {
  21. expect( topRegionEl.parentNode ).to.equal( boxedEditorUIView.element );
  22. expect( mainRegionEl.parentNode ).to.equal( boxedEditorUIView.element );
  23. } );
  24. it( 'bootstraps the view element from template', () => {
  25. expect( boxedEditorUIView.element.classList.contains( 'ck-editor' ) ).to.be.true;
  26. } );
  27. it( 'setups accessibility of the view element', () => {
  28. expect( element.attributes.getNamedItem( 'aria-labelledby' ).value ).to.equal(
  29. boxedEditorUIView.element.firstChild.id );
  30. expect( element.attributes.getNamedItem( 'role' ).value ).to.equal( 'application' );
  31. expect( element.attributes.getNamedItem( 'lang' ).value ).to.equal( 'en' );
  32. } );
  33. it( 'bootstraps the view region elements from template', () => {
  34. expect( topRegionEl.classList.contains( 'ck-editor__top' ) ).to.be.true;
  35. expect( mainRegionEl.classList.contains( 'ck-editor__main' ) ).to.be.true;
  36. } );
  37. it( 'setups accessibility of the view region elements', () => {
  38. expect( topRegionEl.attributes.getNamedItem( 'role' ).value ).to.equal( 'presentation' );
  39. expect( mainRegionEl.attributes.getNamedItem( 'role' ).value ).to.equal( 'presentation' );
  40. } );
  41. } );
  42. } );