Skip to content

Commit

Permalink
Patched #1877 and #1882 (#1883)
Browse files Browse the repository at this point in the history
* bugfix: Restricted type for the test helper setLocale()

* bugfix: Applied an extra optional chanining to avoid runtime error

* chore: Added changeset

---------

Co-authored-by: ijlee2 <ijlee2@users.noreply.github.com>
  • Loading branch information
ijlee2 and ijlee2 committed May 14, 2024
1 parent 8fd1d43 commit ca107f3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .changeset/soft-ducks-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"ember-intl": patch
"test-app-for-ember-intl": patch
---

Patched #1877 and #1882
4 changes: 2 additions & 2 deletions packages/ember-intl/addon-test-support/set-locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import type { IntlService } from 'ember-intl';
* Updates the locale as if the user had changed their preferred language.
*
* @function setLocale
* @param {string|string[]} locale
* @param {string} locale
*/
export async function setLocale(locale: string | string[]): Promise<void> {
export async function setLocale(locale: string): Promise<void> {
const context = getContext();

assert(
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-intl/lib/utils/find-engine.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function findEngine(addon) {
do {
const isEngine = addon.pkg?.keywords.includes('ember-engine');
const isEngine = addon.pkg?.keywords?.includes('ember-engine');

if (isEngine) {
return addon;
Expand Down
2 changes: 1 addition & 1 deletion tests/ember-intl/tests/acceptance/smoke-tests-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module('Acceptance | smoke-tests', function (hooks) {
module('de-de', function () {
test('We can see translations', async function (assert) {
await visit('/smoke-tests');
await setLocale(['de-de']);
await setLocale('de-de');

assert
.dom('[data-test-field="Format Number"]')
Expand Down

0 comments on commit ca107f3

Please sign in to comment.