Skip to content

Commit

Permalink
Import wpt@3bd0214afc4f254b13c65117074806bfeee0189f
Browse files Browse the repository at this point in the history
Using wpt-import in Chromium 7b54118.
With Chromium commits locally applied on WPT:
557e4fb "[EventTiming] Add WPT for key press"


Note to sheriffs: This CL imports external tests and adds
expectations for those tests; if this CL is large and causes
a few new failures, please fix the failures by adding new
lines to TestExpectations rather than reverting. See:
https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md

Directory owners for changes in this CL:
rego@igalia.com:
  external/wpt/css/selectors

NOAUTOREVERT=true
R=rubber-stamper@appspot.gserviceaccount.com

No-Export: true
Cq-Include-Trybots: luci.chromium.try:linux-wpt-identity-fyi-rel,linux-wpt-input-fyi-rel,linux-blink-rel
Change-Id: Ib4399da0d07eb4b4f7a820ea98ea18f6a7c06e31
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3640490
Auto-Submit: WPT Autoroller <wpt-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1002575}
  • Loading branch information
Chromium WPT Sync authored and Chromium LUCI CQ committed May 12, 2022
1 parent 4913483 commit 8a59217
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 61 deletions.
2 changes: 1 addition & 1 deletion third_party/blink/web_tests/external/Version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Version: 464a7f038e55b17daab1e43beebdab13aa960dd3
Version: 3bd0214afc4f254b13c65117074806bfeee0189f
28 changes: 27 additions & 1 deletion third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json
Original file line number Diff line number Diff line change
Expand Up @@ -316292,6 +316292,10 @@
"701ad56cb4d0cbefe648d9664c2f1c4847925112",
[]
],
"example.pdf": [
"7bad251ba7e08efc9c383d88518367a6f204cdd6",
[]
],
"fetch-and-record-js.h2.py": [
"169f70c0450c79c01dc5c375e9fb35d5b81e5a73",
[]
Expand Down Expand Up @@ -316320,6 +316324,10 @@
"3be2852348ba800662fa2caf626654b2f40b5902",
[]
],
"pdf-with-early-hints.h2.py": [
"0d05f2a3c57266ce183457b83dad020a4ce580fd",
[]
],
"png-with-early-hints.h2.py": [
"0785d512c1b024acf7e349735764ac341e219d4b",
[]
Expand Down Expand Up @@ -396483,7 +396491,7 @@
]
},
"scope-selector.html": [
"0340f25919f34aaad07d53d1550d5155f73fb26b",
"06b6bc13785dff351b2e518e22aa0889cc77d875",
[
null,
{}
Expand Down Expand Up @@ -481720,6 +481728,24 @@
}
]
],
"iframe-pdf.h2.window.js": [
"11c1443c34de3e750a17b60aa2f99fe815380aca",
[
"loading/early-hints/iframe-pdf.h2.window.html",
{
"script_metadata": [
[
"script",
"/common/utils.js"
],
[
"script",
"resources/early-hints-helpers.sub.js"
]
]
}
]
],
"invalid-headers-in-early-hints.h2.window.js": [
"6c5161dc8bf72d193c843860f24024f753075314",
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,71 +6,20 @@
<div id='shadowHost'></div>
<script>
'use strict'
const shadowHost = document.getElementById("shadowHost");
const shadowRoot = shadowHost.attachShadow({mode:'open'})
const externalDiv = document.createElement('div');
externalDiv.setAttribute('id', 'external');
const nestedDiv = document.createElement('div');
nestedDiv.setAttribute('id', 'nested');
shadowRoot.appendChild(externalDiv);
externalDiv.appendChild(nestedDiv);

const nestedShadowRoot = nestedDiv.attachShadow({mode:'open'})
const shadowExternalDiv = document.createElement('div');
shadowExternalDiv.setAttribute('id', 'shadow_external');
const shadowNestedDiv = document.createElement('div');
shadowNestedDiv.setAttribute('id', 'shadow_nested');
nestedShadowRoot.appendChild(shadowExternalDiv);
shadowExternalDiv.appendChild(shadowNestedDiv);

test (() => {
assert_equals(shadowRoot.firstChild.querySelectorAll(':scope > div').length, 1, 'should get the number of direct children of externalDiv');
assert_equals(shadowRoot.firstChild.querySelector(':scope > div'), shadowRoot.getElementById('nested'), 'should get the first direct child of externalDiv');
assert_equals(shadowRoot.firstChild.querySelector(':scope > div'), shadowRoot.getElementById('nested'), 'should get nestedDiv');
}, 'scope selector works in shadowRoot.firstChild')

test (() => {
assert_equals(shadowRoot.querySelector(':scope > div'), shadowRoot.getElementById('external'), 'should get the direct child of shadowRoot');
assert_equals(shadowRoot.querySelectorAll(':scope > div').length, 1, 'should get the number of direct div children of shadowRoot');
}, 'Selecting direct child of shadow root with :scope should work')

test (() => {
assert_equals(shadowRoot.querySelector(':scope div'), shadowRoot.getElementById('external'), 'should get the first div descendant of shadowRoot');
assert_equals(shadowRoot.querySelectorAll(':scope div').length, 2, 'should get the number of the div descendants of shadowRoot, :scope div should not match for nestedShadow');
}, 'Selecting descendants of shadow root with :scope should work')
shadowRoot.appendChild(document.createElement("div"));

test (() => {
assert_equals(nestedShadowRoot.querySelector(':scope > div'), nestedShadowRoot.getElementById('shadow_external'), 'should get the direct child of nestedShadowRoot');
assert_equals(nestedShadowRoot.querySelectorAll(':scope > div').length, 1, 'should get the number of direct div children of nestedShadowRoot');
}, 'Selecting direct child of nested shadow root with :scope should work')

test (() => {
assert_equals(nestedShadowRoot.querySelector(':scope div'), nestedShadowRoot.getElementById('shadow_external'), 'should get the first div descendant of nestedShadowRoot');
assert_equals(nestedShadowRoot.querySelectorAll(':scope div').length, 2, 'should get the number of the div descendants of nestedShadowRoot');
}, 'Selecting descendants of nested shadow root with :scope should work')
assert_equals(shadowRoot.querySelectorAll(':scope > div').length, 0, 'should not match in shadow root');
});

const documentFragment = document.createDocumentFragment();
const external_div = document.createElement('div');
external_div.setAttribute('id', 'external_div');
const nested_div = document.createElement('div');
nested_div.setAttribute('id', 'nested_div');
documentFragment.appendChild(external_div);
external_div.appendChild(nested_div);

test(() => {
assert_equals(documentFragment.firstChild.querySelectorAll(':scope > div').length, 1, 'should get the number of direct children of external_div');
assert_equals(documentFragment.firstChild.querySelector(':scope > div'), documentFragment.getElementById('nested_div'), 'should get the first direct child of external_div');
assert_equals(documentFragment.firstChild.querySelector(':scope > div'), documentFragment.getElementById('nested_div'), 'should get the text in nesteddiv');
}, 'scope selector works in documentFragment.firstChild')

test(() => {
assert_equals(documentFragment.querySelector(':scope > div'), documentFragment.getElementById('external_div'), 'should get the direct child of DocumentFragment');
assert_equals(documentFragment.querySelectorAll(':scope > div').length, 1, 'should get the number of direct div children of DocumentFragment');
}, 'Selecting direct child of document fragment with :scope should work')
documentFragment.appendChild(document.createElement("div"));

test(() => {
assert_equals(documentFragment.querySelector(':scope div'), documentFragment.getElementById('external_div'), 'should get the first div descendant of DocumentFragment');
assert_equals(documentFragment.querySelectorAll(':scope div').length, 2, 'should get the number of the div descendants of DocumentFragment');
}, 'Selecting descendants of document fragment with :scope should work')
assert_equals(documentFragment.querySelectorAll(':scope > div').length, 0, 'should not match in document fragment');
});

test(() => {
assert_equals(shadowRoot.firstChild.querySelector(':scope'), null, 'should return null');
Expand All @@ -82,5 +31,7 @@
assert_equals(documentFragment.querySelector(':scope'), null, 'should return null');
assert_equals(documentFragment.querySelectorAll(':scope').length, 0, 'should return 0');

}, 'querySelector() with ":scope" should return null, whether the context object is an element, a shadow root or a document fragment')
assert_equals(document.querySelector(':scope'), document.documentElement, 'should return the document element');
assert_equals(document.querySelectorAll(':scope').length, 1, 'should return 1');
}, 'querySelector() with ":scope" should return the document element, if present in the subtree');
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
This is a testharness.js-based test.
FAIL scope-selector assert_equals: should not match in shadow root expected 0 but got 1
FAIL scope-selector 1 assert_equals: should not match in document fragment expected 0 but got 1
PASS querySelector() with ":scope" should return the document element, if present in the subtree
Harness: the test ran to completion.

0 comments on commit 8a59217

Please sign in to comment.