Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing plan for :dir() pseudo-class #25569

Open
zcorpan opened this issue Sep 16, 2020 · 1 comment
Open

Testing plan for :dir() pseudo-class #25569

zcorpan opened this issue Sep 16, 2020 · 1 comment

Comments

@zcorpan
Copy link
Member

@zcorpan zcorpan commented Sep 16, 2020

Relevant spec sections:

https://drafts.csswg.org/selectors-4/#the-dir-pseudo
https://html.spec.whatwg.org/multipage/semantics-other.html#selector-ltr

The interesting cases to test are from the definition of "directionality" in HTML:
https://html.spec.whatwg.org/multipage/dom.html#the-directionality

  • element with dir="ltr" matches :dir(ltr)
  • root element without dir attribute matches :dir(ltr)
  • root element with dir="invalid" matches :dir(ltr)
  • <input type=tel> (#25599)
    • without dir matches :dir(ltr)
    • with dir="invalid" matches :dir(ltr)
    • with dir="rtl" matches :dir(rtl)
  • element with dir="rtl" matches :dir(rtl)
  • child of element with dir="rtl" matches :dir(rtl)
  • <input type=text/search/tel/url/email dir=auto>
  • <textarea dir=auto>
  • element with dir=auto; <bdi> without dir
    • first character is of bidirectional character type AL or R matches :dir(rtl)
    • first character is of bidirectional character type L matches :dir(ltr)
    • test the first strong bidi character being in a child bdi, script, style, textarea, element with dir=ltr/rtl/auto (should be ignored for auto logic)
    • test the first strong bidi character being in a child that is display: none (should still affect directionality)
    • element is the root element and text has no strong bidi characters, matches :dir(ltr)
    • text has no strong bidi characters, parent has dir=rtl, matches :dir(rtl)
  • <bdi dir=ltr> and first character is of bidirectional character type AL or R matches :dir(ltr)
  • <bdi dir=rtl> and first character is of bidirectional character type L matches :dir(rtl)
  • child of element with dir="ltr" matches :dir(ltr)
  • child of element with dir="rtl" matches :dir(rtl)
  • non-HTML element with an (invalid) dir attribute does not affect :dir() matching.

Check for existing coverage in wpt: git grep -l ":dir("

css/css-scoping/shadow-directionality-001.tentative.html
css/css-scoping/shadow-directionality-002.tentative.html
css/selectors/selectors-dir-selector-ltr-001.html
css/selectors/selectors-dir-selector-rtl-001.html
css/vendor-imports/mozilla/mozilla-central-reftests/counter-styles-3/disclosure-styles-ref.html
css/vendor-imports/mozilla/mozilla-central-reftests/selectors4/dir-style-01a.html
css/vendor-imports/mozilla/mozilla-central-reftests/selectors4/dir-style-01b.html
css/vendor-imports/mozilla/mozilla-central-reftests/selectors4/dir-style-02a.html
css/vendor-imports/mozilla/mozilla-central-reftests/selectors4/dir-style-02b.html
css/vendor-imports/mozilla/mozilla-central-reftests/selectors4/dir-style-03a.html
css/vendor-imports/mozilla/mozilla-central-reftests/selectors4/dir-style-03b.html
css/vendor-imports/mozilla/mozilla-central-reftests/selectors4/dir-style-04.html
html/semantics/selectors/pseudo-classes/dir.html
html/semantics/selectors/pseudo-classes/dir01.html
shadow-dom/directionality-002.tentative.html

(Maybe also check for dir="auto" tests)

@zcorpan
Copy link
Member Author

@zcorpan zcorpan commented Sep 16, 2020

The html/semantics/selectors/pseudo-classes/dir.html test seems suitable to extend with additional cases.

zcorpan added a commit that referenced this issue Sep 17, 2020
Part of testing plan #25569
zcorpan added a commit that referenced this issue Sep 22, 2020
Part of testing plan #25569
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.