Repository navigation
Use explicit optional locale arg in math functions, rework tests accordingly - #2155
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
david-crespo
commented
Apr 17, 2024
| // a separate function because I wanted to test it with a bunch of locales | ||
| // to make sure the toLowerCase thing is ok | ||
| export const toEngNotation = (num: number | bigint, locale = navigator.language) => | ||
| const toEngNotation = (num: number | bigint, locale?: string) => |
Collaborator
Author
There was a problem hiding this comment.
Don't have to test this directly anymore because displayBigNum takes a locale arg too, so we don't have to export it at all.
david-crespo
commented
Apr 17, 2024
| }) | ||
|
|
||
| test.describe('german locale', () => { | ||
| test.use({ locale: 'de-DE' }) |
Collaborator
Author
There was a problem hiding this comment.
love that playwright!
david-crespo
commented
Apr 17, 2024
| [1n, ['1', false]], | ||
| [155n, ['155', false]], | ||
| [999999n, ['999,999', false]], | ||
| [999999n, ['999.999', false]], |
Collaborator
Author
There was a problem hiding this comment.
This was sort of a bug, but I'm pretty sure it was only due to the way we're mocking this for the tests. I think in a browser it would have worked correctly.
david-crespo
enabled auto-merge (squash)
April 17, 2024 03:18
david-crespo
added a commit
to oxidecomputer/omicron
that referenced
this pull request
Apr 18, 2024
oxidecomputer/console@2ba444c...6334f0d * [6334f0db](oxidecomputer/console@6334f0db) bump omicron to latest main (no changes) * [46dbd9c8](oxidecomputer/console@46dbd9c8) oxidecomputer/console#2158 * [e94929ab](oxidecomputer/console@e94929ab) try 300ms minTime on RefreshButton SpinnerLoader * [b6da4154](oxidecomputer/console@b6da4154) oxidecomputer/console#2161 * [788389a8](oxidecomputer/console@788389a8) oxidecomputer/console#2157 * [fed9f4d4](oxidecomputer/console@fed9f4d4) oxidecomputer/console#2159 * [aa75f577](oxidecomputer/console@aa75f577) oxidecomputer/console#2160 * [eeb32a78](oxidecomputer/console@eeb32a78) oxidecomputer/console#2153 * [522d3ab1](oxidecomputer/console@522d3ab1) oxidecomputer/console#2156 * [c726356f](oxidecomputer/console@c726356f) oxidecomputer/console#2155 * [e2b0a7d0](oxidecomputer/console@e2b0a7d0) oxidecomputer/console#2151 * [a5af899a](oxidecomputer/console@a5af899a) oxidecomputer/console#2154 * [73263a4e](oxidecomputer/console@73263a4e) of course I didn't push to main without running the tests, why do you ask * [ea108b7e](oxidecomputer/console@ea108b7e) put firewall rules tab first on vpc detail
david-crespo
added a commit
to oxidecomputer/omicron
that referenced
this pull request
Apr 18, 2024
oxidecomputer/console@2ba444c...6334f0d * [6334f0db](oxidecomputer/console@6334f0db) bump omicron to latest main (no changes) * [46dbd9c8](oxidecomputer/console@46dbd9c8) oxidecomputer/console#2158 * [e94929ab](oxidecomputer/console@e94929ab) try 300ms minTime on RefreshButton SpinnerLoader * [b6da4154](oxidecomputer/console@b6da4154) oxidecomputer/console#2161 * [788389a8](oxidecomputer/console@788389a8) oxidecomputer/console#2157 * [fed9f4d4](oxidecomputer/console@fed9f4d4) oxidecomputer/console#2159 * [aa75f577](oxidecomputer/console@aa75f577) oxidecomputer/console#2160 * [eeb32a78](oxidecomputer/console@eeb32a78) oxidecomputer/console#2153 * [522d3ab1](oxidecomputer/console@522d3ab1) oxidecomputer/console#2156 * [c726356f](oxidecomputer/console@c726356f) oxidecomputer/console#2155 * [e2b0a7d0](oxidecomputer/console@e2b0a7d0) oxidecomputer/console#2151 * [a5af899a](oxidecomputer/console@a5af899a) oxidecomputer/console#2154 * [73263a4e](oxidecomputer/console@73263a4e) of course I didn't push to main without running the tests, why do you ask * [ea108b7e](oxidecomputer/console@ea108b7e) put firewall rules tab first on vpc detail
This branch was successfully deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is basically a refactor. It should not change any functionality, though it does add a test we didn't have before.
While discussing changes to date functions in #2153 (comment), I learned that the more natural way to tell the built-in locale-aware functions you want to use whatever the browser's current locale is while also passing some options is to pass
undefinedas the locale instead ofnavigator.language(which should still work but is a bit weirder-feeling). The nice thing about passing undefined is it goes really well with an optionallocalearg that defaults toundefined, and which we only explicitly use in the tests.