11import '../button-icon.js' ;
22import '../button-toggle.js' ;
3- import { expect , fixture , html } from '@brightspace-ui/testing' ;
3+ import { expect , fixture , focusElem , html } from '@brightspace-ui/testing' ;
44
55describe ( 'd2l-button-toggle' , ( ) => {
66
@@ -23,4 +23,40 @@ describe('d2l-button-toggle', () => {
2323 await expect ( el ) . to . be . accessible ( ) ;
2424 } ) ;
2525
26+ it ( 'disabled' , async ( ) => {
27+ const el = await fixture ( html `
28+ < d2l-button-toggle >
29+ < d2l-button-icon slot ="not-pressed " disabled icon ="tier1:pin-hollow " text ="Unpinned, click to pin. "> </ d2l-button-icon >
30+ < d2l-button-icon slot ="pressed " disabled icon ="tier1:pin-filled " text ="Pinned, click to unpin. "> </ d2l-button-icon >
31+ </ d2l-button-toggle >
32+ ` ) ;
33+ await expect ( el ) . to . be . accessible ( ) ;
34+ } ) ;
35+
36+ describe ( 'focus management' , ( ) => {
37+
38+ it ( 'focused not-pressed button' , async ( ) => {
39+ const el = await fixture ( html `
40+ < d2l-button-toggle >
41+ < d2l-button-icon slot ="not-pressed " icon ="tier1:pin-hollow " text ="Unpinned, click to pin. "> </ d2l-button-icon >
42+ < d2l-button-icon slot ="pressed " icon ="tier1:pin-filled " text ="Pinned, click to unpin. "> </ d2l-button-icon >
43+ </ d2l-button-toggle >
44+ ` ) ;
45+ await focusElem ( el ) ;
46+ await expect ( el ) . to . be . accessible ( ) ;
47+ } ) ;
48+
49+ it ( 'focused pressed button' , async ( ) => {
50+ const el = await fixture ( html `
51+ < d2l-button-toggle pressed >
52+ < d2l-button-icon slot ="not-pressed " icon ="tier1:pin-hollow " text ="Unpinned, click to pin. "> </ d2l-button-icon >
53+ < d2l-button-icon slot ="pressed " icon ="tier1:pin-filled " text ="Pinned, click to unpin. "> </ d2l-button-icon >
54+ </ d2l-button-toggle >
55+ ` ) ;
56+ await focusElem ( el ) ;
57+ await expect ( el ) . to . be . accessible ( ) ;
58+ } ) ;
59+
60+ } ) ;
61+
2662} ) ;
0 commit comments