tableediting.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  1. /**
  2. * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
  6. import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
  7. import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
  8. import { getCode } from '@ckeditor/ckeditor5-utils/src/keyboard';
  9. import ImageEditing from '@ckeditor/ckeditor5-image/src/image/imageediting';
  10. import TableEditing from '../src/tableediting';
  11. import { formatTable, formattedModelTable, modelTable } from './_utils/utils';
  12. import InsertRowCommand from '../src/commands/insertrowcommand';
  13. import InsertTableCommand from '../src/commands/inserttablecommand';
  14. import InsertColumnCommand from '../src/commands/insertcolumncommand';
  15. import RemoveRowCommand from '../src/commands/removerowcommand';
  16. import RemoveColumnCommand from '../src/commands/removecolumncommand';
  17. import SplitCellCommand from '../src/commands/splitcellcommand';
  18. import MergeCellCommand from '../src/commands/mergecellcommand';
  19. import SetHeaderRowCommand from '../src/commands/setheaderrowcommand';
  20. import SetHeaderColumnCommand from '../src/commands/setheadercolumncommand';
  21. import MediaEmbedEditing from '@ckeditor/ckeditor5-media-embed/src/mediaembedediting';
  22. describe( 'TableEditing', () => {
  23. let editor, model;
  24. beforeEach( () => {
  25. return VirtualTestEditor
  26. .create( {
  27. plugins: [ TableEditing, Paragraph, ImageEditing, MediaEmbedEditing ]
  28. } )
  29. .then( newEditor => {
  30. editor = newEditor;
  31. model = editor.model;
  32. } );
  33. } );
  34. afterEach( () => {
  35. editor.destroy();
  36. } );
  37. it( 'should set proper schema rules', () => {
  38. // Table:
  39. expect( model.schema.isRegistered( 'table' ) ).to.be.true;
  40. expect( model.schema.isObject( 'table' ) ).to.be.true;
  41. expect( model.schema.isLimit( 'table' ) ).to.be.true;
  42. expect( model.schema.checkChild( [ '$root' ], 'table' ) ).to.be.true;
  43. expect( model.schema.checkAttribute( [ '$root', 'table' ], 'headingRows' ) ).to.be.true;
  44. expect( model.schema.checkAttribute( [ '$root', 'table' ], 'headingColumns' ) ).to.be.true;
  45. // Table row:
  46. expect( model.schema.isRegistered( 'tableRow' ) ).to.be.true;
  47. expect( model.schema.isLimit( 'tableRow' ) ).to.be.true;
  48. expect( model.schema.checkChild( [ '$root' ], 'tableRow' ) ).to.be.false;
  49. expect( model.schema.checkChild( [ 'table' ], 'tableRow' ) ).to.be.true;
  50. // Table cell:
  51. expect( model.schema.isRegistered( 'tableCell' ) ).to.be.true;
  52. expect( model.schema.isLimit( 'tableCell' ) ).to.be.true;
  53. expect( model.schema.checkChild( [ '$root' ], 'tableCell' ) ).to.be.false;
  54. expect( model.schema.checkChild( [ 'table' ], 'tableCell' ) ).to.be.false;
  55. expect( model.schema.checkChild( [ 'tableRow' ], 'tableCell' ) ).to.be.true;
  56. expect( model.schema.checkChild( [ 'tableCell' ], 'tableCell' ) ).to.be.false;
  57. expect( model.schema.checkAttribute( [ 'tableCell' ], 'colspan' ) ).to.be.true;
  58. expect( model.schema.checkAttribute( [ 'tableCell' ], 'rowspan' ) ).to.be.true;
  59. // Table cell contents:
  60. expect( model.schema.checkChild( [ '$root', 'table', 'tableRow', 'tableCell' ], '$text' ) ).to.be.false;
  61. expect( model.schema.checkChild( [ '$root', 'table', 'tableRow', 'tableCell' ], '$block' ) ).to.be.true;
  62. expect( model.schema.checkChild( [ '$root', 'table', 'tableRow', 'tableCell' ], 'table' ) ).to.be.false;
  63. expect( model.schema.checkChild( [ '$root', 'table', 'tableRow', 'tableCell' ], 'image' ) ).to.be.true;
  64. } );
  65. it( 'adds insertTable command', () => {
  66. expect( editor.commands.get( 'insertTable' ) ).to.be.instanceOf( InsertTableCommand );
  67. } );
  68. it( 'adds insertRowAbove command', () => {
  69. expect( editor.commands.get( 'insertTableRowAbove' ) ).to.be.instanceOf( InsertRowCommand );
  70. } );
  71. it( 'adds insertRowBelow command', () => {
  72. expect( editor.commands.get( 'insertTableRowBelow' ) ).to.be.instanceOf( InsertRowCommand );
  73. } );
  74. it( 'adds insertColumnLeft command', () => {
  75. expect( editor.commands.get( 'insertTableColumnLeft' ) ).to.be.instanceOf( InsertColumnCommand );
  76. } );
  77. it( 'adds insertColumnRight command', () => {
  78. expect( editor.commands.get( 'insertTableColumnRight' ) ).to.be.instanceOf( InsertColumnCommand );
  79. } );
  80. it( 'adds removeRow command', () => {
  81. expect( editor.commands.get( 'removeTableRow' ) ).to.be.instanceOf( RemoveRowCommand );
  82. } );
  83. it( 'adds removeColumn command', () => {
  84. expect( editor.commands.get( 'removeTableColumn' ) ).to.be.instanceOf( RemoveColumnCommand );
  85. } );
  86. it( 'adds splitCellVertically command', () => {
  87. expect( editor.commands.get( 'splitTableCellVertically' ) ).to.be.instanceOf( SplitCellCommand );
  88. } );
  89. it( 'adds splitCellHorizontally command', () => {
  90. expect( editor.commands.get( 'splitTableCellHorizontally' ) ).to.be.instanceOf( SplitCellCommand );
  91. } );
  92. it( 'adds mergeCellRight command', () => {
  93. expect( editor.commands.get( 'mergeTableCellRight' ) ).to.be.instanceOf( MergeCellCommand );
  94. } );
  95. it( 'adds mergeCellLeft command', () => {
  96. expect( editor.commands.get( 'mergeTableCellLeft' ) ).to.be.instanceOf( MergeCellCommand );
  97. } );
  98. it( 'adds mergeCellDown command', () => {
  99. expect( editor.commands.get( 'mergeTableCellDown' ) ).to.be.instanceOf( MergeCellCommand );
  100. } );
  101. it( 'adds mergeCellUp command', () => {
  102. expect( editor.commands.get( 'mergeTableCellUp' ) ).to.be.instanceOf( MergeCellCommand );
  103. } );
  104. it( 'adds setColumnHeader command', () => {
  105. expect( editor.commands.get( 'setTableColumnHeader' ) ).to.be.instanceOf( SetHeaderColumnCommand );
  106. } );
  107. it( 'adds setRowHeader command', () => {
  108. expect( editor.commands.get( 'setTableRowHeader' ) ).to.be.instanceOf( SetHeaderRowCommand );
  109. } );
  110. describe( 'conversion in data pipeline', () => {
  111. describe( 'model to view', () => {
  112. it( 'should create tbody section', () => {
  113. setModelData( model, '<table><tableRow><tableCell><paragraph>foo[]</paragraph></tableCell></tableRow></table>' );
  114. expect( editor.getData() ).to.equal(
  115. '<figure class="table">' +
  116. '<table>' +
  117. '<tbody>' +
  118. '<tr><td>foo</td></tr>' +
  119. '</tbody>' +
  120. '</table>' +
  121. '</figure>'
  122. );
  123. } );
  124. it( 'should create thead section', () => {
  125. setModelData(
  126. model,
  127. '<table headingRows="1"><tableRow><tableCell><paragraph>foo[]</paragraph></tableCell></tableRow></table>'
  128. );
  129. expect( editor.getData() ).to.equal(
  130. '<figure class="table">' +
  131. '<table>' +
  132. '<thead>' +
  133. '<tr><th>foo</th></tr>' +
  134. '</thead>' +
  135. '</table>' +
  136. '</figure>'
  137. );
  138. } );
  139. } );
  140. describe( 'view to model', () => {
  141. it( 'should convert table', () => {
  142. editor.setData( '<table><tbody><tr><td>foo</td></tr></tbody></table>' );
  143. expect( getModelData( model, { withoutSelection: true } ) )
  144. .to.equal( '<table><tableRow><tableCell><paragraph>foo</paragraph></tableCell></tableRow></table>' );
  145. } );
  146. it( 'should convert table with image', () => {
  147. editor.setData( '<table><tbody><tr><td><img src="sample.png"></td></tr></tbody></table>' );
  148. expect( getModelData( model, { withoutSelection: true } ) )
  149. .to.equal( '<table><tableRow><tableCell><image src="sample.png"></image></tableCell></tableRow></table>' );
  150. } );
  151. it( 'should convert table with media', () => {
  152. editor.setData(
  153. '<table><tbody><tr><td><oembed url="https://www.youtube.com/watch?v=H08tGjXNHO4"></oembed></td></tr></tbody></table>'
  154. );
  155. expect( getModelData( model, { withoutSelection: true } ) )
  156. .to.equal( '<table><tableRow><tableCell><paragraph></paragraph></tableCell></tableRow></table>' );
  157. } );
  158. } );
  159. } );
  160. describe( 'caret movement', () => {
  161. let domEvtDataStub;
  162. beforeEach( () => {
  163. domEvtDataStub = {
  164. keyCode: getCode( 'Tab' ),
  165. preventDefault: sinon.spy(),
  166. stopPropagation: sinon.spy()
  167. };
  168. } );
  169. it( 'should do nothing if not tab pressed', () => {
  170. setModelData( model, modelTable( [
  171. [ '11', '12[]' ]
  172. ] ) );
  173. domEvtDataStub.keyCode = getCode( 'a' );
  174. editor.editing.view.document.fire( 'keydown', domEvtDataStub );
  175. sinon.assert.notCalled( domEvtDataStub.preventDefault );
  176. sinon.assert.notCalled( domEvtDataStub.stopPropagation );
  177. expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
  178. [ '11', '12[]' ]
  179. ] ) );
  180. } );
  181. it( 'should do nothing if Ctrl+Tab is pressed', () => {
  182. setModelData( model, modelTable( [
  183. [ '11', '12[]' ]
  184. ] ) );
  185. domEvtDataStub.ctrlKey = true;
  186. editor.editing.view.document.fire( 'keydown', domEvtDataStub );
  187. sinon.assert.notCalled( domEvtDataStub.preventDefault );
  188. sinon.assert.notCalled( domEvtDataStub.stopPropagation );
  189. expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
  190. [ '11', '12[]' ]
  191. ] ) );
  192. } );
  193. describe( 'on TAB', () => {
  194. it( 'should do nothing if selection is not in a table', () => {
  195. setModelData( model, '[]' + modelTable( [
  196. [ '11', '12' ]
  197. ] ) );
  198. editor.editing.view.document.fire( 'keydown', domEvtDataStub );
  199. sinon.assert.notCalled( domEvtDataStub.preventDefault );
  200. sinon.assert.notCalled( domEvtDataStub.stopPropagation );
  201. expect( formatTable( getModelData( model ) ) ).to.equal( '[]' + formattedModelTable( [
  202. [ '11', '12' ]
  203. ] ) );
  204. } );
  205. it( 'should move to next cell', () => {
  206. setModelData( model, modelTable( [
  207. [ '11[]', '12' ]
  208. ] ) );
  209. editor.editing.view.document.fire( 'keydown', domEvtDataStub );
  210. sinon.assert.calledOnce( domEvtDataStub.preventDefault );
  211. sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
  212. expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
  213. [ '11', '[12]' ]
  214. ] ) );
  215. } );
  216. it( 'should create another row and move to first cell in new row', () => {
  217. setModelData( model, modelTable( [
  218. [ '11', '[12]' ]
  219. ] ) );
  220. editor.editing.view.document.fire( 'keydown', domEvtDataStub );
  221. expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
  222. [ '11', '12' ],
  223. [ '[]', '' ]
  224. ] ) );
  225. } );
  226. it( 'should move to the first cell of next row if on end of a row', () => {
  227. setModelData( model, modelTable( [
  228. [ '11', '12[]' ],
  229. [ '21', '22' ]
  230. ] ) );
  231. editor.editing.view.document.fire( 'keydown', domEvtDataStub );
  232. expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
  233. [ '11', '12' ],
  234. [ '[21]', '22' ]
  235. ] ) );
  236. } );
  237. it( 'should move to the next table cell if part of block content is selected', () => {
  238. setModelData( model, modelTable( [
  239. [ '11', '<paragraph>12</paragraph><paragraph>[foo]</paragraph><paragraph>bar</paragraph>', '13' ],
  240. ] ) );
  241. editor.editing.view.document.fire( 'keydown', domEvtDataStub );
  242. expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
  243. [
  244. '11',
  245. '<paragraph>12</paragraph><paragraph>foo</paragraph><paragraph>bar</paragraph>',
  246. '[13]'
  247. ],
  248. ] ) );
  249. } );
  250. it( 'should move to next cell with an image', () => {
  251. setModelData( model, modelTable( [
  252. [ '11[]', '<paragraph>foo</paragraph><image></image>' ]
  253. ] ) );
  254. editor.editing.view.document.fire( 'keydown', domEvtDataStub );
  255. sinon.assert.calledOnce( domEvtDataStub.preventDefault );
  256. sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
  257. expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
  258. [ '11', '<paragraph>[foo</paragraph><image></image>]' ]
  259. ] ) );
  260. } );
  261. it( 'should move to next cell with an blockQuote', () => {
  262. model.schema.register( 'blockQuote', {
  263. allowWhere: '$block',
  264. allowContentOf: '$root',
  265. isObject: true,
  266. isBlock: true
  267. } );
  268. editor.conversion.elementToElement( { model: 'blockQuote', view: 'blockquote' } );
  269. setModelData( model, modelTable( [
  270. [ '11[]', '<blockQuote><paragraph>foo</paragraph></blockQuote>' ]
  271. ] ) );
  272. editor.editing.view.document.fire( 'keydown', domEvtDataStub );
  273. sinon.assert.calledOnce( domEvtDataStub.preventDefault );
  274. sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
  275. expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
  276. [ '11', '<blockQuote><paragraph>[foo]</paragraph></blockQuote>' ]
  277. ] ) );
  278. } );
  279. it( 'should listen with lower priority then its children', () => {
  280. // Cancel TAB event.
  281. editor.keystrokes.set( 'Tab', ( data, cancel ) => cancel() );
  282. setModelData( model, modelTable( [
  283. [ '11[]', '12' ]
  284. ] ) );
  285. editor.editing.view.document.fire( 'keydown', domEvtDataStub );
  286. sinon.assert.calledOnce( domEvtDataStub.preventDefault );
  287. sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
  288. expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
  289. [ '11[]', '12' ]
  290. ] ) );
  291. } );
  292. describe( 'on table widget selected', () => {
  293. beforeEach( () => {
  294. editor.model.schema.register( 'block', {
  295. allowWhere: '$block',
  296. allowContentOf: '$block',
  297. isObject: true
  298. } );
  299. editor.conversion.elementToElement( { model: 'block', view: 'block' } );
  300. } );
  301. it( 'should move caret to the first table cell on TAB', () => {
  302. const spy = sinon.spy();
  303. editor.keystrokes.set( 'Tab', spy, { priority: 'lowest' } );
  304. setModelData( model, '[' + modelTable( [
  305. [ '11', '12' ]
  306. ] ) + ']' );
  307. editor.editing.view.document.fire( 'keydown', domEvtDataStub );
  308. sinon.assert.calledOnce( domEvtDataStub.preventDefault );
  309. sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
  310. expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
  311. [ '[11]', '12' ]
  312. ] ) );
  313. // Should cancel event - so no other tab handler is called.
  314. sinon.assert.notCalled( spy );
  315. } );
  316. it( 'shouldn\'t do anything on other blocks', () => {
  317. const spy = sinon.spy();
  318. editor.editing.view.document.on( 'keydown', spy );
  319. setModelData( model, '[<block>foo</block>]' );
  320. editor.editing.view.document.fire( 'keydown', domEvtDataStub );
  321. sinon.assert.notCalled( domEvtDataStub.preventDefault );
  322. sinon.assert.notCalled( domEvtDataStub.stopPropagation );
  323. expect( formatTable( getModelData( model ) ) ).to.equal( '[<block>foo</block>]' );
  324. // Should not cancel event.
  325. sinon.assert.calledOnce( spy );
  326. } );
  327. } );
  328. } );
  329. describe( 'on SHIFT+TAB', () => {
  330. beforeEach( () => {
  331. domEvtDataStub.shiftKey = true;
  332. } );
  333. it( 'should do nothing if selection is not in a table', () => {
  334. setModelData( model, '[]' + modelTable( [
  335. [ '11', '12' ]
  336. ] ) );
  337. domEvtDataStub.keyCode = getCode( 'Tab' );
  338. domEvtDataStub.shiftKey = true;
  339. editor.editing.view.document.fire( 'keydown', domEvtDataStub );
  340. sinon.assert.notCalled( domEvtDataStub.preventDefault );
  341. sinon.assert.notCalled( domEvtDataStub.stopPropagation );
  342. expect( formatTable( getModelData( model ) ) ).to.equal( '[]' + formattedModelTable( [
  343. [ '11', '12' ]
  344. ] ) );
  345. } );
  346. it( 'should move to previous cell', () => {
  347. setModelData( model, modelTable( [
  348. [ '11', '12[]' ]
  349. ] ) );
  350. editor.editing.view.document.fire( 'keydown', domEvtDataStub );
  351. sinon.assert.calledOnce( domEvtDataStub.preventDefault );
  352. sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
  353. expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
  354. [ '[11]', '12' ]
  355. ] ) );
  356. } );
  357. it( 'should not move if caret is in first table cell', () => {
  358. setModelData( model, '<paragraph>foo</paragraph>' + modelTable( [
  359. [ '[]11', '12' ]
  360. ] ) );
  361. editor.editing.view.document.fire( 'keydown', domEvtDataStub );
  362. expect( formatTable( getModelData( model ) ) ).to.equal(
  363. '<paragraph>foo</paragraph>' + formattedModelTable( [ [ '[]11', '12' ] ] )
  364. );
  365. } );
  366. it( 'should move to the last cell of previous row if on beginning of a row', () => {
  367. setModelData( model, modelTable( [
  368. [ '11', '12' ],
  369. [ '[]21', '22' ]
  370. ] ) );
  371. editor.editing.view.document.fire( 'keydown', domEvtDataStub );
  372. expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
  373. [ '11', '[12]' ],
  374. [ '21', '22' ]
  375. ] ) );
  376. } );
  377. it( 'should move to the previous table cell if part of block content is selected', () => {
  378. setModelData( model, modelTable( [
  379. [ '11', '<paragraph>12</paragraph><paragraph>[foo]</paragraph><paragraph>bar</paragraph>', '13' ],
  380. ] ) );
  381. editor.editing.view.document.fire( 'keydown', domEvtDataStub );
  382. expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
  383. [
  384. '[11]',
  385. '<paragraph>12</paragraph><paragraph>foo</paragraph><paragraph>bar</paragraph>',
  386. '13'
  387. ],
  388. ] ) );
  389. } );
  390. it( 'should move to previous cell with an image', () => {
  391. setModelData( model, modelTable( [
  392. [ '<paragraph>foo</paragraph><image></image>', 'bar[]' ]
  393. ] ) );
  394. editor.editing.view.document.fire( 'keydown', domEvtDataStub );
  395. sinon.assert.calledOnce( domEvtDataStub.preventDefault );
  396. sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
  397. expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
  398. [ '<paragraph>[foo</paragraph><image></image>]', 'bar' ]
  399. ] ) );
  400. } );
  401. } );
  402. } );
  403. describe( 'enter key', () => {
  404. let evtDataStub, viewDocument;
  405. beforeEach( () => {
  406. evtDataStub = {
  407. preventDefault: sinon.spy(),
  408. stopPropagation: sinon.spy(),
  409. isSoft: false
  410. };
  411. return VirtualTestEditor
  412. .create( {
  413. plugins: [ TableEditing, Paragraph ]
  414. } )
  415. .then( newEditor => {
  416. editor = newEditor;
  417. sinon.stub( editor, 'execute' );
  418. viewDocument = editor.editing.view.document;
  419. model = editor.model;
  420. } );
  421. } );
  422. it( 'should do nothing if not in table cell', () => {
  423. setModelData( model, '<paragraph>[]foo</paragraph>' );
  424. viewDocument.fire( 'enter', evtDataStub );
  425. sinon.assert.notCalled( editor.execute );
  426. expect( formatTable( getModelData( model ) ) ).to.equal( '<paragraph>[]foo</paragraph>' );
  427. } );
  428. it( 'should do nothing if table cell has already a block content', () => {
  429. setModelData( model, modelTable( [
  430. [ '<paragraph>[]11</paragraph>' ]
  431. ] ) );
  432. viewDocument.fire( 'enter', evtDataStub );
  433. sinon.assert.notCalled( editor.execute );
  434. expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
  435. [ '<paragraph>[]11</paragraph>' ]
  436. ] ) );
  437. } );
  438. it( 'should do nothing if table cell with a block content is selected as a whole', () => {
  439. setModelData( model, modelTable( [
  440. [ '<paragraph>[1</paragraph><paragraph>1]</paragraph>' ]
  441. ] ) );
  442. viewDocument.fire( 'enter', evtDataStub );
  443. sinon.assert.notCalled( editor.execute );
  444. setModelData( model, modelTable( [
  445. [ '<paragraph>[1</paragraph><paragraph>1]</paragraph>' ]
  446. ] ) );
  447. } );
  448. it( 'should allow default behavior of Shift+Enter pressed', () => {
  449. setModelData( model, modelTable( [
  450. [ '[]11' ]
  451. ] ) );
  452. evtDataStub.isSoft = true;
  453. viewDocument.fire( 'enter', evtDataStub );
  454. sinon.assert.notCalled( editor.execute );
  455. expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
  456. [ '[]11' ]
  457. ] ) );
  458. } );
  459. } );
  460. } );