@@ -22,7 +22,7 @@ describe('vscode-multi-select', () => {
2222
2323 const badge = el . shadowRoot ?. querySelector ( '.select-face-badge' ) ;
2424
25- expect ( badge ) . lightDom . to . eq ( '1 selected ' ) ;
25+ expect ( badge ) . lightDom . to . eq ( '1 Selected ' ) ;
2626 expect ( el . selectedIndexes ) . to . eql ( [ 1 ] ) ;
2727 expect ( el . value ) . to . eql ( [ 'Ipsum' ] ) ;
2828 } ) ;
@@ -120,39 +120,6 @@ describe('vscode-multi-select', () => {
120120 } ) ;
121121 } ) ;
122122
123- it ( 'dropdown should be hidden after the OK button is clicked' , async ( ) => {
124- const el = ( await fixture ( html `
125- < vscode-multi-select >
126- < vscode-option value ="1 "> One</ vscode-option >
127- < vscode-option value ="2 "> Two</ vscode-option >
128- < vscode-option value ="3 "> Three</ vscode-option >
129- </ vscode-multi-select >
130- ` ) ) as VscodeMultiSelect ;
131-
132- const selectFace =
133- el . shadowRoot ?. querySelector < HTMLDivElement > ( '.select-face' ) ;
134- selectFace ! . click ( ) ;
135- await el . updateComplete ;
136- const dropdownVisibleBefore = el . shadowRoot
137- ?. querySelector ( '.dropdown' )
138- ?. classList . contains ( 'open' ) ;
139-
140- const button =
141- el . shadowRoot ?. querySelector < HTMLButtonElement > ( '.button-accept' ) ;
142- button ! . click ( ) ;
143- await el . updateComplete ;
144-
145- button ?. click ( ) ;
146- await el . updateComplete ;
147-
148- const dropdownVisibleAfter = el . shadowRoot
149- ?. querySelector ( '.dropdown' )
150- ?. classList . contains ( 'open' ) ;
151-
152- expect ( dropdownVisibleBefore ) . to . eq ( true ) ;
153- expect ( dropdownVisibleAfter ) . to . eq ( false ) ;
154- } ) ;
155-
156123 it ( 'should apply combobox mode' , async ( ) => {
157124 const el = await fixture (
158125 html `< vscode-multi-select combobox >
@@ -167,7 +134,7 @@ describe('vscode-multi-select', () => {
167134 expect ( comboboxFace ) . to . be . ok ;
168135 } ) ;
169136
170- it ( 'should "select all" and "deselect all" work properly ' , async ( ) => {
137+ it ( 'selects all options ' , async ( ) => {
171138 const el = await fixture < VscodeMultiSelect > (
172139 html `< vscode-multi-select >
173140 < vscode-option value ="1 "> One</ vscode-option >
@@ -176,32 +143,33 @@ describe('vscode-multi-select', () => {
176143 </ vscode-multi-select > `
177144 ) ;
178145
179- el . shadowRoot ?. querySelector < HTMLDivElement > ( '.select-face' ) ! . click ( ) ;
146+ el . selectAll ( ) ;
180147 await el . updateComplete ;
181148
182- const btSelectAll =
183- el . shadowRoot ?. querySelector < HTMLButtonElement > ( '#select-all' ) ;
184- const btSelectNone =
185- el . shadowRoot ?. querySelector < HTMLButtonElement > ( '#select-none' ) ;
186- btSelectAll ! . click ( ) ;
187- await el . updateComplete ;
149+ expect ( el . shadowRoot ?. querySelector ( '.select-face-badge' ) ) . lightDom . to . eq (
150+ '3 Selected'
151+ ) ;
152+ } ) ;
188153
189- let caption =
190- el . shadowRoot ?. querySelector < HTMLDivElement > (
191- '.select-face-badge'
192- ) ! . innerText ;
154+ it ( 'de-selects all options' , async ( ) => {
155+ const el = await fixture < VscodeMultiSelect > (
156+ html `< vscode-multi-select >
157+ < vscode-option value ="1 " selected > One</ vscode-option >
158+ < vscode-option value ="2 " selected > Two</ vscode-option >
159+ < vscode-option value ="3 " selected > Three</ vscode-option >
160+ </ vscode-multi-select > `
161+ ) ;
193162
194- expect ( caption ) . to . eq ( '3 ITEMS SELECTED' ) ;
163+ expect ( el . shadowRoot ?. querySelector ( '.select-face-badge' ) ) . lightDom . to . eq (
164+ '3 Selected'
165+ ) ;
195166
196- btSelectNone ! . click ( ) ;
167+ el . selectNone ( ) ;
197168 await el . updateComplete ;
198169
199- caption =
200- el . shadowRoot ?. querySelector < HTMLDivElement > (
201- '.select-face-badge'
202- ) ! . innerText ;
203-
204- expect ( caption ) . to . eq ( 'NO ITEMS SELECTED' ) ;
170+ expect ( el . shadowRoot ?. querySelector ( '.select-face-badge' ) ) . lightDom . to . eq (
171+ '0 Selected'
172+ ) ;
205173 } ) ;
206174
207175 it ( 'should be unfocusable when it is disabled' , ( ) => {
@@ -386,5 +354,7 @@ describe('vscode-multi-select', () => {
386354 it ( 'selects multiple options with keyboard' ) ;
387355 it ( 'selectedIndexes sync with values' ) ;
388356 it ( 'creates and select suggested option (enter key press)' ) ;
389- it ( 'dispatch change event, set form value, manage required state (enter key press)' ) ;
357+ it (
358+ 'dispatch change event, set form value, manage required state (enter key press)'
359+ ) ;
390360} ) ;
0 commit comments