-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cddd0c9
commit 940aa65
Showing
8 changed files
with
394 additions
and
380 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,46 @@ | ||
import { get } from 'svelte/store' | ||
import { get } from 'svelte/store'; | ||
|
||
import { | ||
init, | ||
getOptions, | ||
defaultOptions, | ||
defaultFormats, | ||
} from '../../src/runtime/configs' | ||
import { $locale } from '../../src/runtime/stores/locale' | ||
} from '../../src/runtime/configs'; | ||
import { $locale } from '../../src/runtime/stores/locale'; | ||
|
||
beforeEach(() => { | ||
init(defaultOptions) | ||
}) | ||
init(defaultOptions); | ||
}); | ||
|
||
test('inits the fallback locale', () => { | ||
expect(getOptions().fallbackLocale).toBe(null) | ||
expect(getOptions().fallbackLocale).toBeNull(); | ||
init({ | ||
fallbackLocale: 'en', | ||
}) | ||
expect(getOptions().fallbackLocale).toBe('en') | ||
}) | ||
}); | ||
expect(getOptions().fallbackLocale).toBe('en'); | ||
}); | ||
|
||
test('inits the initial locale by string', () => { | ||
init({ | ||
fallbackLocale: 'pt', | ||
initialLocale: 'en', | ||
}) | ||
expect(getOptions().initialLocale).toBe('en') | ||
expect(get($locale)).toBe('en') | ||
}) | ||
}); | ||
expect(getOptions().initialLocale).toBe('en'); | ||
expect(get($locale)).toBe('en'); | ||
}); | ||
|
||
test('adds custom formats for time, date and number values', () => { | ||
const customFormats = require('../fixtures/formats.json') | ||
const customFormats = require('../fixtures/formats.json'); | ||
|
||
init({ | ||
fallbackLocale: 'en', | ||
formats: customFormats, | ||
}) | ||
expect(getOptions().formats).toMatchObject(defaultFormats) | ||
expect(getOptions().formats).toMatchObject(customFormats) | ||
}) | ||
}); | ||
expect(getOptions().formats).toMatchObject(defaultFormats); | ||
expect(getOptions().formats).toMatchObject(customFormats); | ||
}); | ||
|
||
test('sets the minimum delay to set the loading store value', () => { | ||
init({ fallbackLocale: 'en', loadingDelay: 300 }) | ||
expect(getOptions().loadingDelay).toBe(300) | ||
}) | ||
init({ fallbackLocale: 'en', loadingDelay: 300 }); | ||
expect(getOptions().loadingDelay).toBe(300); | ||
}); |
Oops, something went wrong.