From e5f0f52eea38fae15456ef3e72cb135c9e99c9ee Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 11 Jun 2026 14:14:06 +0000 Subject: [PATCH] Add i18n override tests for select components --- .../vscode-multi-select.test.ts | 113 ++++++++++++++++++ .../vscode-single-select.test.ts | 43 +++++++ 2 files changed, 156 insertions(+) diff --git a/src/vscode-multi-select/vscode-multi-select.test.ts b/src/vscode-multi-select/vscode-multi-select.test.ts index fa96eb3bc..96e9a0bbf 100644 --- a/src/vscode-multi-select/vscode-multi-select.test.ts +++ b/src/vscode-multi-select/vscode-multi-select.test.ts @@ -350,6 +350,119 @@ describe('vscode-multi-select', () => { expect(el.value).to.eql(['asdf']); }); + describe('i18n override props', () => { + it('selected-text overrides the badge label', async () => { + const el = await fixture(html` + + One + Two + + `); + expect(el.shadowRoot?.querySelector('.select-face-badge')).lightDom.to.eq( + '1 Ausgewählt' + ); + }); + + it('selected-text overrides the badge label when nothing is selected', async () => { + const el = await fixture(html` + + One + Two + + `); + expect(el.shadowRoot?.querySelector('.select-face-badge')).lightDom.to.eq( + '0 Ausgewählt' + ); + }); + + it('open-button-aria-label overrides the combobox button aria-label', async () => { + const el = await fixture(html` + + One + + `); + const btn = + el.shadowRoot?.querySelector('.combobox-button'); + expect(btn?.getAttribute('aria-label')).to.eq('Öffnen'); + }); + + it('no-options-text is shown when the filter matches nothing', async () => { + const el = await fixture(html` + + Lorem + + `); + el.focus(); + await el.updateComplete; + await sendKeys({type: 'zzz'}); + await el.updateComplete; + const noOpts = el.shadowRoot?.querySelector('.no-options'); + expect(noOpts?.textContent?.trim()).to.eq('Keine Optionen'); + }); + + it('create-option-prefix overrides the creatable suggestion text', async () => { + const el = await fixture(html` + + Lorem + + `); + el.focus(); + await el.updateComplete; + await sendKeys({type: 'Neu'}); + await el.updateComplete; + const placeholder = el.shadowRoot?.querySelector('.option.placeholder'); + expect(placeholder?.textContent?.trim()).to.eq('Hinzufügen "Neu"'); + }); + + it('select-all-title overrides the select-all button tooltip', async () => { + const el = await fixture(html` + + One + Two + + `); + const face = el.shadowRoot?.querySelector('.select-face'); + face!.click(); + await el.updateComplete; + const btn = el.shadowRoot?.querySelector('#select-all'); + expect(btn?.getAttribute('title')).to.eq('Alle auswählen'); + }); + + it('deselect-all-title overrides the deselect-all button tooltip', async () => { + const el = await fixture(html` + + One + Two + + `); + const face = el.shadowRoot?.querySelector('.select-face'); + face!.click(); + await el.updateComplete; + const btn = el.shadowRoot?.querySelector('#select-none'); + expect(btn?.getAttribute('title')).to.eq('Alle abwählen'); + }); + + it('accept-button-text overrides the OK button label', async () => { + const el = await fixture(html` + + One + Two + + `); + const face = el.shadowRoot?.querySelector('.select-face'); + face!.click(); + await el.updateComplete; + const acceptBtn = el.shadowRoot?.querySelector( + 'vscode-button.button-accept' + ); + expect(acceptBtn?.textContent?.trim()).to.eq('Bestätigen'); + }); + }); + it('selects multiple options with keyboard'); it('selectedIndexes sync with values'); it( diff --git a/src/vscode-single-select/vscode-single-select.test.ts b/src/vscode-single-select/vscode-single-select.test.ts index f61c2643f..cd9789b83 100644 --- a/src/vscode-single-select/vscode-single-select.test.ts +++ b/src/vscode-single-select/vscode-single-select.test.ts @@ -1259,6 +1259,49 @@ describe('vscode-single-select', () => { expect(el.value).to.eql('asdf'); }); + describe('i18n override props', () => { + it('no-options-text is shown when the filter matches nothing', async () => { + const el = await fixture(html` + + Lorem + Ipsum + + `); + await clickOnElement(el); + await sendKeys({type: 'zzz'}); + await el.updateComplete; + const noOpts = el.shadowRoot?.querySelector('.no-options'); + expect(noOpts?.textContent?.trim()).to.eq('Keine Optionen'); + }); + + it('create-option-prefix overrides the creatable suggestion text', async () => { + const el = await fixture(html` + + Lorem + Ipsum + Dolor + + `); + el.focus(); + await el.updateComplete; + await sendKeys({type: 'Neu'}); + await el.updateComplete; + const placeholder = el.shadowRoot?.querySelector('.option.placeholder'); + expect(placeholder?.textContent?.trim()).to.eq('Hinzufügen "Neu"'); + }); + + it('open-button-aria-label overrides the combobox button aria-label', async () => { + const el = await fixture(html` + + Lorem + + `); + const btn = + el.shadowRoot?.querySelector('.combobox-button'); + expect(btn?.getAttribute('aria-label')).to.eq('Öffnen'); + }); + }); + //keyboard navigation it('selects previous option with keyboard'); it('selects next option with keyboard');