From 81f5ad145b78304c759fa8adeb1d2be5b30dd2ad Mon Sep 17 00:00:00 2001 From: simonihmig Date: Wed, 19 May 2021 17:25:03 +0200 Subject: [PATCH] Make en the default locale in testing Fixes #113 --- .../files/__root__/pods/application/route.ts | 9 +++++++-- .../files/tests/acceptance/errors.feature | 6 +++--- blueprints/@kaliber5/k5-ember-boilerplate/index.js | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/blueprints/@kaliber5/k5-ember-boilerplate/files/__root__/pods/application/route.ts b/blueprints/@kaliber5/k5-ember-boilerplate/files/__root__/pods/application/route.ts index d6ff29c..9c933bb 100644 --- a/blueprints/@kaliber5/k5-ember-boilerplate/files/__root__/pods/application/route.ts +++ b/blueprints/@kaliber5/k5-ember-boilerplate/files/__root__/pods/application/route.ts @@ -1,12 +1,17 @@ import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; import Intl from 'ember-intl/services/intl'; +import { isTesting, macroCondition } from '@embroider/macros'; export default class ApplicationRoute extends Route { @service intl!: Intl; - beforeModel(): void | Promise { - this.intl.setLocale('de-de'); + queryParams = { + locale: { refreshModel: true }, + }; + + model({ locale = macroCondition(isTesting()) ? 'en-us' : 'de-de' }: { locale: string }): void { + this.intl.setLocale(locale); } afterModel(): void { diff --git a/blueprints/@kaliber5/k5-ember-boilerplate/files/tests/acceptance/errors.feature b/blueprints/@kaliber5/k5-ember-boilerplate/files/tests/acceptance/errors.feature index be1c34e..73aaf96 100644 --- a/blueprints/@kaliber5/k5-ember-boilerplate/files/tests/acceptance/errors.feature +++ b/blueprints/@kaliber5/k5-ember-boilerplate/files/tests/acceptance/errors.feature @@ -6,9 +6,9 @@ Scenario: Page not found when visiting [URL] When I visit URL "[URL]" Then there should be an Error-Message - And the Title in the Error-Message should have text "Etwas ist schiefgelaufen!" - And the Description in the Error-Message should have text "Seite wurde nicht gefunden." - And the Link in the Error-Message should have text "zurück zur Startseite" + And the Title in the Error-Message should have text "Something went wrong!" + And the Description in the Error-Message should have text "Page not found." + And the Link in the Error-Message should have text "Back to homepage" And the Link in the Error-Message should have HTML attr "href" with value "/" Where: diff --git a/blueprints/@kaliber5/k5-ember-boilerplate/index.js b/blueprints/@kaliber5/k5-ember-boilerplate/index.js index c8b236d..a01b928 100644 --- a/blueprints/@kaliber5/k5-ember-boilerplate/index.js +++ b/blueprints/@kaliber5/k5-ember-boilerplate/index.js @@ -22,6 +22,7 @@ module.exports = { async afterInstall(/* options */) { await this.addAddonsToProject({ packages: [ + { name: '@embroider/macros' }, { name: 'ember-bootstrap' }, { name: 'ember-cli-dotenv' }, { name: 'ember-cli-favicon' },