Skip to content

Commit

Permalink
focus the toggle button on locale-change without the need to track th…
Browse files Browse the repository at this point in the history
…at element.

we have full control over this component's markup, so let's traverse it
to markup from the click target to the toggle button,
instead of tracking the toggle button separately.
one less modifier.
  • Loading branch information
stopfstedt committed Jul 5, 2024
1 parent 7184c5e commit dc3348e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/frontend/.lint-todo
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,4 @@ add|ember-template-lint|no-at-ember-render-modifiers|10|6|10|6|d919d2af254f782c0
add|ember-template-lint|no-at-ember-render-modifiers|11|6|11|6|940005188b476a060b0e5d3f05baea24ba178878|1719360000000|1734915600000|1750464000000|app/components/reports/subject/new/session-type.hbs
add|ember-template-lint|no-at-ember-render-modifiers|10|6|10|6|d919d2af254f782c01fe2ba15416673e52e91124|1719360000000|1734915600000|1750464000000|app/components/reports/subject/new/term.hbs
add|ember-template-lint|no-at-ember-render-modifiers|11|6|11|6|940005188b476a060b0e5d3f05baea24ba178878|1719360000000|1734915600000|1750464000000|app/components/reports/subject/new/term.hbs
remove|ember-template-lint|no-at-ember-render-modifiers|16|4|16|4|46d995f60904f6b6f4b1b6b24bb65b9c97441bc1|1719360000000|1734915600000|1750464000000|app/components/locale-chooser.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ module('Integration | Component | locale-chooser', function (hooks) {
await render(hbs`<LocaleChooser />`);

await component.toggle.click();
assert.notOk(component.toggle.hasFocus);
await component.locales[1].click();
assert.strictEqual(component.locales.length, 0);
assert.strictEqual(component.text, 'Español (es)');
assert.ok(component.toggle.hasFocus);
});
});
3 changes: 2 additions & 1 deletion packages/frontend/tests/pages/components/locale-chooser.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { create, collection, triggerable } from 'ember-cli-page-object';

import { hasFocus } from 'ilios-common';
export default create({
scope: '[data-test-locale-chooser]',
toggle: {
scope: '[data-test-toggle]',
enter: triggerable('keyup', '', { eventProperties: { key: 'Enter' } }),
down: triggerable('keyup', '', { eventProperties: { key: 'ArrowDown' } }),
esc: triggerable('keyup', '', { eventProperties: { key: 'Escape' } }),
hasFocus: hasFocus(),
},
locales: collection('[data-test-item]', {}),
});

0 comments on commit dc3348e

Please sign in to comment.