From e75c397f9d9673a04813c304e4d3282e8dcb3c44 Mon Sep 17 00:00:00 2001 From: Stefan Topfstedt Date: Tue, 2 Jul 2024 13:52:17 -0700 Subject: [PATCH] focus the toggle button on locale-change without the need to track that 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. --- packages/frontend/.lint-todo | 1 + .../tests/integration/components/locale-chooser-test.js | 2 ++ packages/frontend/tests/pages/components/locale-chooser.js | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/frontend/.lint-todo b/packages/frontend/.lint-todo index c439e2bc8b..d0d6293820 100644 --- a/packages/frontend/.lint-todo +++ b/packages/frontend/.lint-todo @@ -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 diff --git a/packages/frontend/tests/integration/components/locale-chooser-test.js b/packages/frontend/tests/integration/components/locale-chooser-test.js index f29f7993dc..18fedb3393 100644 --- a/packages/frontend/tests/integration/components/locale-chooser-test.js +++ b/packages/frontend/tests/integration/components/locale-chooser-test.js @@ -57,8 +57,10 @@ module('Integration | Component | locale-chooser', function (hooks) { await render(hbs``); 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); }); }); diff --git a/packages/frontend/tests/pages/components/locale-chooser.js b/packages/frontend/tests/pages/components/locale-chooser.js index 635d473936..dccb443fc1 100644 --- a/packages/frontend/tests/pages/components/locale-chooser.js +++ b/packages/frontend/tests/pages/components/locale-chooser.js @@ -1,5 +1,5 @@ import { create, collection, triggerable } from 'ember-cli-page-object'; - +import { hasFocus } from 'ilios-common'; export default create({ scope: '[data-test-locale-chooser]', toggle: { @@ -7,6 +7,7 @@ export default create({ 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]', {}), });