mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-29 05:38:24 +00:00
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.
This commit is contained in:
parent
26d71207d4
commit
5f144f366d
Notes:
github-actions[bot]
2025-05-16 22:32:06 +00:00
Author: https://github.com/AtkinsSJ
Commit: 5f144f366d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4780
2 changed files with 38 additions and 0 deletions
16
Tests/LibWeb/Text/expected/css/parse-dir-selector.txt
Normal file
16
Tests/LibWeb/Text/expected/css/parse-dir-selector.txt
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
Harness status: OK
|
||||||
|
|
||||||
|
Found 10 tests
|
||||||
|
|
||||||
|
3 Pass
|
||||||
|
7 Fail
|
||||||
|
Fail ":dir(rtl)" should be a valid selector
|
||||||
|
Fail ":dir( rtl )" should be a valid selector
|
||||||
|
Fail ":dir(ltr):dir(rtl)" should be a valid selector
|
||||||
|
Fail "foo:dir(RTL)" should be a valid selector
|
||||||
|
Fail ":dir(auto)" should be a valid selector
|
||||||
|
Fail ":dir(none)" should be a valid selector
|
||||||
|
Fail ":dir(something-made-up)" should be a valid selector
|
||||||
|
Pass ":dir()" should be an invalid selector
|
||||||
|
Pass ":dir(\"ltr\")" should be an invalid selector
|
||||||
|
Pass ":dir(ltr, rtl)" should be an invalid selector
|
22
Tests/LibWeb/Text/input/css/parse-dir-selector.html
Normal file
22
Tests/LibWeb/Text/input/css/parse-dir-selector.html
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<!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>
|
Loading…
Add table
Add a link
Reference in a new issue