Update web-platform-tests to revision 256b4685b8e702c14ed854347f23f4979edbfc8e

This commit is contained in:
WPT Sync Bot 2019-12-20 08:23:04 +00:00
parent bac9903fbe
commit 45c91aa0cb
134 changed files with 1297 additions and 426 deletions

View file

@ -29,7 +29,21 @@ function checkScroll() {
else if (isInView(document.getElementById('horizontal-scroll')) && window.scrollX > 0)
position = 'horizontal-scroll';
let results = { scrollPosition: position, href: window.location.href };
let target = document.querySelector(":target");
if (!target && position == 'shadow-parent') {
let shadow = document.getElementById("shadow-parent").shadowRoot.firstElementChild;
if (shadow.matches(":target")) {
target = shadow;
position = 'shadow';
}
}
let results = {
scrollPosition: position,
href: window.location.href,
target: target ? target.id : 'undefined'
};
let key = (new URL(document.location)).searchParams.get("key");
stashResults(key, results);
@ -54,10 +68,10 @@ function checkScroll() {
<div id="element" class="scroll-section">Element</div>
<p id="text" class="scroll-section">This is a test page !$'()*+./:;=?@_~ &,- &#x30cd;&#x30b3;</p>
<p id="more-text" class="scroll-section">More test page text</p>
<div id="cross-node-context" class="scroll-section">
<div class="scroll-section">
<div>
<p>prefix</p>
<p>test page</p>
<p id="cross-node-context">test page</p>
</div>
<div><p>suffix</p></div>
</div>
@ -65,7 +79,7 @@ function checkScroll() {
<div id="shadow-parent" class="scroll-section"></div>
<script>
let shadow = document.getElementById("shadow-parent").attachShadow({mode: 'open'});
shadow.innerHTML = '<p>shadow text</p>';
shadow.innerHTML = '<p id="shadow">shadow text</p>';
</script>
<p id="hidden" class="scroll-section">hidden text</p>
<p id="horizontal-scroll" class="scroll-section">horizontally scrolled text</p>

View file

@ -202,7 +202,7 @@ let test_cases = [
// Test text directive within shadow DOM
{
fragment: '#:~:text=shadow%20text',
expect_position: 'shadow-parent',
expect_position: 'shadow',
description: 'Text directive should match text within shadow DOM'
},
// Test text directive within hidden and display none elements. These cases should not scroll into
@ -236,6 +236,8 @@ for (const test_case of test_cases) {
fetchResults(key, resolve, reject);
}).then(data => {
// If the position is not 'top', the :target element should be the positioned element.
assert_true(data.scrollPosition == 'top' || data.target == data.scrollPosition);
assert_equals(data.href.indexOf(':~:'), -1, 'Expected fragment directive to be stripped from the URL.');
assert_equals(data.scrollPosition, test_case.expect_position,
`Expected ${test_case.fragment} (${test_case.description}) to scroll to ${test_case.expect_position}.`);