ReviewOS

also looking at this

stacks/analyticshq

fix(dashboard): the regions panel says California, not CA

#63
Merged glennmichael123 wants to merge fix/region-panel-shows-names into main
4 files +145 -9
tests/unit/region-geo.test.tsmodified+8-1
Changes to tests/unit/region-geo.test.ts
@@ -180,10 +180,17 @@ describe('the dashboard panel is off until a site turns it on', () => {
180180 })
181181
182182 test('inside one country the flag is dropped, since every row would repeat it', () => {
183 expect(view).toContain('regionCountry ? parts.subdivision : `${flag(parts.country)} ${parts.subdivision}`')
183 expect(view).toContain('regionCountry ? named : `${flag(parts.country)} ${named}`')
184184 expect(view).toContain('`Regions in ${countryName(regionCountry)}`')
185185 })
186186
187 test('a row is labelled by name, falling back to the code', () => {
188 // `PH-07` says nothing to a reader and `CA` beside a flag is equally
189 // Canada, so the panel prints the subdivision's name. A code the table
190 // cannot name keeps showing the code rather than inventing one.
191 expect(view).toContain('subdivisionName(r.region) ?? parts.subdivision')
192 })
193
187194 test('the toggle is :checked + @change, never x-model', () => {
188195 // x-model would own the value, and the value is the server's until a request
189196 // succeeds — an optimistic tick that then failed would leave the box saying