Index: third_party/WebKit/LayoutTests/shadow-dom/layout-update-on-slotassignment.html |
diff --git a/third_party/WebKit/LayoutTests/shadow-dom/layout-update-on-slotassignment.html b/third_party/WebKit/LayoutTests/shadow-dom/layout-update-on-slotassignment.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..03ec0e1cdb3c70a17397ce8b7b38f7d4dc7cdbb1 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/shadow-dom/layout-update-on-slotassignment.html |
@@ -0,0 +1,24 @@ |
+<!DOCTYPE html> |
+<script src='../resources/testharness.js'></script> |
+<script src='../resources/testharnessreport.js'></script> |
+<script src='resources/shadow-dom.js'></script> |
+<div id='host' class='container'> |
+ <template data-mode='open' data-expose-as='root'> |
+ <div id='container' style='position: relative'> |
+ <slot name='x'></slot> |
+ </div> |
+ </template> |
+ <span id='target' slot='x'>X</span> |
+</div> |
+ |
+<script> |
+test(() => { |
+ // Update layout and make layout clean. |
+ document.body.offsetTop; |
+ // Change slotting to make layout dirty. |
+ convertTemplatesToShadowRootsWithin(host); |
+ var slot = root.querySelector('slot'); |
+ assert_equals(slot.assignedNodes()[0].id, 'target', 'make sure the element is assigned to slot'); |
+ assert_equals(target.offsetParent.id, 'container', 'offsetParent should return layout tree parent.'); |
+}, 'slotting change should cause layout recalculation.'); |
+</script> |