-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Default locale to 'en-US' on all browsers
- Loading branch information
Showing
20 changed files
with
49 additions
and
58 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
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
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
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
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
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
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,67 +1,25 @@ | ||
import { getResolvedLocale } from '../helpers/get-resolved-locale.js'; | ||
import { APP_INDEX_URL } from './constants.js'; | ||
import { | ||
deepStrictEqual, | ||
ok, | ||
strictEqual, | ||
} from './helpers/typed-assert.js'; | ||
|
||
describe('timezones', () => { | ||
function hasFullICU() { | ||
try { | ||
const january = new Date(9e8); | ||
const spanish = new Intl.DateTimeFormat('es', { month: 'long' }); | ||
return spanish.format(january) === 'enero'; | ||
} catch (err) { | ||
return false; | ||
} | ||
} | ||
|
||
describe('full-icu', () => { | ||
before(async () => { | ||
await browser.url(APP_INDEX_URL); | ||
}); | ||
|
||
function hasFullICU() { | ||
try { | ||
const january = new Date(9e8); | ||
const spanish = new Intl.DateTimeFormat('es', { month: 'long' }); | ||
return spanish.format(january) === 'enero'; | ||
} catch (err) { | ||
return false; | ||
} | ||
} | ||
|
||
it(`supports full ICU`, async () => { | ||
ok(hasFullICU()); | ||
strictEqual( | ||
Intl.DateTimeFormat('en-US', { | ||
year: 'numeric', | ||
month: 'short', | ||
day: 'numeric', | ||
}).format(new Date('2020-02-02')), | ||
'Feb 2, 2020' | ||
); | ||
strictEqual(getResolvedLocale(), 'en-US'); | ||
|
||
const content = await browser.executeAsync(async (done) => { | ||
const a = document.createElement('app-datepicker'); | ||
|
||
document.body.appendChild(a); | ||
|
||
a.locale = 'en-US'; | ||
|
||
while (!await a.updateComplete) { /** no-op */ } | ||
|
||
done( | ||
[ | ||
a.locale, | ||
(a as any)._formatters.fullDateFormat(new Date('2020-03-03')), | ||
JSON.stringify(Intl.DateTimeFormat().resolvedOptions(), null, 2), | ||
] | ||
// a.locale, | ||
// Array.from( | ||
// a.shadowRoot?.querySelectorAll('.full-calendar__day') ?? [] | ||
// )[2]?.outerHTML ?? 'nil' | ||
); | ||
}); | ||
|
||
console.debug('1', content, Intl.DateTimeFormat('en-US', { | ||
timeZone: 'UTC', | ||
year: 'numeric', | ||
month: 'short', | ||
day: 'numeric', | ||
}).format(new Date('2020-03-03'))); | ||
deepStrictEqual(content, []); | ||
}); | ||
|
||
}); |
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