@@ -80,22 +80,49 @@ describe( 'EditableUIView', () => {
80
80
} ) ;
81
81
82
82
// https://github.com/ckeditor/ckeditor5/issues/1530.
83
+ // https://github.com/ckeditor/ckeditor5/issues/1676.
83
84
it ( 'should work when update is handled during the rendering phase' , ( ) => {
85
+ const secondEditingViewRoot = new ViewRootEditableElement ( 'div' ) ;
86
+ const secondView = new EditableUIView ( locale , editingView ) ;
87
+ const secondEditableElement = document . createElement ( 'div' ) ;
88
+
89
+ document . body . appendChild ( secondEditableElement ) ;
90
+
91
+ secondEditingViewRoot . rootName = 'second' ;
92
+ secondEditingViewRoot . _document = editingView . document ;
93
+ editingView . document . roots . add ( secondEditingViewRoot ) ;
94
+
95
+ secondView . name = 'second' ;
96
+ secondView . render ( ) ;
97
+
98
+ editingView . attachDomRoot ( editableElement , 'main' ) ;
99
+ editingView . attachDomRoot ( secondEditableElement , 'second' ) ;
100
+
84
101
view . isFocused = true ;
85
- editingView . isRenderingInProgress = true ;
102
+ secondView . isFocused = false ;
86
103
87
- expect ( editingViewRoot . hasClass ( 'ck-focused' ) ) . to . be . true ;
88
- expect ( editingViewRoot . hasClass ( 'ck-blurred' ) ) . to . be . false ;
104
+ expect ( editingViewRoot . hasClass ( 'ck-focused' ) , 1 ) . to . be . true ;
105
+ expect ( editingViewRoot . hasClass ( 'ck-blurred' ) , 2 ) . to . be . false ;
106
+ expect ( secondEditingViewRoot . hasClass ( 'ck-focused' ) , 3 ) . to . be . false ;
107
+ expect ( secondEditingViewRoot . hasClass ( 'ck-blurred' ) , 4 ) . to . be . true ;
89
108
109
+ editingView . isRenderingInProgress = true ;
90
110
view . isFocused = false ;
111
+ secondView . isFocused = true ;
91
112
92
- expect ( editingViewRoot . hasClass ( 'ck-focused' ) ) . to . be . true ;
93
- expect ( editingViewRoot . hasClass ( 'ck-blurred' ) ) . to . be . false ;
113
+ expect ( editingViewRoot . hasClass ( 'ck-focused' ) , 5 ) . to . be . true ;
114
+ expect ( editingViewRoot . hasClass ( 'ck-blurred' ) , 6 ) . to . be . false ;
115
+ expect ( secondEditingViewRoot . hasClass ( 'ck-focused' ) , 7 ) . to . be . false ;
116
+ expect ( secondEditingViewRoot . hasClass ( 'ck-blurred' ) , 8 ) . to . be . true ;
94
117
95
118
editingView . isRenderingInProgress = false ;
96
119
97
- expect ( editingViewRoot . hasClass ( 'ck-focused' ) ) . to . be . false ;
98
- expect ( editingViewRoot . hasClass ( 'ck-blurred' ) ) . to . be . true ;
120
+ expect ( editingViewRoot . hasClass ( 'ck-focused' ) , 9 ) . to . be . false ;
121
+ expect ( editingViewRoot . hasClass ( 'ck-blurred' ) , 10 ) . to . be . true ;
122
+ expect ( secondEditingViewRoot . hasClass ( 'ck-focused' ) , 11 ) . to . be . true ;
123
+ expect ( secondEditingViewRoot . hasClass ( 'ck-blurred' ) , 12 ) . to . be . false ;
124
+
125
+ secondEditableElement . remove ( ) ;
99
126
} ) ;
100
127
} ) ;
101
128
} ) ;
0 commit comments