Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Enriqe committed May 12, 2020
1 parent b25c6d5 commit c01059a
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions test/unit/test-localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
LocalizedStringId,
createPseudoLocale,
} from '../../src/localized-strings';
import {Services} from '../../src/services';

describes.fakeWin('localization', {amp: true}, (env) => {
let win;
Expand Down Expand Up @@ -177,9 +178,7 @@ describes.fakeWin('viewer localization', {amp: true}, (env) => {
});

it('should take precedence over document language', () => {
const localizationService = Services.localizationForDoc(
win.document.body
);
const localizationService = new LocalizationService(win.document.body);
localizationService.registerLocalizedStringBundle('fr', {
'test_string_id': {
string: 'oui',
Expand All @@ -197,9 +196,7 @@ describes.fakeWin('viewer localization', {amp: true}, (env) => {
});

it('should fall back if string is not found', () => {
const localizationService = Services.localizationForDoc(
win.document.body
);
const localizationService = new LocalizationService(win.document.body);
localizationService.registerLocalizedStringBundle('fr', {
'incorrect_test_string_id': {
string: 'non',
Expand All @@ -217,9 +214,7 @@ describes.fakeWin('viewer localization', {amp: true}, (env) => {
});

it('should fall back if language code is not registered', () => {
const localizationService = Services.localizationForDoc(
win.document.body
);
const localizationService = new LocalizationService(win.document.body);
localizationService.registerLocalizedStringBundle('en', {
'test_string_id': {
string: 'yes',
Expand Down

0 comments on commit c01059a

Please sign in to comment.