diff --git a/src/components/select/bl-select.test.ts b/src/components/select/bl-select.test.ts index c3e8bfbe0..cfec77e8c 100644 --- a/src/components/select/bl-select.test.ts +++ b/src/components/select/bl-select.test.ts @@ -18,7 +18,12 @@ describe('bl-select', () => { assert.shadowDom.equal( el, ` -
+
extends Form const helpMessage = this.helpText ? html`

${this.helpText}

` : ''; - const label = this.label ? html`` : ''; + const label = this.label ? html`` : ''; return html`
extends Form 'dirty': this.dirty, })} @keydown=${this.handleKeydown} + aria-labelledby="label" + role="list-box" + aria-multiselectable="true" > ${label} ${this.inputTemplate()}
{ assert.instanceOf(el, BlSelectOption); }); + it('renders with default values', async () => { + const el = await fixture(html``); + + expect(el).shadowDom.equal( + `
+
+ + +
+
+ ` + ); + }); + + it('should have aria-selected attribute set to true if the option is selected', async function () { + const el = await fixture( + html`Basketball` + ); + + const option = el.shadowRoot?.querySelector('.option-container'); + + expect(option).has.attribute('aria-selected', 'true'); + }); + describe('keyboard navigation', () => { it('should get focus', async () => { //when diff --git a/src/components/select/option/bl-select-option.ts b/src/components/select/option/bl-select-option.ts index 854f43b82..128a39150 100644 --- a/src/components/select/option/bl-select-option.ts +++ b/src/components/select/option/bl-select-option.ts @@ -102,7 +102,7 @@ export default class BlSelectOption extend } render() { - return html`
+ return html`
${this.multiple ? this.checkboxOptionTemplate() : this.singleOptionTemplate()}
`; }