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
16 of 26 tasks
zcorpan opened this issue Sep 16, 2020 · 3 comments
Open
16 of 26 tasks

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

zcorpan opened this issue Sep 16, 2020 · 3 comments

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) (#26159)
  • 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
    • 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) (#27125
    • 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> without dir with the same cases as "element with dir=auto"
  • <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.
  • Shadow DOM
  • <slot> (#27954)

Check for existing coverage in wpt: git grep -l ":dir(" (in 16 Sep 2020)

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.

@MyidShin
Copy link
Contributor

@MyidShin MyidShin commented Mar 17, 2021

FYI, recently TCs[1][2] for :dir() which cover the list below have been added.

 element with dir="ltr" matches :dir(ltr)
 element with dir="rtl" matches :dir(rtl)
 child of element with dir="rtl" matches :dir(rtl)
 element with dir=auto ** not for <bdi> ** 
   first character is of bidirectional character type AL or R matches :dir(rtl)
   first character is of bidirectional character type L matches 
   test the first strong bidi character being in a child that is display: none (should still affect directionality)
   text has no strong bidi characters, parent has dir=rtl, 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.

I think it would be nice if the checklist includes something about shadow dom and [3]. :)

[1] 7741972
[2] 60d6e8d
[3] 126ec5c

@zcorpan
Copy link
Member Author

@zcorpan zcorpan commented Mar 30, 2021

Thanks @MyidShin! I've invited you to the web-platform-tests reviewers team, which I think would let you edit my comment. I'll edit my comment for now with your suggestions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants