Skip to content

Studio tests: scan the model selector label wherever its classes live - #8802

Closed
danielhanchen wants to merge 1 commit into
mainfrom
studio-model-selector-class-scan
Closed

danielhanchen wants to merge 1 commit into
mainfrom
studio-model-selector-class-scan

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

tests/studio/test_studio_text_descender_clipping.py::test_model_selector_trigger_label_uses_leading_tight fails on main, so every PR's Repo tests (CPU) job is red:

FAILED tests/studio/test_studio_text_descender_clipping.py::test_model_selector_trigger_label_uses_leading_tight
  - AssertionError: could not find ModelSelectorTrigger model-name span

The label is fine. What moved is where its classes are written.

What happened

The test looked for a literal attribute:

r'<span\s+className="[^"]*\bmin-w-0\b[^"]*\bflex-1\b[^"]*\btruncate\b...'

The trigger label now composes its classes so a caller can extend them:

<span
  className={cn(
    "min-w-0 flex flex-1 items-baseline truncate font-heading text-ui-16 font-medium leading-tight text-black dark:text-white",
    triggerLabelClassName,
  )}
>

className={cn( is not className=", so the pattern matched nothing and the test failed on its own "did I find anything" assertion. leading-tight was there the whole time.

The fix

Match the quoted class list wherever it appears rather than only in an attribute. The five required tokens still have to be present, in order, in one string, and both assertions that follow are unchanged.

Verified

  • Fails before, passes after, on main at 1838e10.
  • Still catches what it exists to catch: swapping that leading-tight for leading-none fails the suite (2 failed), so the guard is not weakened.

@danielhanchen

Copy link
Copy Markdown
Member Author

Closing as a duplicate of #8801, which I opened a couple of minutes earlier for the same failure.

The two fixes agree on the diagnosis. #8801 drops the ordering requirement as well: it matches the class set against each literal rather than keeping a regex that still wants min-w-0 before flex-1 before truncate. Reordering those classes in the markup is the next way this guard goes silent, so the set form is the one to keep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant