@@ -9,10 +9,41 @@ describe('form-spinbutton', () => {
9
9
await waitNT ( wrapper . vm )
10
10
await waitRAF ( )
11
11
12
- expect ( wrapper . classes ( ) ) . toContain ( 'form-control' )
13
12
expect ( wrapper . classes ( ) ) . toContain ( 'b-form-spinbutton' )
13
+ expect ( wrapper . classes ( ) ) . toContain ( 'form-control' )
14
+ expect ( wrapper . classes ( ) ) . toContain ( 'd-flex' )
15
+ expect ( wrapper . classes ( ) ) . toContain ( 'align-items-stretch' )
16
+ expect ( wrapper . attributes ( 'role' ) ) . toEqual ( 'group' )
17
+ expect ( wrapper . attributes ( 'tabindex' ) ) . toEqual ( '-1' )
18
+ // We always have LTR to ensire the flex order stays ltr
19
+ expect ( wrapper . attributes ( 'dir' ) ) . toEqual ( 'ltr' )
20
+
21
+ // Should ahve 3 child elements (btn, output, btn)
22
+ expect ( wrapper . findAll ( '.b-form-spin-button > *' ) . length ) . toBe ( 3 )
23
+
24
+ const $decrement = wrapper . find ( '[aria-label="Decrement"]' )
25
+ expect ( $decrement . exists ( ) ) . toBe ( true )
26
+ expect ( $decrement . is ( 'button' ) ) . toBe ( true )
27
+ expect ( $decrement . attributes ( 'tabindex' ) ) . toEqual ( '-1' )
28
+ expect ( $decrement . attributes ( 'aria-keyshortcuts' ) ) . toEqual ( 'ArrowDown' )
29
+
30
+ const $increment = wrapper . find ( '[aria-label="Increment"]' )
31
+ expect ( $increment ) . exists ( ) ) . toBe ( true )
32
+ expect ( $increment ) . is ( 'button' ) ) . toBe ( true )
33
+ expect ( $increment . attributes ( 'tabindex' ) ) . toEqual ( '-1' )
34
+ expect ( $decrement . attributes ( 'aria-keyshortcuts' ) ) . toEqual ( 'ArrowUp' )
14
35
15
- // TBD
36
+ const $output = wrapper . find ( 'output' )
37
+ expect ( $output . exists ( ) ) . toBe ( true )
38
+ expect ( $output . attributes ( 'role' ) ) . toEqual ( 'spinbutton' )
39
+ expect ( $output . attributes ( 'tabindex' ) ) . toEqual ( '0' )
40
+ expect ( $output . attributes ( 'aria-live' ) ) . toEqual ( 'off' )
41
+ expect ( $output . attributes ( 'aria-valuemin' ) ) . toEqual ( '1' )
42
+ expect ( $output . attributes ( 'aria-valuemax' ) ) . toEqual ( '100' )
43
+ // These two attribute should exist on the element
44
+ expect ( $output . element . hasAttribute ( 'aria-valuenow' ) ) . toBe ( false )
45
+ expect ( $output . element . hasAttribute ( 'aria-valuetext' ) ) . toBe ( false )
46
+ expect ( $output . find ( 'div' ) . exists ( ) ) . toBe ( true )
16
47
17
48
await waitNT ( wrapper . vm )
18
49
await waitRAF ( )
0 commit comments