@@ -18,7 +18,7 @@ describe('form-spinbutton', () => {
18
18
// We always have LTR to ensire the flex order stays ltr
19
19
expect ( wrapper . attributes ( 'dir' ) ) . toEqual ( 'ltr' )
20
20
21
- // Should ahve 3 child elements (btn, output, btn)
21
+ // Should have 3 child elements (btn, output, btn)
22
22
expect ( wrapper . findAll ( '.b-form-spinbutton > *' ) . length ) . toBe ( 3 )
23
23
24
24
const $decrement = wrapper . find ( '[aria-label="Decrement"]' )
@@ -51,6 +51,55 @@ describe('form-spinbutton', () => {
51
51
wrapper . destroy ( )
52
52
} )
53
53
54
+ it ( 'has expected structure when value set' , async ( ) => {
55
+ const wrapper = mount ( BFormSpinbutton , {
56
+ propsData : {
57
+ min : 0 ,
58
+ max : 10 ,
59
+ value : 5
60
+ }
61
+ } )
62
+ expect ( wrapper . isVueInstance ( ) ) . toBe ( true )
63
+ await waitNT ( wrapper . vm )
64
+ await waitRAF ( )
65
+
66
+ expect ( wrapper . classes ( ) ) . toContain ( 'b-form-spinbutton' )
67
+ expect ( wrapper . classes ( ) ) . toContain ( 'form-control' )
68
+ expect ( wrapper . classes ( ) ) . toContain ( 'd-flex' )
69
+ expect ( wrapper . classes ( ) ) . toContain ( 'align-items-stretch' )
70
+ expect ( wrapper . attributes ( 'role' ) ) . toEqual ( 'group' )
71
+ expect ( wrapper . attributes ( 'tabindex' ) ) . toEqual ( '-1' )
72
+ // We always have LTR to ensire the flex order stays ltr
73
+ expect ( wrapper . attributes ( 'dir' ) ) . toEqual ( 'ltr' )
74
+
75
+ // Should have 3 child elements (btn, output, btn)
76
+ expect ( wrapper . findAll ( '.b-form-spinbutton > *' ) . length ) . toBe ( 3 )
77
+
78
+ const $decrement = wrapper . find ( '[aria-label="Decrement"]' )
79
+ expect ( $decrement . exists ( ) ) . toBe ( true )
80
+ expect ( $decrement . is ( 'button' ) ) . toBe ( true )
81
+ expect ( $decrement . attributes ( 'tabindex' ) ) . toEqual ( '-1' )
82
+ expect ( $decrement . attributes ( 'aria-keyshortcuts' ) ) . toEqual ( 'ArrowDown' )
83
+
84
+ const $increment = wrapper . find ( '[aria-label="Increment"]' )
85
+ expect ( $increment . exists ( ) ) . toBe ( true )
86
+ expect ( $increment . is ( 'button' ) ) . toBe ( true )
87
+ expect ( $increment . attributes ( 'tabindex' ) ) . toEqual ( '-1' )
88
+ expect ( $decrement . attributes ( 'aria-keyshortcuts' ) ) . toEqual ( 'ArrowUp' )
89
+
90
+ const $output = wrapper . find ( 'output' )
91
+ expect ( $output . exists ( ) ) . toBe ( true )
92
+ expect ( $output . attributes ( 'role' ) ) . toEqual ( 'spinbutton' )
93
+ expect ( $output . attributes ( 'tabindex' ) ) . toEqual ( '0' )
94
+ expect ( $output . attributes ( 'aria-live' ) ) . toEqual ( 'off' )
95
+ expect ( $output . attributes ( 'aria-valuemin' ) ) . toEqual ( '0' )
96
+ expect ( $output . attributes ( 'aria-valuemax' ) ) . toEqual ( '10' )
97
+ expect ( $output . attributes ( 'aria-valuenow' ) ) . toEqual ( '5' )
98
+ expect ( $output . attributes ( 'aria-valuetext' ) ) . toEqual ( '5' )
99
+
100
+ wrapper . destroy ( )
101
+ } )
102
+
54
103
it ( 'renders hidden input when name set' , async ( ) => {
55
104
const wrapper = mount ( BFormSpinbutton , {
56
105
propsData : {
0 commit comments