Skip to content

test(native): cover custom-property precedence - #443

Closed
YevheniiKotyrlo wants to merge 1 commit into
nativewind:mainfrom
YevheniiKotyrlo:fix/vars-deprecation-scope
Closed

YevheniiKotyrlo wants to merge 1 commit into
nativewind:mainfrom
YevheniiKotyrlo:fix/vars-deprecation-scope

Conversation

@YevheniiKotyrlo

@YevheniiKotyrlo YevheniiKotyrlo commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Nothing on main pins custom-property precedence on both halves of the runtime record. #451 makes an element's own custom property outrank an inherited one, which is what this PR fixed when I opened it, so the code change is gone and the coverage it carried stays:

  • src/__tests__/compiler/inline-variables.test.ts pins that a custom property the sheet declares once is folded into the declaration that reads it. Every precedence test depends on that: a sheet that declares --x once measures nothing at runtime.
  • src/__tests__/native/variables.test.tsx and src/__tests__/native/vars.test.tsx pin the order on both halves of the runtime record: an own rule against an ancestor's rule, against a provider, and across a re-render that changes the provider's value; vars() against the element's own class declaration; two siblings under one provider; a * declaration against an inherited one. And the regression half: an own rule still outranks :root, a declaring element still publishes to its descendants, and an inherited value still applies where the element declares nothing.

Tests

All 28 pass on main. Reading the inherited record before the element's own, the order before #451, turns 6 of them red, and reading it before a * declaration turns 1 red.

Verification

On Windows with Node 26:

  • yarn lint clean
  • yarn typecheck clean
  • yarn test --coverage: every failure also fails on main on this machine (the four babel cases)
  • yarn build clean
  • yarn example expo export --platform web exported

@YevheniiKotyrlo

YevheniiKotyrlo commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor Author

No device frame

This PR adds tests only. main already lets an element's own custom property outrank an inherited one (#451), so a device renders the same with and without it.

@sammoore sammoore left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think we can close this one. #451 and #592 (by way of #413) already added tests that cover these cases. @YevheniiKotyrlo let me know if you disagree!

@danstepanov

Copy link
Copy Markdown
Member

Closing per Sam's note above, since #451 and #592 already cover these cases. Happy to reopen if you think something's still missing. Thanks for this one!

@danstepanov danstepanov closed this Dec 1, 2026
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.

3 participants