@@ -11,6 +11,7 @@ import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
11
11
12
12
import TableEditing from '../src/tableediting' ;
13
13
import TableUI from '../src/tableui' ;
14
+ import InsertTableView from '../src/ui/inserttableview' ;
14
15
import SwitchButtonView from '@ckeditor/ckeditor5-ui/src/button/switchbuttonview' ;
15
16
import DropdownView from '@ckeditor/ckeditor5-ui/src/dropdown/dropdownview' ;
16
17
import ListSeparatorView from '@ckeditor/ckeditor5-ui/src/list/listseparatorview' ;
@@ -53,6 +54,7 @@ describe( 'TableUI', () => {
53
54
54
55
beforeEach ( ( ) => {
55
56
insertTable = editor . ui . componentFactory . create ( 'insertTable' ) ;
57
+ insertTable . isOpen = true ; // Dropdown is lazy loaded, so make sure its open (#6193).
56
58
} ) ;
57
59
58
60
it ( 'should register insertTable button' , ( ) => {
@@ -65,7 +67,7 @@ describe( 'TableUI', () => {
65
67
const command = editor . commands . get ( 'insertTable' ) ;
66
68
67
69
command . isEnabled = true ;
68
- expect ( insertTable . buttonView . isOn ) . to . be . false ;
70
+ expect ( insertTable . buttonView . isOn ) . to . be . true ;
69
71
expect ( insertTable . buttonView . isEnabled ) . to . be . true ;
70
72
71
73
command . isEnabled = false ;
@@ -87,6 +89,8 @@ describe( 'TableUI', () => {
87
89
} ) ;
88
90
89
91
it ( 'should reset rows & columns on dropdown open' , ( ) => {
92
+ insertTable . isOpen = true ;
93
+
90
94
const tableSizeView = insertTable . panelView . children . first ;
91
95
92
96
expect ( tableSizeView . rows ) . to . equal ( 0 ) ;
@@ -100,6 +104,14 @@ describe( 'TableUI', () => {
100
104
expect ( tableSizeView . rows ) . to . equal ( 0 ) ;
101
105
expect ( tableSizeView . columns ) . to . equal ( 0 ) ;
102
106
} ) ;
107
+
108
+ it ( 'is not fully initialized when not open' , ( ) => {
109
+ const dropdown = editor . ui . componentFactory . create ( 'insertTable' ) ;
110
+
111
+ for ( const childView of dropdown . panelView . children ) {
112
+ expect ( childView ) . not . to . be . instanceOf ( InsertTableView ) ;
113
+ }
114
+ } ) ;
103
115
} ) ;
104
116
105
117
describe ( 'tableRow dropdown' , ( ) => {
0 commit comments