Fix timestamps/spellcheck to use locale override
This commit is contained in:
parent
59fa75c309
commit
fd8691b871
11 changed files with 45 additions and 11 deletions
|
@ -12,6 +12,7 @@ const max = new Date(2023, 0, 1, 23).getTime();
|
|||
describe('formatTimestamp', () => {
|
||||
let sandbox: sinon.SinonSandbox;
|
||||
let localesStub: sinon.SinonStub;
|
||||
let localeOverrideStub: sinon.SinonStub;
|
||||
let hourCycleStub: sinon.SinonStub;
|
||||
|
||||
beforeEach(() => {
|
||||
|
@ -20,6 +21,10 @@ describe('formatTimestamp', () => {
|
|||
window.SignalContext,
|
||||
'getPreferredSystemLocales'
|
||||
);
|
||||
localeOverrideStub = sandbox.stub(
|
||||
window.SignalContext,
|
||||
'getLocaleOverride'
|
||||
);
|
||||
hourCycleStub = sandbox.stub(
|
||||
window.SignalContext,
|
||||
'getHourCyclePreference'
|
||||
|
@ -41,6 +46,7 @@ describe('formatTimestamp', () => {
|
|||
}).format(time);
|
||||
it(`should format with locale: ${locale} (${HourCyclePreference[preference]}) @ ${timeFmt})`, () => {
|
||||
localesStub.returns([locale]);
|
||||
localeOverrideStub.returns(null);
|
||||
hourCycleStub.returns(preference);
|
||||
assert.equal(formatTimestamp(time, { timeStyle: 'medium' }), expected);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue