@@ -80,22 +80,49 @@ describe( 'EditableUIView', () => {
8080 } ) ;
8181
8282 // https://github.com/ckeditor/ckeditor5/issues/1530.
83+ // https://github.com/ckeditor/ckeditor5/issues/1676.
8384 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+
84101 view . isFocused = true ;
85- editingView . isRenderingInProgress = true ;
102+ secondView . isFocused = false ;
86103
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 ;
89108
109+ editingView . isRenderingInProgress = true ;
90110 view . isFocused = false ;
111+ secondView . isFocused = true ;
91112
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 ;
94117
95118 editingView . isRenderingInProgress = false ;
96119
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 ( ) ;
99126 } ) ;
100127 } ) ;
101128 } ) ;
0 commit comments