Repository navigation
Studio tests: match the model-name span in its cn() form - #8801
Closed
danielhanchen wants to merge 2 commits into
Closed
danielhanchen wants to merge 2 commits into
danielhanchen wants to merge 2 commits into
Conversation
The descender guard looked for a literal className="..." attribute. The
ModelSelectorTrigger label moved to className={cn("...", triggerLabelClassName)},
so the regex found nothing and the test failed on main with "could not find
ModelSelectorTrigger model-name span".
Match the class set against every string literal in the file instead. That is
order-insensitive and survives the next wrapper, and it keeps the real assertion:
leading-tight present, leading-none never beside truncate. Reverting leading-tight
to leading-none in model-selector.tsx fails this test and the third one.
Member
Author
|
Superseded by #8765, which landed the same fix ahead of this one: the guard now selects class literals by their token set wherever they are written, so the cn() form is matched and the test passes on main again. Closing to keep one guard rather than three, and this branch now conflicts with that file anyway. The set-based selection in here was the right shape and is what #8765 uses. |
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.
Repo tests (CPU)is red on main for every PR:The product is fine. The guard looked for a literal attribute:
r'<span\s+className="[^"]*\bmin-w-0\b[^"]*\bflex-1\b[^"]*\btruncate\b...'and
model-selector.tsx:275now writes the label asso the regex matched nothing.
leading-tightis present and correct; only the test broke.The change
Match the identifying class set against every string literal in the file instead of against an attribute. Order-insensitive, and it survives the next wrapper. Exactly one literal matches today, the right one.
Why this is not a weaker test
The assertion it guards is unchanged:
leading-tightpresent,leading-nonenever besidetruncate. Mutatingleading-tighttoleading-noneinmodel-selector.tsxfails both this test andtest_no_truncate_plus_leading_none_in_changed_files. Theassert matchesline is what makes this safe: once the markup moved, the old form matched nothing and that assert turned it into the hard failure on main rather than a silent pass.