@@ -191,16 +191,7 @@ describe('toolbar controls', () => {
191
191
expect ( editor . getFormat ( 0 ) ) . to . deep . equal ( { } ) ;
192
192
} ) ;
193
193
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' , ( ) => {
204
195
it ( 'should toggle "toolbar-button-pressed" part value when the format button is clicked' , ( ) => {
205
196
btn = getButton ( 'bold' ) ;
206
197
@@ -210,7 +201,7 @@ describe('toolbar controls', () => {
210
201
expect ( btn . part . contains ( 'toolbar-button-pressed' ) ) . to . be . false ;
211
202
} ) ;
212
203
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' , ( ) => {
214
205
const delta = new window . Quill . imports . delta ( [
215
206
{ attributes : { bold : true } , insert : 'Foo\n' } ,
216
207
{ attributes : { italic : true } , insert : 'Bar\n' } ,
@@ -223,19 +214,19 @@ describe('toolbar controls', () => {
223
214
const linkBtn = getButton ( 'link' ) ;
224
215
225
216
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 ;
229
220
230
221
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 ;
234
225
235
226
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 ;
239
230
} ) ;
240
231
} ) ;
241
232
0 commit comments