tableselection.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /**
  2. * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
  6. import { setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
  7. import { defaultConversion, defaultSchema, modelTable } from './_utils/utils';
  8. import TableSelection from '../src/tableselection';
  9. describe( 'TableSelection', () => {
  10. let editor, model, root, tableSelection;
  11. beforeEach( () => {
  12. return VirtualTestEditor.create( {
  13. plugins: [ TableSelection ]
  14. } ).then( newEditor => {
  15. editor = newEditor;
  16. model = editor.model;
  17. root = model.document.getRoot( 'main' );
  18. tableSelection = editor.plugins.get( TableSelection );
  19. defaultSchema( model.schema );
  20. defaultConversion( editor.conversion );
  21. } );
  22. } );
  23. afterEach( () => {
  24. return editor.destroy();
  25. } );
  26. describe( '#pluginName', () => {
  27. it( 'should provide plugin name', () => {
  28. expect( TableSelection.pluginName ).to.equal( 'TableSelection' );
  29. } );
  30. } );
  31. describe.only( 'start()', () => {
  32. it( 'should...', () => {
  33. setData( model, modelTable( [
  34. [ { rowspan: 2, colspan: 2, contents: '00[]' }, '02' ],
  35. [ '12' ]
  36. ] ) );
  37. const nodeByPath = root.getNodeByPath( [ 0, 0, 0 ] );
  38. tableSelection.startSelection( nodeByPath );
  39. } );
  40. } );
  41. } );