Commit 2bb33080 authored by Kyoko Muto's avatar Kyoko Muto Committed by Commit Bot

Add a test for check in manual-slotting mode in shadow DOM

Nodes are assigned to a slot only when nodes are host's children
and the slot is in the shadow tree.

BUG:869308

Change-Id: I10b9b58725d7550a7174a3f4a8e769a9f0c39996
Reviewed-on: https://chromium-review.googlesource.com/1176896
Commit-Queue: Kyoko Muto <kymuto@google.com>
Reviewed-by: default avatarHayato Ito <hayato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584026}
parent 46876cce
...@@ -78,7 +78,18 @@ test(() => { ...@@ -78,7 +78,18 @@ test(() => {
test(() => { test(() => {
slot3.assign([child4]); slot3.assign([child4]);
assert_array_equals(slot3.assignedNodes(), []); assert_array_equals(slot3.assignedNodes(), []);
}, 'Nodes that is not connected to host should not be assigned');
host.appendChild(child4);
assert_array_equals(slot3.assignedNodes(), [child4]);
}, 'Nodes should be assigned to slot only when nodes are host\'s children');
test(() => {
slot3.assign([child1]);
assert_array_equals(slot3.assignedNodes(), []);
shadow_root.insertBefore(slot3,slot1);
assert_array_equals(slot3.assignedNodes(), [child1]);
}, 'Nodes should be assigned to a slot only when the slot is in host\'s shadowtree');
test(() => { test(() => {
assert_array_equals(slot4.assignedElements(), [child5]); assert_array_equals(slot4.assignedElements(), [child5]);
...@@ -88,6 +99,4 @@ test(() => { ...@@ -88,6 +99,4 @@ test(() => {
assert_array_equals(slot4.assignedElements(), [child5]); assert_array_equals(slot4.assignedElements(), [child5]);
assert_equals(child5.assignedSlot, slot4); assert_equals(child5.assignedSlot, slot4);
}, 'slotting API should not have any effect in auto mode'); }, 'slotting API should not have any effect in auto mode');
</script> </script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment