-
Notifications
You must be signed in to change notification settings - Fork 36
Required 'locale forwarder.js' tests
Dominic Chambers edited this page May 19, 2014
·
1 revision
The following tests are needed, but have not yet been created since they require a browser with the following programmatic access:
- Ability to disable JavaScript.
- Ability to set the the preferred user locales.
- Ability to point to a given URL.
- Ability to query the final URL the browser has ended up at.
Here is what these acceptance tests tests would look like if they could be written:
# the default locale is used if JavaScript is disabled
given: JavaScript is disabled
and: app locales are 'en, de'
and: browser locales are 'de_DE, de'
when: the '/dashboard' is loaded
then: the browser is forwarded to 'dashboard/en'.
# the first matching user locale is used if no cookie is set
given: app locales are 'en, de'
and: browser locales are 'de_DE, de'
when: the '/dashboard' is loaded
then: the browser is forwarded to 'dashboard/de'.
# the full locale is used if there is an available match
given: app locales are 'en, de, de_DE'
and: browser locales are 'de_DE, de'
when: the '/dashboard' is loaded
then: the browser is forwarded to 'dashboard/de_DE'.
# the default locale is used if no cookie is set and there are no other matches
given: app locales are 'en, de'
and: browser locales are 'fr_FR, fr'
when: the '/dashboard' is loaded
then: the browser is forwarded to 'dashboard/en'.
# the cookie value overrides the browser locales
given: app locales are 'en, de'
and: browser locales are 'en_GB, en'
and: cookie locale is 'de'
when: the '/dashboard' is loaded
then: the browser is forwarded to 'dashboard/de'.
# the cookie value is ignored if it is no longer one of the available locales
given: app locales are 'en, de'
and: browser locales are 'de_DE, de'
and: cookie locale is 'en_GB'
when: the '/dashboard' is loaded
then: the browser is forwarded to 'dashboard/de'.