Update web-platform-tests to revision a46616a5b18e83587ddbbed756c7b96cbb4b015d

This commit is contained in:
Josh Matthews 2017-06-19 19:07:14 -04:00 committed by Ms2ger
parent 3f07cfec7c
commit 578498ba24
4001 changed files with 159517 additions and 30260 deletions

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(() => {
var range = document.createRange();
var rangeContainer = document.createElement('div');
range.setStart(rangeContainer, 0);
range.setEnd(rangeContainer, 0);
var shadowRoot = document.createElement('span').attachShadow({mode: "open"});
var h1 = shadowRoot.appendChild(document.createElement('h1'));
range.insertNode(shadowRoot);
assert_equals(rangeContainer.firstChild, h1);
}, 'Test if Range.prototype.insertNode() should accept ShadowRoot input.');
</script>
</body>

View file

@ -241,11 +241,11 @@ testSlotchangeDoesNotFireWhenOtherSlotsChange('closed', true);
testSlotchangeDoesNotFireWhenOtherSlotsChange('open', false);
testSlotchangeDoesNotFireWhenOtherSlotsChange('closed', false);
function testSlotchangeDoesNotFireForMutationBeforeOrAfterSlotWasPresent(mode, connectedToDocument)
function testSlotchangeDoesFireAtInsertedAndDoesNotFireForMutationAfterRemoved(mode, connectedToDocument)
{
var test = async_test('slotchange event must not fire on a slot element inside '
+ treeName(mode, connectedToDocument)
+ ' when the shadow host was mutated before the slot was inserted or after the slot was removed');
var test = async_test('slotchange event must fire on a slot element when a shadow host has a slotable and the slot was inserted'
+ ' and must not fire when the shadow host was mutated after the slot was removed inside '
+ treeName(mode, connectedToDocument));
var host;
var slot;
@ -273,32 +273,32 @@ function testSlotchangeDoesNotFireForMutationBeforeOrAfterSlotWasPresent(mode, c
setTimeout(function () {
test.step(function () {
assert_equals(eventCount, 0,
'slotchange must not be fired on a slot element if the assigned nodes changed before the slot was inserted');
assert_equals(eventCount, 1,
'slotchange must be fired on a slot element if there is assigned nodes when the slot was inserted');
host.removeChild(host.firstChild);
});
setTimeout(function () {
test.step(function () {
assert_equals(eventCount, 1,
'slotchange must be fired exactly once after the assigned nodes change on a slot while the slot element was in the tree');
assert_equals(eventCount, 2,
'slotchange must be fired after the assigned nodes change on a slot while the slot element was in the tree');
slot.parentNode.removeChild(slot);
host.appendChild(document.createElement('span'));
});
setTimeout(function () {
assert_equals(eventCount, 1,
'slotchange must not be fired on a slot element if the assigned nodes changed after the slot was removed');
assert_equals(eventCount, 2,
'slotchange must not be fired on a slot element if the assigned nodes changed after the slot was removed');
test.done();
}, 1);
}, 1);
}, 1);
}
testSlotchangeDoesNotFireForMutationBeforeOrAfterSlotWasPresent('open', true);
testSlotchangeDoesNotFireForMutationBeforeOrAfterSlotWasPresent('closed', true);
testSlotchangeDoesNotFireForMutationBeforeOrAfterSlotWasPresent('open', false);
testSlotchangeDoesNotFireForMutationBeforeOrAfterSlotWasPresent('closed', false);
testSlotchangeDoesFireAtInsertedAndDoesNotFireForMutationAfterRemoved('open', true);
testSlotchangeDoesFireAtInsertedAndDoesNotFireForMutationAfterRemoved('closed', true);
testSlotchangeDoesFireAtInsertedAndDoesNotFireForMutationAfterRemoved('open', false);
testSlotchangeDoesFireAtInsertedAndDoesNotFireForMutationAfterRemoved('closed', false);
function testSlotchangeFiresOnTransientlyPresentSlot(mode, connectedToDocument)
{
@ -505,7 +505,11 @@ function testSlotchangeFiresWhenNestedSlotChange(mode, connectedToDocument)
innerSlot.addEventListener('slotchange', function (event) {
event.stopPropagation();
test.step(function () {
assert_equals(event.target, outerSlot, 'slotchange event\'s target must be the outer slot element');
if (innerSlotEventCount === 0) {
assert_equals(event.target, innerSlot, 'slotchange event\'s target must be the inner slot element at 1st slotchange');
} else if (innerSlotEventCount === 1) {
assert_equals(event.target, outerSlot, 'slotchange event\'s target must be the outer slot element at 2nd sltochange');
}
});
innerSlotEventCount++;
});
@ -521,7 +525,7 @@ function testSlotchangeFiresWhenNestedSlotChange(mode, connectedToDocument)
test.step(function () {
assert_equals(outerSlotEventCount, 1,
'slotchange must be fired on a slot element if the assigned nodes changed');
assert_equals(innerSlotEventCount, 1,
assert_equals(innerSlotEventCount, 2,
'slotchange must be fired on a slot element and must bubble');
});
test.done();

View file

@ -0,0 +1,55 @@
<!DOCTYPE html>
<title>Shadow DOM: Slots and fallback contents in Document tree</title>
<meta name="author" title="Takayoshi Kochi" href="mailto:kochi@google.com">
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<script src="resources/shadow-dom.js"></script>
<div id="test1">
<div id="host">
<template data-mode="open">
<slot id="innerSlot"></slot>
</template>
<slot id="slot"><div id="fallback">This is fallback content</div></slot>
</div>
</div>
<script>
'use strict';
let n1 = createTestTree(test1);
removeWhiteSpaceOnlyTextNodes(n1.test1);
test(() => {
assert_array_equals(n1.innerSlot.assignedNodes(), [n1.slot]);
assert_array_equals(n1.innerSlot.assignedNodes({ flatten: true }), [n1.slot]);
}, 'Children of a slot in a document tree should not be counted in flattened ' +
'assigned nodes.');
</script>
<div id="test2">
<div id="host">
<template data-mode="open">
<div id="innerHost">
<template data-mode="open">
<slot id="innerSlot"></slot>
</template>
<slot id="slot"><div id="fallback">This is fallback content</div></slot>
</div>
</template>
</div>
</div>
<script>
'use strict';
let n2 = createTestTree(test2);
removeWhiteSpaceOnlyTextNodes(n2.test2);
test(() => {
assert_array_equals(n2.innerSlot.assignedNodes(), [n2.slot]);
assert_array_equals(n2.innerSlot.assignedNodes({ flatten: true }),
[n2.fallback]);
}, 'Slot fallback content in shadow tree should be counted in flattened ' +
'assigned nodes.');
</script>

View file

@ -213,7 +213,8 @@ test(() => {
assert_array_equals(n.s1.assignedNodes(), []);
assert_array_equals(n.s1.assignedNodes({ flatten: true }), [n.f1]);
assert_array_equals(n.s1.assignedNodes({ flatten: true }), [],
'fall back contents should be empty because s1 is not in a shadow tree.');
assert_array_equals(n.s2.assignedNodes({ flatten: true }), [n.f2]);
assert_array_equals(n.s3.assignedNodes({ flatten: true }), [n.f2]);
assert_array_equals(n.s4.assignedNodes({ flatten: true }), [n.f2, n.f4]);

View file

@ -83,9 +83,9 @@ test(() => {
assert_array_equals(n.s2.assignedNodes(), []);
assert_array_equals(n.s3.assignedNodes(), []);
assert_array_equals(n.s1.assignedNodes({ flatten: true }), [n.c1]);
assert_array_equals(n.s2.assignedNodes({ flatten: true }), [n.c2, n.c3_1, n.c3_2]);
assert_array_equals(n.s3.assignedNodes({ flatten: true }), [n.c3_1, n.c3_2]);
assert_array_equals(n.s1.assignedNodes({ flatten: true }), []);
assert_array_equals(n.s2.assignedNodes({ flatten: true }), []);
assert_array_equals(n.s3.assignedNodes({ flatten: true }), []);
}, 'Slots: Distributed nooes for Slots not in a shadow tree.');
</script>