@@ -45,3 +45,63 @@ 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
+ ) . toBe ( 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
+ ) . toBe ( 'true' )
74
+ } )
75
+
76
+ it ( 'selected attribute should be true on highlighted option only' , async ( ) => {
77
+ const Select = mountDefault ( )
78
+
79
+ Select . vm . open = true
80
+ await Select . vm . $nextTick ( )
81
+ Select . vm . typeAheadDown ( )
82
+ Select . vm . typeAheadDown ( )
83
+ await Select . vm . $nextTick ( )
84
+
85
+ expect (
86
+ Select . findAll ( '.vs__dropdown-option' ) . wrappers . map (
87
+ ( option ) => option . attributes ( ) [ 'aria-selected' ]
88
+ )
89
+ ) . toStrictEqual ( [ undefined , 'true' , undefined ] )
90
+ } )
91
+
92
+ it ( 'selected attribute should be true on all selected options when multiple is true' , async ( ) => {
93
+ const Select = mountDefault ( {
94
+ multiple : true ,
95
+ value : [ 'one' , 'two' ] ,
96
+ } )
97
+
98
+ Select . vm . open = true
99
+ await Select . vm . $nextTick ( )
100
+
101
+ expect (
102
+ Select . findAll ( '.vs__dropdown-option' ) . wrappers . map (
103
+ ( option ) => option . attributes ( ) [ 'aria-selected' ]
104
+ )
105
+ ) . toStrictEqual ( [ 'true' , 'true' , undefined ] )
106
+ } )
107
+ } )
0 commit comments