@@ -45,3 +45,62 @@ describe('UID', () => {
45
45
expect ( Select . find ( '#vs2__combobox' ) . exists ( ) ) . toBeTruthy ( )
46
46
} )
47
47
} )
48
+
49
+ describe ( 'Option List' , ( ) => {
50
+ it ( 'multiselectable attribute should not be present by default' , async ( ) => {
51
+ const Select = mountDefault ( )
52
+
53
+ Select . vm . open = true
54
+ await Select . vm . $nextTick ( )
55
+
56
+ expect (
57
+ Select . findComponent ( { ref : 'dropdownMenu' } ) . attributes ( ) [
58
+ 'aria-multiselectable'
59
+ ]
60
+ ) . toEqual ( undefined )
61
+ } )
62
+
63
+ it ( 'multiselectable attribute should be true when multiple is true' , async ( ) => {
64
+ const Select = mountDefault ( { multiple : true } )
65
+
66
+ Select . vm . open = true
67
+ await Select . vm . $nextTick ( )
68
+
69
+ expect (
70
+ Select . findComponent ( { ref : 'dropdownMenu' } ) . attributes ( ) [
71
+ 'aria-multiselectable'
72
+ ]
73
+ ) . toEqual ( 'true' )
74
+ } )
75
+
76
+ it ( 'selected attribute should be true if selected, false otherwise' , async ( ) => {
77
+ const Select = mountDefault ( {
78
+ value : 'two' ,
79
+ } )
80
+
81
+ Select . vm . open = true
82
+ await Select . vm . $nextTick ( )
83
+
84
+ expect (
85
+ Select . findAll ( '.vs__dropdown-option' ) . wrappers . map (
86
+ ( option ) => option . attributes ( ) [ 'aria-selected' ]
87
+ )
88
+ ) . toStrictEqual ( [ 'false' , 'true' , 'false' ] )
89
+ } )
90
+
91
+ it ( 'selected attribute should be true on all selected options when multiple is true, false otherwise' , async ( ) => {
92
+ const Select = mountDefault ( {
93
+ multiple : true ,
94
+ value : [ 'one' , 'two' ] ,
95
+ } )
96
+
97
+ Select . vm . open = true
98
+ await Select . vm . $nextTick ( )
99
+
100
+ expect (
101
+ Select . findAll ( '.vs__dropdown-option' ) . wrappers . map (
102
+ ( option ) => option . attributes ( ) [ 'aria-selected' ]
103
+ )
104
+ ) . toStrictEqual ( [ 'true' , 'true' , 'false' ] )
105
+ } )
106
+ } )
0 commit comments