8
0

tablecellpropertiesui.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  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, Event */
  6. import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
  7. import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
  8. import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard';
  9. import { getData as getModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
  10. import Undo from '@ckeditor/ckeditor5-undo/src/undo';
  11. import Batch from '@ckeditor/ckeditor5-engine/src/model/batch';
  12. import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
  13. import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
  14. import ContextualBalloon from '@ckeditor/ckeditor5-ui/src/panel/balloon/contextualballoon';
  15. import Table from '../../src/table';
  16. import TableCellPropertiesEditing from '../../src/tablecellproperties/tablecellpropertiesediting';
  17. import TableCellPropertiesUI from '../../src/tablecellproperties/tablecellpropertiesui';
  18. import TableCellPropertiesUIView from '../../src/tablecellproperties/ui/tablecellpropertiesview';
  19. describe( 'table cell properties', () => {
  20. describe( 'TableCellPropertiesUI', () => {
  21. let editor, editorElement, contextualBalloon,
  22. tableCellPropertiesUI, tableCellPropertiesView, tableCellPropertiesButton,
  23. clock;
  24. testUtils.createSinonSandbox();
  25. beforeEach( () => {
  26. clock = sinon.useFakeTimers();
  27. editorElement = document.createElement( 'div' );
  28. document.body.appendChild( editorElement );
  29. return ClassicTestEditor
  30. .create( editorElement, {
  31. plugins: [ Table, TableCellPropertiesEditing, TableCellPropertiesUI, Paragraph, Undo ],
  32. initialData: '<table><tr><td>foo</td></tr></table><p>bar</p>'
  33. } )
  34. .then( newEditor => {
  35. editor = newEditor;
  36. tableCellPropertiesUI = editor.plugins.get( TableCellPropertiesUI );
  37. tableCellPropertiesButton = editor.ui.componentFactory.create( 'tableCellProperties' );
  38. contextualBalloon = editor.plugins.get( ContextualBalloon );
  39. tableCellPropertiesView = tableCellPropertiesUI.view;
  40. // There is no point to execute BalloonPanelView attachTo and pin methods so lets override it.
  41. testUtils.sinon.stub( contextualBalloon.view, 'attachTo' ).returns( {} );
  42. testUtils.sinon.stub( contextualBalloon.view, 'pin' ).returns( {} );
  43. } );
  44. } );
  45. afterEach( () => {
  46. clock.restore();
  47. editorElement.remove();
  48. return editor.destroy();
  49. } );
  50. it( 'should be named', () => {
  51. expect( TableCellPropertiesUI.pluginName ).to.equal( 'TableCellPropertiesUI' );
  52. } );
  53. it( 'should load ContextualBalloon', () => {
  54. expect( editor.plugins.get( ContextualBalloon ) ).to.be.instanceOf( ContextualBalloon );
  55. } );
  56. describe( 'init()', () => {
  57. it( 'should set a batch', () => {
  58. expect( tableCellPropertiesUI._undoStepBatch ).to.be.null;
  59. } );
  60. describe( '#view', () => {
  61. it( 'should be created', () => {
  62. expect( tableCellPropertiesUI.view ).to.be.instanceOf( TableCellPropertiesUIView );
  63. } );
  64. it( 'should be rendered', () => {
  65. expect( tableCellPropertiesUI.view.isRendered ).to.be.true;
  66. } );
  67. } );
  68. describe( 'toolbar button', () => {
  69. it( 'should be registered', () => {
  70. expect( tableCellPropertiesButton ).to.be.instanceOf( ButtonView );
  71. } );
  72. it( 'should have a label', () => {
  73. expect( tableCellPropertiesButton.label ).to.equal( 'Cell properties' );
  74. } );
  75. it( 'should have a tooltip', () => {
  76. expect( tableCellPropertiesButton.tooltip ).to.be.true;
  77. } );
  78. it( 'should call #_showView upon #execute', () => {
  79. const spy = testUtils.sinon.stub( tableCellPropertiesUI, '_showView' ).returns( {} );
  80. tableCellPropertiesButton.fire( 'execute' );
  81. sinon.assert.calledOnce( spy );
  82. } );
  83. } );
  84. } );
  85. describe( 'destroy()', () => {
  86. it( 'should destroy the #view', () => {
  87. const spy = sinon.spy( tableCellPropertiesView, 'destroy' );
  88. tableCellPropertiesUI.destroy();
  89. sinon.assert.calledOnce( spy );
  90. } );
  91. } );
  92. describe( 'Properties #view', () => {
  93. beforeEach( () => {
  94. editor.model.change( writer => {
  95. writer.setSelection( editor.model.document.getRoot().getChild( 0 ).getChild( 0 ).getChild( 0 ), 0 );
  96. } );
  97. } );
  98. it( 'should hide on #submit', () => {
  99. tableCellPropertiesButton.fire( 'execute' );
  100. expect( contextualBalloon.visibleView ).to.equal( tableCellPropertiesView );
  101. tableCellPropertiesView.fire( 'submit' );
  102. expect( contextualBalloon.visibleView ).to.be.null;
  103. } );
  104. it( 'should undo the entire batch of changes on #cancel', () => {
  105. // Show the view. New batch will be created.
  106. tableCellPropertiesButton.fire( 'execute' );
  107. // Do the changes like a user.
  108. tableCellPropertiesView.borderStyle = 'dotted';
  109. tableCellPropertiesView.backgroundColor = 'red';
  110. expect( getModelData( editor.model ) ).to.equal(
  111. '<table>' +
  112. '<tableRow>' +
  113. '<tableCell backgroundColor="red" borderStyle="dotted">' +
  114. '<paragraph>[]foo</paragraph>' +
  115. '</tableCell>' +
  116. '</tableRow>' +
  117. '</table>' +
  118. '<paragraph>bar</paragraph>'
  119. );
  120. tableCellPropertiesView.fire( 'cancel' );
  121. expect( getModelData( editor.model ) ).to.equal(
  122. '<table>' +
  123. '<tableRow>' +
  124. '<tableCell>' +
  125. '<paragraph>[]foo</paragraph>' +
  126. '</tableCell>' +
  127. '</tableRow>' +
  128. '</table>' +
  129. '<paragraph>bar</paragraph>'
  130. );
  131. } );
  132. it( 'should hide on #cancel', () => {
  133. tableCellPropertiesButton.fire( 'execute' );
  134. expect( contextualBalloon.visibleView ).to.equal( tableCellPropertiesView );
  135. tableCellPropertiesView.fire( 'cancel' );
  136. expect( contextualBalloon.visibleView ).to.be.null;
  137. } );
  138. it( 'should hide on the Esc key press', () => {
  139. const keyEvtData = {
  140. keyCode: keyCodes.esc,
  141. preventDefault: sinon.spy(),
  142. stopPropagation: sinon.spy()
  143. };
  144. tableCellPropertiesButton.fire( 'execute' );
  145. expect( contextualBalloon.visibleView ).to.equal( tableCellPropertiesView );
  146. tableCellPropertiesView.keystrokes.press( keyEvtData );
  147. expect( contextualBalloon.visibleView ).to.be.null;
  148. } );
  149. it( 'should hide if the table cell is no longer selected on EditorUI#update', () => {
  150. tableCellPropertiesButton.fire( 'execute' );
  151. expect( contextualBalloon.visibleView ).to.equal( tableCellPropertiesView );
  152. editor.model.change( writer => {
  153. // Set selection in the paragraph.
  154. writer.setSelection( editor.model.document.getRoot().getChild( 1 ), 0 );
  155. } );
  156. expect( contextualBalloon.visibleView ).to.be.null;
  157. } );
  158. it( 'should reposition if table cell is still selected on on EditorUI#update', () => {
  159. tableCellPropertiesButton.fire( 'execute' );
  160. expect( contextualBalloon.visibleView ).to.equal( tableCellPropertiesView );
  161. editor.model.change( writer => {
  162. writer.insertText( 'qux', editor.model.document.selection.getFirstPosition() );
  163. } );
  164. expect( contextualBalloon.visibleView ).to.equal( tableCellPropertiesView );
  165. } );
  166. it( 'should hide if clicked outside the balloon', () => {
  167. tableCellPropertiesButton.fire( 'execute' );
  168. expect( contextualBalloon.visibleView ).to.equal( tableCellPropertiesView );
  169. document.body.dispatchEvent( new Event( 'mousedown', { bubbles: true } ) );
  170. expect( contextualBalloon.visibleView ).to.be.null;
  171. } );
  172. describe( 'property changes', () => {
  173. beforeEach( () => {
  174. tableCellPropertiesUI._undoStepBatch = 'foo';
  175. } );
  176. describe( '#borderStyle', () => {
  177. it( 'should affect the editor state', () => {
  178. const spy = testUtils.sinon.stub( editor, 'execute' );
  179. tableCellPropertiesView.borderStyle = 'dotted';
  180. sinon.assert.calledOnce( spy );
  181. sinon.assert.calledWithExactly( spy, 'tableCellBorderStyle', { value: 'dotted', batch: 'foo' } );
  182. } );
  183. } );
  184. describe( '#borderColor', () => {
  185. it( 'should affect the editor state', () => {
  186. const spy = testUtils.sinon.stub( editor, 'execute' );
  187. tableCellPropertiesView.borderColor = '#FFAAFF';
  188. sinon.assert.calledOnce( spy );
  189. sinon.assert.calledWithExactly( spy, 'tableCellBorderColor', { value: '#FFAAFF', batch: 'foo' } );
  190. } );
  191. it( 'should display an error message if value is invalid', () => {
  192. const spy = testUtils.sinon.stub( editor, 'execute' );
  193. // First, let's pass an invalid value and check what happens.
  194. tableCellPropertiesView.borderColor = '42';
  195. clock.tick( 500 );
  196. expect( tableCellPropertiesView.borderColorInput.errorText ).to.match( /^The color is invalid/ );
  197. sinon.assert.notCalled( spy );
  198. // And now let's pass a valid value and check if the error text will be gone.
  199. tableCellPropertiesView.borderColor = '#AAA';
  200. clock.tick( 500 );
  201. expect( tableCellPropertiesView.borderColorInput.errorText ).to.be.null;
  202. sinon.assert.calledWithExactly( spy, 'tableCellBorderColor', { value: '#AAA', batch: 'foo' } );
  203. } );
  204. } );
  205. describe( '#borderWidth', () => {
  206. it( 'should affect the editor state', () => {
  207. const spy = testUtils.sinon.stub( editor, 'execute' );
  208. tableCellPropertiesView.borderWidth = '12px';
  209. sinon.assert.calledOnce( spy );
  210. sinon.assert.calledWithExactly( spy, 'tableCellBorderWidth', { value: '12px', batch: 'foo' } );
  211. } );
  212. it( 'should display an error message if value is invalid', () => {
  213. const spy = testUtils.sinon.stub( editor, 'execute' );
  214. // First, let's pass an invalid value and check what happens.
  215. tableCellPropertiesView.borderWidth = 'wrong';
  216. clock.tick( 500 );
  217. expect( tableCellPropertiesView.borderWidthInput.errorText ).to.match( /^The value is invalid/ );
  218. sinon.assert.notCalled( spy );
  219. // And now let's pass a valid value and check if the error text will be gone.
  220. tableCellPropertiesView.borderWidth = '3em';
  221. clock.tick( 500 );
  222. expect( tableCellPropertiesView.backgroundInput.errorText ).to.be.null;
  223. sinon.assert.calledWithExactly( spy, 'tableCellBorderWidth', { value: '3em', batch: 'foo' } );
  224. } );
  225. } );
  226. describe( '#width', () => {
  227. it( 'should affect the editor state', () => {
  228. const spy = testUtils.sinon.stub( editor, 'execute' );
  229. tableCellPropertiesView.width = '12px';
  230. sinon.assert.calledOnce( spy );
  231. sinon.assert.calledWithExactly( spy, 'tableCellWidth', { value: '12px', batch: 'foo' } );
  232. } );
  233. it( 'should display an error message if value is invalid', () => {
  234. const spy = testUtils.sinon.stub( editor, 'execute' );
  235. // First, let's pass an invalid value and check what happens.
  236. tableCellPropertiesView.width = 'wrong';
  237. clock.tick( 500 );
  238. expect( tableCellPropertiesView.widthInput.errorText ).to.match( /^The value is invalid/ );
  239. sinon.assert.notCalled( spy );
  240. // And now let's pass a valid value and check if the error text will be gone.
  241. tableCellPropertiesView.width = '3em';
  242. clock.tick( 500 );
  243. expect( tableCellPropertiesView.backgroundInput.errorText ).to.be.null;
  244. sinon.assert.calledWithExactly( spy, 'tableCellWidth', { value: '3em', batch: 'foo' } );
  245. } );
  246. } );
  247. describe( '#height', () => {
  248. it( 'should affect the editor state', () => {
  249. const spy = testUtils.sinon.stub( editor, 'execute' );
  250. tableCellPropertiesView.height = '12px';
  251. sinon.assert.calledOnce( spy );
  252. sinon.assert.calledWithExactly( spy, 'tableCellHeight', { value: '12px', batch: 'foo' } );
  253. } );
  254. it( 'should display an error message if value is invalid', () => {
  255. const spy = testUtils.sinon.stub( editor, 'execute' );
  256. // First, let's pass an invalid value and check what happens.
  257. tableCellPropertiesView.height = 'wrong';
  258. clock.tick( 500 );
  259. expect( tableCellPropertiesView.heightInput.errorText ).to.match( /^The value is invalid/ );
  260. sinon.assert.notCalled( spy );
  261. // And now let's pass a valid value and check if the error text will be gone.
  262. tableCellPropertiesView.height = '3em';
  263. clock.tick( 500 );
  264. expect( tableCellPropertiesView.backgroundInput.errorText ).to.be.null;
  265. sinon.assert.calledWithExactly( spy, 'tableCellHeight', { value: '3em', batch: 'foo' } );
  266. } );
  267. } );
  268. describe( '#padding', () => {
  269. it( 'should affect the editor state', () => {
  270. const spy = testUtils.sinon.stub( editor, 'execute' );
  271. tableCellPropertiesView.padding = '12px';
  272. sinon.assert.calledOnce( spy );
  273. sinon.assert.calledWithExactly( spy, 'tableCellPadding', { value: '12px', batch: 'foo' } );
  274. } );
  275. it( 'should display an error message if value is invalid', () => {
  276. const spy = testUtils.sinon.stub( editor, 'execute' );
  277. // First, let's pass an invalid value and check what happens.
  278. tableCellPropertiesView.padding = 'wrong';
  279. clock.tick( 500 );
  280. expect( tableCellPropertiesView.paddingInput.errorText ).to.match( /^The value is invalid/ );
  281. sinon.assert.notCalled( spy );
  282. // And now let's pass a valid value and check if the error text will be gone.
  283. tableCellPropertiesView.padding = '3em';
  284. clock.tick( 500 );
  285. expect( tableCellPropertiesView.backgroundInput.errorText ).to.be.null;
  286. sinon.assert.calledWithExactly( spy, 'tableCellPadding', { value: '3em', batch: 'foo' } );
  287. } );
  288. } );
  289. describe( '#backgroundColor', () => {
  290. it( 'should affect the editor state', () => {
  291. const spy = testUtils.sinon.stub( editor, 'execute' );
  292. tableCellPropertiesView.backgroundColor = '#FFAAFF';
  293. sinon.assert.calledOnce( spy );
  294. sinon.assert.calledWithExactly( spy, 'tableCellBackgroundColor', { value: '#FFAAFF', batch: 'foo' } );
  295. } );
  296. it( 'should display an error message if value is invalid', () => {
  297. const spy = testUtils.sinon.stub( editor, 'execute' );
  298. // First, let's pass an invalid value and check what happens.
  299. tableCellPropertiesView.backgroundColor = '42';
  300. clock.tick( 500 );
  301. expect( tableCellPropertiesView.backgroundInput.errorText ).to.match( /^The color is invalid/ );
  302. sinon.assert.notCalled( spy );
  303. // And now let's pass a valid value and check if the error text will be gone.
  304. tableCellPropertiesView.backgroundColor = '#AAA';
  305. clock.tick( 500 );
  306. expect( tableCellPropertiesView.backgroundInput.errorText ).to.be.null;
  307. sinon.assert.calledWithExactly( spy, 'tableCellBackgroundColor', { value: '#AAA', batch: 'foo' } );
  308. } );
  309. } );
  310. describe( '#horizontalAlignment', () => {
  311. it( 'should affect the editor state', () => {
  312. const spy = testUtils.sinon.stub( editor, 'execute' );
  313. tableCellPropertiesView.horizontalAlignment = 'right';
  314. sinon.assert.calledOnce( spy );
  315. sinon.assert.calledWithExactly( spy, 'tableCellHorizontalAlignment', { value: 'right', batch: 'foo' } );
  316. } );
  317. } );
  318. describe( '#verticalAlignment', () => {
  319. it( 'should affect the editor state', () => {
  320. const spy = testUtils.sinon.stub( editor, 'execute' );
  321. tableCellPropertiesView.verticalAlignment = 'right';
  322. sinon.assert.calledOnce( spy );
  323. sinon.assert.calledWithExactly( spy, 'tableCellVerticalAlignment', { value: 'right', batch: 'foo' } );
  324. } );
  325. } );
  326. it( 'should not display an error text if user managed to fix the value before the UI timeout', () => {
  327. // First, let's pass an invalid value.
  328. tableCellPropertiesView.borderColor = '#';
  329. clock.tick( 100 );
  330. // Then the user managed to quickly type the correct value.
  331. tableCellPropertiesView.borderColor = '#aaa';
  332. clock.tick( 400 );
  333. // Because they were quick, they should see no error
  334. expect( tableCellPropertiesView.borderColorInput.errorText ).to.be.null;
  335. } );
  336. it( 'should not affect the editor state if internal property has changed', () => {
  337. const spy = testUtils.sinon.stub( editor, 'execute' );
  338. tableCellPropertiesView.set( 'internalProp', 'foo' );
  339. tableCellPropertiesView.internalProp = 'bar';
  340. sinon.assert.notCalled( spy );
  341. } );
  342. } );
  343. } );
  344. describe( 'Showing the #view', () => {
  345. beforeEach( () => {
  346. editor.model.change( writer => {
  347. writer.setSelection( editor.model.document.getRoot().getChild( 0 ).getChild( 0 ).getChild( 0 ), 0 );
  348. } );
  349. } );
  350. it( 'should create a new undoable batch for further #view cancel', () => {
  351. tableCellPropertiesButton.fire( 'execute' );
  352. expect( contextualBalloon.visibleView ).to.equal( tableCellPropertiesView );
  353. const firstBatch = tableCellPropertiesUI._undoStepBatch;
  354. expect( firstBatch ).to.be.instanceOf( Batch );
  355. tableCellPropertiesView.fire( 'submit' );
  356. expect( contextualBalloon.visibleView ).to.be.null;
  357. tableCellPropertiesButton.fire( 'execute' );
  358. const secondBatch = tableCellPropertiesUI._undoStepBatch;
  359. expect( secondBatch ).to.be.instanceOf( Batch );
  360. expect( firstBatch ).to.not.equal( secondBatch );
  361. } );
  362. describe( 'initial data', () => {
  363. it( 'should be set from the command values', () => {
  364. editor.commands.get( 'tableCellBorderStyle' ).value = 'a';
  365. editor.commands.get( 'tableCellBorderColor' ).value = 'b';
  366. editor.commands.get( 'tableCellBorderWidth' ).value = 'c';
  367. editor.commands.get( 'tableCellWidth' ).value = 'd';
  368. editor.commands.get( 'tableCellHeight' ).value = 'e';
  369. editor.commands.get( 'tableCellPadding' ).value = 'f';
  370. editor.commands.get( 'tableCellBackgroundColor' ).value = 'g';
  371. editor.commands.get( 'tableCellHorizontalAlignment' ).value = 'h';
  372. editor.commands.get( 'tableCellVerticalAlignment' ).value = 'i';
  373. tableCellPropertiesButton.fire( 'execute' );
  374. expect( contextualBalloon.visibleView ).to.equal( tableCellPropertiesView );
  375. expect( tableCellPropertiesView ).to.include( {
  376. borderStyle: 'a',
  377. borderColor: 'b',
  378. borderWidth: 'c',
  379. width: 'd',
  380. height: 'e',
  381. padding: 'f',
  382. backgroundColor: 'g',
  383. horizontalAlignment: 'h',
  384. verticalAlignment: 'i'
  385. } );
  386. } );
  387. it( 'should use default values when command has no value', () => {
  388. editor.commands.get( 'tableCellBorderStyle' ).value = null;
  389. editor.commands.get( 'tableCellBorderColor' ).value = null;
  390. editor.commands.get( 'tableCellBorderWidth' ).value = null;
  391. editor.commands.get( 'tableCellWidth' ).value = null;
  392. editor.commands.get( 'tableCellHeight' ).value = null;
  393. editor.commands.get( 'tableCellPadding' ).value = null;
  394. editor.commands.get( 'tableCellBackgroundColor' ).value = null;
  395. editor.commands.get( 'tableCellHorizontalAlignment' ).value = null;
  396. editor.commands.get( 'tableCellVerticalAlignment' ).value = null;
  397. tableCellPropertiesButton.fire( 'execute' );
  398. expect( contextualBalloon.visibleView ).to.equal( tableCellPropertiesView );
  399. expect( tableCellPropertiesView ).to.include( {
  400. borderStyle: 'none',
  401. borderColor: '',
  402. borderWidth: '',
  403. width: '',
  404. height: '',
  405. padding: '',
  406. backgroundColor: '',
  407. horizontalAlignment: 'left',
  408. verticalAlignment: 'middle'
  409. } );
  410. } );
  411. } );
  412. it( 'should focus the form view', () => {
  413. const spy = testUtils.sinon.spy( tableCellPropertiesView, 'focus' );
  414. tableCellPropertiesButton.fire( 'execute' );
  415. sinon.assert.calledOnce( spy );
  416. } );
  417. } );
  418. describe( 'Hiding the #view', () => {
  419. beforeEach( () => {
  420. editor.model.change( writer => {
  421. writer.setSelection( editor.model.document.getRoot().getChild( 0 ).getChild( 0 ).getChild( 0 ), 0 );
  422. } );
  423. } );
  424. it( 'should stop listening to EditorUI#update', () => {
  425. const spy = testUtils.sinon.spy( tableCellPropertiesUI, 'stopListening' );
  426. tableCellPropertiesButton.fire( 'execute' );
  427. expect( contextualBalloon.visibleView ).to.equal( tableCellPropertiesView );
  428. tableCellPropertiesView.fire( 'submit' );
  429. expect( contextualBalloon.visibleView ).to.be.null;
  430. sinon.assert.calledOnce( spy );
  431. sinon.assert.calledWithExactly( spy, editor.ui, 'update' );
  432. } );
  433. it( 'should focus the editing view so the focus is not lost', () => {
  434. const spy = testUtils.sinon.spy( editor.editing.view, 'focus' );
  435. tableCellPropertiesButton.fire( 'execute' );
  436. expect( contextualBalloon.visibleView ).to.equal( tableCellPropertiesView );
  437. tableCellPropertiesView.fire( 'submit' );
  438. sinon.assert.calledOnce( spy );
  439. } );
  440. } );
  441. } );
  442. } );