Skip to content

test: cover rtl:/ltr: variants in both directions - #472

Open
Abdalkaderdev wants to merge 1 commit into
nativewind:mainfrom
Abdalkaderdev:test-rtl-ltr-variants
Open

Abdalkaderdev wants to merge 1 commit into
nativewind:mainfrom
Abdalkaderdev:test-rtl-ltr-variants

Conversation

@Abdalkaderdev

Copy link
Copy Markdown

Refs #453.

I went to fix #453 and could not reproduce it on main — rtl:text-white applies only when I18nManager.isRTL is true, and ltr: only when it is false. Something between the report in July and now already handles the :lang() form lightningcss downcompiles :dir() into.

What was missing is coverage to keep it that way. The existing ltr: test renders with the default direction and never touches I18nManager.isRTL, so it would still pass if the condition were dropped entirely and the style applied unconditionally — which is exactly the failure mode in #453. There was no rtl: test at all.

These set isRTL both ways and assert the negative case, restoring the original descriptor afterwards so the mock cannot leak into other tests in the file.

Tests only, no production change. The 4 failures in src/__tests__/babel are present on a clean checkout of main and unrelated.

nativewind#453 reports that the rtl: and ltr: variants are dropped, because
lightningcss downcompiles :dir() to :lang() and the selector builder
had no lang handler. It does not reproduce on main any more.

There was no coverage to keep it that way: the existing ltr: test only
asserts the default direction and never sets I18nManager.isRTL, so it
passes whether or not the condition is honoured. These set isRTL both
ways and assert the negative case too.

This branch has not been deployed

No deployments
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.

rtl:/ltr: variants silently dropped — lightningcss downcompiles :dir() to :lang() which is unhandled

1 participant