chore(language-chooser): cover defaultDisplayName and the bare chooser arrangement - #155
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
(Claude Opus 5 (1M context)) Consulted Devin on 2026-08-26 15:18 UTC up to commit Clean: no bugs, no investigate flags, no informational items. |
fa1c541 to
83c0fe6
Compare
|
(Claude Opus 5 (1M context)) Consulted Devin on 2026-08-26 16:07 UTC up to commit Clean: no bugs, no investigate flags, no informational items. |
83c0fe6 to
9d56ce0
Compare
9d56ce0 to
7f41911
Compare
|
(Claude Opus 5 (1M context)) Consulted Devin on 2026-08-26 up to commit No bugs, no investigate flags. Two informational items, both confirming rather than questioning the change: that the |
…ation contract Two gaps turned up when comparing Bloom's regression test cards against EthnoLib's automated tests. defaultDisplayName is public API of the react-mui package (Bloom calls it directly to name a language) and had no unit test at all. Its whole point is the precedence rule -- a script's languageNameInScript wins over the autonym, which is what makes picking a script change the displayed name -- plus the empty-string cases for the unlisted and manually-entered-tag languages and the stripping of search-result match markers. None of that was pinned down, so any of it could have been changed silently. Separately, nothing asserted on what the chooser tells a host application. Every existing e2e file drives DialogDemo, whose LanguageChooserDialog wrapper supplies its own OK button and stands in for the host. Bloom instead passes its own actionButtons, no rightPanelComponent, and learns about the selection solely through onSelectionChange. That props arrangement was not unprecedented -- ThemeDemo has rendered it for over a year, and PageDemo renders the chooser outside a dialog too -- but neither observes the callback: ThemeDemo passes no onSelectionChange at all and PageDemo keeps only the language tag. So the host half of the contract had demos but no coverage. HostIntegrationDemo shows that callback in a panel beside the chooser, covering everything our main client consumes: Bloom's getLanguageData maps a selection onto a tag, a default name, the name to actually use, the script's reading direction and a country, so all five are shown next to the raw fields they come from. Three details are deliberate: - it shows three names, not one. Showing only customDisplayName is misleading, because the chooser leaves it empty until the user edits the name field, so an ordinary selection looks like it reported nothing. - reading direction is spelled out as true / false / "not stated". A script can decline to say, Bloom keeps that distinction (its IsRtl is a bool?), and conflating "not stated" with false is what BL-13982 was about. - the OK button commits, so clicking it visibly does something. The chooser is boxed at 1000x580 to match the WinForms dialog Bloom hosts it in, which also stops the page growing a scrollbar; the row wraps rather than shrinking that box, so a narrow window stacks instead of scrolling sideways. main.tsx selects the demo with demo=host-integration alongside the query params it already reads for e2e; the default path is untouched. It also gets a Storybook story like the other demos, so it is visible next to them and does not rot unnoticed behind a URL parameter only Playwright uses. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
7f41911 to
f789dde
Compare
|
(Claude Opus 5 (1M context)) Consulted Devin on 2026-08-26 up to commit No bugs, no investigate flags. Two informational items, both confirming rather than questioning the change. Re-run because the previous consultation covered |
Problem
Two gaps turned up while checking Bloom's manual regression cards for the language chooser against what EthnoLib already tests automatically.
defaultDisplayNameis public API of the react-mui package — Bloom calls it directly to decide what to name a chosen language — and it had no unit test at all. Its entire job is a precedence rule (a script's own name for the language beats the language's autonym, which is what makes picking a script change the displayed name), plus returning nothing for the unlisted and manually-entered-tag languages, plus stripping the match markers that search results carry. None of that was pinned down, so any of it could have been changed silently.Separately, nothing asserted on what the chooser tells a host application. Every existing e2e file drives
DialogDemo, whoseLanguageChooserDialogwrapper supplies its own OK button and so stands in for the host. Bloom instead passes its ownactionButtons, norightPanelComponent, and learns about the selection solely throughonSelectionChange. That props arrangement wasn't unprecedented —ThemeDemohas rendered it for over a year, andPageDemorenders the chooser outside a dialog too — but neither observes the callback:ThemeDemopasses noonSelectionChangeat all, andPageDemokeeps only the language tag. So the host half of the contract had demos, but no coverage.What the PR does
defaultDisplayNamesuite (9 tests) tolanguageTagUtils.spec.ts, covering the precedence rule, both empty-string cases, and demarcation stripping — using the realdemarcateResultsrather than hand-faked markers.HostIntegrationDemo, which shows the callback in a panel beside the chooser and covers everything our main client consumes: Bloom'sgetLanguageDatamaps a selection onto a tag, a default name, the name to actually use, the script's reading direction and a country, so all five sit next to the raw fields they come from. Three details are deliberate:customDisplayNameis misleading, because the chooser leaves it empty until the user edits the name field, so an ordinary selection looks like it reported nothing.true/false/ "not stated". A script can decline to say, Bloom keeps that distinction (itsIsRtlis abool?), and conflating "not stated" with false is what BL-13982 was about.hostIntegration.e2e.ts(9 tests) asserting on that readout: usable with no right-panel component; what is reported once a language and script are chosen; that a cleared selection is reported rather than leaving the host holding a stale one; that a selection the user did not rename reports a default name but no custom one; the reading direction's three states; the derived country; and that a host-supplied action button both tracks the reports and commits.main.tsxselects the demo withdemo=host-integration, alongside the query parameters it already reads for e2e. The default path is untouched, so no existing test changes meaning.This change is
Devin review