From b4945779676e24f5b0d26105e1f3707cbaa1e7d9 Mon Sep 17 00:00:00 2001 From: nickschot Date: Sat, 1 Oct 2022 16:49:23 +0200 Subject: [PATCH] Add wrapper div around options & afterOptionsComponent --- addon/components/power-select.hbs | 164 +++++++++--------- .../components/power-select/a11y-test.js | 8 +- .../components/power-select/groups-test.js | 8 +- 3 files changed, 93 insertions(+), 87 deletions(-) diff --git a/addon/components/power-select.hbs b/addon/components/power-select.hbs index 156188a33..c99966c37 100644 --- a/addon/components/power-select.hbs +++ b/addon/components/power-select.hbs @@ -53,12 +53,12 @@ tabindex={{and (not @disabled) (or @tabindex "0")}} ...attributes > - {{#let - (if - @triggerComponent - (component (ensure-safe-component @triggerComponent)) + {{#let + (if + @triggerComponent + (component (ensure-safe-component @triggerComponent)) (component 'power-select/trigger') - ) + ) as |Trigger|}} {{#if (not-eq @beforeOptionsComponent null)}} - {{#let - (if - @beforeOptionsComponent + {{#let + (if + @beforeOptionsComponent (component (ensure-safe-component @beforeOptionsComponent)) (component 'power-select/before-options') - ) + ) as |BeforeOptions|}} {{/let}} {{/if}} - {{#if this.mustShowSearchMessage}} - {{#let - (if - @searchMessageComponent - (component (ensure-safe-component @searchMessageComponent)) - (component 'power-select/search-message') - ) - as |SearchMessage|}} - - {{/let}} - {{else if this.mustShowNoMessages}} - {{#let - (if - @noMatchesMessageComponent - (component (ensure-safe-component @noMatchesMessageComponent)) - (component 'power-select/no-matches-message') - ) - as |NoMatchesMessage|}} - - {{/let}} - {{else}} - {{#let - (if - @optionsComponent - (component (ensure-safe-component @optionsComponent)) - (component 'power-select/options') - ) - (if - @groupComponent - (component (ensure-safe-component @groupComponent)) - (component 'power-select/power-select-group') - ) - as |Options Group|}} - - {{yield option select}} - - {{/let}} - {{/if}} - - {{#if @afterOptionsComponent}} - {{#let (component (ensure-safe-component @afterOptionsComponent)) as |AfterOptions|}} - - {{/let}} - {{/if}} +
+ {{#if this.mustShowSearchMessage}} + {{#let + (if + @searchMessageComponent + (component (ensure-safe-component @searchMessageComponent)) + (component 'power-select/search-message') + ) + as |SearchMessage|}} + + {{/let}} + {{else if this.mustShowNoMessages}} + {{#let + (if + @noMatchesMessageComponent + (component (ensure-safe-component @noMatchesMessageComponent)) + (component 'power-select/no-matches-message') + ) + as |NoMatchesMessage|}} + + {{/let}} + {{else}} + {{#let + (if + @optionsComponent + (component (ensure-safe-component @optionsComponent)) + (component 'power-select/options') + ) + (if + @groupComponent + (component (ensure-safe-component @groupComponent)) + (component 'power-select/power-select-group') + ) + as |Options Group|}} + + {{yield option select}} + + {{/let}} + {{/if}} + + {{#if @afterOptionsComponent}} + {{#let (component (ensure-safe-component @afterOptionsComponent)) as |AfterOptions|}} + + {{/let}} + {{/if}} +
{{/let}} diff --git a/tests/integration/components/power-select/a11y-test.js b/tests/integration/components/power-select/a11y-test.js index b3b58452e..2be33287a 100644 --- a/tests/integration/components/power-select/a11y-test.js +++ b/tests/integration/components/power-select/a11y-test.js @@ -25,7 +25,9 @@ module( await clickTrigger(); assert - .dom('.ember-power-select-dropdown > .ember-power-select-options') + .dom( + '.ember-power-select-dropdown > .ember-power-select-options-wrapper > .ember-power-select-options' + ) .hasAttribute( 'role', 'listbox', @@ -51,7 +53,9 @@ module( await clickTrigger(); assert - .dom('.ember-power-select-dropdown > .ember-power-select-options') + .dom( + '.ember-power-select-dropdown > .ember-power-select-options-wrapper > .ember-power-select-options' + ) .hasAttribute( 'role', 'listbox', diff --git a/tests/integration/components/power-select/groups-test.js b/tests/integration/components/power-select/groups-test.js index 60f731e60..b4bd497d9 100644 --- a/tests/integration/components/power-select/groups-test.js +++ b/tests/integration/components/power-select/groups-test.js @@ -30,19 +30,19 @@ module( await clickTrigger(); let rootLevelGroups = document.querySelectorAll( - '.ember-power-select-dropdown > .ember-power-select-options > .ember-power-select-group' + ' .ember-power-select-dropdown > .ember-power-select-options-wrapper > .ember-power-select-options > .ember-power-select-group' ); let rootLevelOptions = document.querySelectorAll( - '.ember-power-select-dropdown > .ember-power-select-options > .ember-power-select-option' + ' .ember-power-select-dropdown > .ember-power-select-options-wrapper > .ember-power-select-options > .ember-power-select-option' ); assert .dom( - '.ember-power-select-dropdown > .ember-power-select-options > .ember-power-select-group' + ' .ember-power-select-dropdown > .ember-power-select-options-wrapper > .ember-power-select-options > .ember-power-select-group' ) .exists({ count: 3 }, 'There is 3 groups in the root level'); assert .dom( - '.ember-power-select-dropdown > .ember-power-select-options > .ember-power-select-option' + ' .ember-power-select-dropdown > .ember-power-select-options-wrapper > .ember-power-select-options > .ember-power-select-option' ) .exists({ count: 2 }, 'There is 2 options in the root level'); assert