@@ -191,16 +191,7 @@ describe('toolbar controls', () => {
191191 expect ( editor . getFormat ( 0 ) ) . to . deep . equal ( { } ) ;
192192 } ) ;
193193
194- describe ( 'on state attribute' , ( ) => {
195- it ( 'should toggle "on" attribute when the format button is clicked' , ( ) => {
196- btn = getButton ( 'bold' ) ;
197-
198- btn . click ( ) ;
199- expect ( btn . hasAttribute ( 'on' ) ) . to . be . true ;
200- btn . click ( ) ;
201- expect ( btn . hasAttribute ( 'on' ) ) . to . be . false ;
202- } ) ;
203-
194+ describe ( 'pressed button' , ( ) => {
204195 it ( 'should toggle "toolbar-button-pressed" part value when the format button is clicked' , ( ) => {
205196 btn = getButton ( 'bold' ) ;
206197
@@ -210,7 +201,7 @@ describe('toolbar controls', () => {
210201 expect ( btn . part . contains ( 'toolbar-button-pressed' ) ) . to . be . false ;
211202 } ) ;
212203
213- it ( 'should toggle "on" attribute for corresponding buttons when selection is changed' , ( ) => {
204+ it ( 'should toggle "toolbar-button-pressed" part value for corresponding buttons when selection is changed' , ( ) => {
214205 const delta = new window . Quill . imports . delta ( [
215206 { attributes : { bold : true } , insert : 'Foo\n' } ,
216207 { attributes : { italic : true } , insert : 'Bar\n' } ,
@@ -223,19 +214,19 @@ describe('toolbar controls', () => {
223214 const linkBtn = getButton ( 'link' ) ;
224215
225216 editor . setSelection ( 0 , 1 ) ;
226- expect ( boldBtn . hasAttribute ( 'on ') ) . to . be . true ;
227- expect ( italicBtn . hasAttribute ( 'on ') ) . to . be . false ;
228- expect ( linkBtn . hasAttribute ( 'on ') ) . to . be . false ;
217+ expect ( boldBtn . part . contains ( 'toolbar-button-pressed ') ) . to . be . true ;
218+ expect ( italicBtn . part . contains ( 'toolbar-button-pressed ') ) . to . be . false ;
219+ expect ( linkBtn . part . contains ( 'toolbar-button-pressed ') ) . to . be . false ;
229220
230221 editor . setSelection ( 4 , 1 ) ;
231- expect ( boldBtn . hasAttribute ( 'on ') ) . to . be . false ;
232- expect ( italicBtn . hasAttribute ( 'on ') ) . to . be . true ;
233- expect ( linkBtn . hasAttribute ( 'on ') ) . to . be . false ;
222+ expect ( boldBtn . part . contains ( 'toolbar-button-pressed ') ) . to . be . false ;
223+ expect ( italicBtn . part . contains ( 'toolbar-button-pressed ') ) . to . be . true ;
224+ expect ( linkBtn . part . contains ( 'toolbar-button-pressed ') ) . to . be . false ;
234225
235226 editor . setSelection ( 8 , 1 ) ;
236- expect ( boldBtn . hasAttribute ( 'on ') ) . to . be . false ;
237- expect ( italicBtn . hasAttribute ( 'on ') ) . to . be . false ;
238- expect ( linkBtn . hasAttribute ( 'on ') ) . to . be . true ;
227+ expect ( boldBtn . part . contains ( 'toolbar-button-pressed ') ) . to . be . false ;
228+ expect ( italicBtn . part . contains ( 'toolbar-button-pressed ') ) . to . be . false ;
229+ expect ( linkBtn . part . contains ( 'toolbar-button-pressed ') ) . to . be . true ;
239230 } ) ;
240231 } ) ;
241232
0 commit comments