8
0

specialcharactersarrows.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /**
  2. * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  4. */
  5. /* globals document */
  6. import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
  7. import SpecialCharacters from '../src/specialcharacters';
  8. import SpecialCharactersArrows from '../src/specialcharactersarrows';
  9. import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
  10. describe( 'SpecialCharactersArrows', () => {
  11. testUtils.createSinonSandbox();
  12. let editor, editorElement, addItemsSpy, addItemsFirstCallArgs;
  13. beforeEach( () => {
  14. editorElement = document.createElement( 'div' );
  15. addItemsSpy = sinon.spy( SpecialCharacters.prototype, 'addItems' );
  16. document.body.appendChild( editorElement );
  17. return ClassicTestEditor
  18. .create( editorElement, {
  19. plugins: [ SpecialCharacters, SpecialCharactersArrows ]
  20. } )
  21. .then( newEditor => {
  22. editor = newEditor;
  23. addItemsFirstCallArgs = addItemsSpy.args[ 0 ];
  24. } );
  25. } );
  26. afterEach( () => {
  27. addItemsSpy.restore();
  28. editorElement.remove();
  29. return editor.destroy();
  30. } );
  31. it( 'adds new items', () => {
  32. expect( addItemsSpy.callCount ).to.equal( 1 );
  33. } );
  34. it( 'properly names the category', () => {
  35. expect( addItemsFirstCallArgs[ 0 ] ).to.equal( 'Arrows' );
  36. } );
  37. it( 'adds proper characters', () => {
  38. expect( addItemsFirstCallArgs[ 1 ] ).to.deep.include( {
  39. title: 'rightwards double arrow',
  40. character: '⇒'
  41. } );
  42. expect( addItemsFirstCallArgs[ 1 ] ).to.deep.include( {
  43. title: 'rightwards arrow to bar',
  44. character: '⇥'
  45. } );
  46. } );
  47. } );