@@ -10,6 +10,17 @@ describe('dropdown-form', () => {
10
10
expect ( form . is ( 'form' ) ) . toBe ( true )
11
11
} )
12
12
13
+ it ( 'default has expected classes' , async ( ) => {
14
+ const wrapper = mount ( BDropdownForm )
15
+ expect ( wrapper . is ( 'li' ) ) . toBe ( true )
16
+
17
+ const form = wrapper . find ( 'form' )
18
+ expect ( form . classes ( ) ) . toContain ( 'b-dropdown-form' )
19
+ expect ( form . classes ( ) ) . toContain ( 'dropdown-item' )
20
+ expect ( form . classes ( ) ) . not . toContain ( 'was-validated' )
21
+ expect ( form . classes ( ) ) . not . toContain ( 'disabled' )
22
+ } )
23
+
13
24
it ( 'has tabindex on form' , async ( ) => {
14
25
const wrapper = mount ( BDropdownForm )
15
26
expect ( wrapper . is ( 'li' ) ) . toBe ( true )
@@ -20,14 +31,19 @@ describe('dropdown-form', () => {
20
31
expect ( form . attributes ( 'tabindex' ) ) . toEqual ( '0' )
21
32
} )
22
33
23
- it ( 'has custom class "b-dropdown-form"' , async ( ) => {
24
- const wrapper = mount ( BDropdownForm )
34
+ it ( 'does not have tabindex on form when disabled' , async ( ) => {
35
+ const wrapper = mount ( BDropdownForm , {
36
+ propsData : {
37
+ disabled : true
38
+ }
39
+ } )
25
40
expect ( wrapper . is ( 'li' ) ) . toBe ( true )
26
41
27
42
const form = wrapper . find ( 'form' )
28
- expect ( form . classes ( ) ) . toContain ( 'b-dropdown-form' )
29
- expect ( form . classes ( ) ) . toContain ( 'dropdown-item' )
30
- expect ( form . classes ( ) ) . not . toContain ( 'was-validated' )
43
+ expect ( form . is ( 'form' ) ) . toBe ( true )
44
+ expect ( form . attributes ( 'tabindex' ) ) . not . toBeDefined ( )
45
+ expect ( form . attributes ( 'disabled' ) ) . toBeDefined ( )
46
+ expect ( form . classes ( ) ) . toContain ( 'disabled' )
31
47
} )
32
48
33
49
it ( 'has class "was-validated" when validated=true' , async ( ) => {
0 commit comments