Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
amk221 committed Dec 12, 2024
1 parent 37acba3 commit f3e0dcf
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions addon/components/dropdown/index.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ export default class Dropdown extends Component {
Trigger=(component
DropdownTrigger
aria-expanded=this.isOpen
aria-haspopup="true"
role="button"
tabindex="0"
onMouseDown=this.handleMouseDownTrigger
onKeyDown=this.handleKeyDownTrigger
onInsert=this.handleInsertTrigger
Expand Down
4 changes: 2 additions & 2 deletions addon/components/dropdown/trigger.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ export default class DropdownTrigger extends Component {
{{! template-lint-disable no-positive-tabindex require-aria-activedescendant-tabindex no-pointer-down-event-binding }}
<div
class={{concat "dropdown__trigger" (if @class (concat " " @class))}}
aria-haspopup="true"
aria-haspopup="{{@aria-haspopup}}"
aria-activedescendant="{{@aria-activedescendant}}"
aria-busy="{{@aria-busy}}"
aria-controls="{{@aria-controls}}"
aria-disabled="{{@aria-disabled}}"
aria-expanded="{{@aria-expanded}}"
role="{{@role}}"
tabindex={{if @tabindex @tabindex "0"}}
tabindex="{{@tabindex}}"
{{on "mousedown" @onMouseDown}}
{{on "keydown" @onKeyDown}}
{{lifecycle onInsert=this.handleInsert onDestroy=@onDestroy}}
Expand Down
1 change: 1 addition & 0 deletions addon/components/select-box/index.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ export default class SelectBox extends Component {
aria-disabled=this.isDisabled
aria-activedescendant=this.triggerActiveDescendant
aria-controls=this.optionsElement.id
aria-haspopup=null
tabindex=this.triggerTabIndex
onInsertClosure=this.handleInsertTrigger
onDestroy=this.handleDestroyTrigger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module('dropdown/trigger', function (hooks) {
</Dropdown>
</template>);

assert.dom('.dropdown__trigger').doesNotHaveAttribute('role');
assert.dom('.dropdown__trigger').hasAttribute('role', 'button');
});

test('role (closure component)', async function (assert) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ module('select-box/trigger', function (hooks) {
.hasClass('foo', 'splattributes')
.hasAttribute('tabindex', '0', 'focusable for safari fix')
.hasAttribute('role', 'combobox', 'combined button and listbox')
.hasAttribute('aria-haspopup', 'true', 'pops up')
.hasAttribute('aria-expanded', 'false', 'closed initially')
.doesNotHaveAttribute('aria-haspopup', 'implied by spec')
.doesNotHaveAttribute('aria-controls', 'no listbox')
.doesNotHaveAttribute('aria-busy', 'not searching')
.doesNotHaveAttribute('aria-disabled', 'is enabled')
Expand Down

0 comments on commit f3e0dcf

Please sign in to comment.