ladybird/Tests/LibWeb/Text/input/css/parse-dir-selector.html
Sam Atkins 5f144f366d Tests: Create a test for :dir() parsing/serialization
Submitted to WPT as https://github.com/web-platform-tests/wpt/pull/52598
but in the meantime here's a local version.

The spec for this isn't super thorough, so the tests are based on how
Chrome and Firefox behave. Specifically, Firefox returns the ltr/rtl
keyword in lowercase but Chrome keeps the original case for it.

We currently fail most of these but that will be fixed in subsequent
commits.
2025-05-17 00:30:44 +02:00

22 lines
911 B
HTML

<!DOCTYPE html>
<meta charset="utf-8">
<script src="../wpt-import/resources/testharness.js"></script>
<script src="../wpt-import/resources/testharnessreport.js"></script>
<script src="../wpt-import/css/support/parsing-testcommon.js"></script>
<script>
test_valid_selector(':dir(rtl)');
test_valid_selector(':dir( rtl )', ':dir(rtl)');
test_valid_selector(':dir(ltr):dir(rtl)');
// Firefox converts this to lowercase but Chrome keeps the original casing. Interop issue?
test_valid_selector('foo:dir(RTL)', ['foo:dir(rtl)', 'foo:dir(RTL)']);
// Values other than ltr and rtl are not invalid, but do not match anything.
test_valid_selector(':dir(auto)');
test_valid_selector(':dir(none)');
test_valid_selector(':dir(something-made-up)');
test_invalid_selector(':dir()');
test_invalid_selector(':dir("ltr")');
test_invalid_selector(':dir(ltr, rtl)');
</script>