فهرست منبع

LibWeb/Tests: Add basic test for Element::scroll(x, y)

Aliaksandr Kalenik 2 سال پیش
والد
کامیت
dc08e9138c
2فایلهای تغییر یافته به همراه33 افزوده شده و 0 حذف شده
  1. 11 0
      Tests/LibWeb/Layout/expected/misc/scroll.txt
  2. 22 0
      Tests/LibWeb/Layout/input/misc/scroll.html

+ 11 - 0
Tests/LibWeb/Layout/expected/misc/scroll.txt

@@ -0,0 +1,11 @@
+Viewport <#document> at (0,0) content-size 800x600 children: not-inline
+  BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
+    BlockContainer <body> at (8,8) content-size 784x202 children: not-inline
+      BlockContainer <div#scrollbox> at (9,9) content-size 200x200 [BFC] children: not-inline
+        BlockContainer <div#content> at (9,9) content-size 200x1000 children: not-inline
+
+PaintableWithLines (Viewport<#document>) [0,0 800x600]
+  PaintableWithLines (BlockContainer<HTML>) [0,0 800x600]
+    PaintableWithLines (BlockContainer<BODY>) [8,8 784x202]
+      PaintableWithLines (BlockContainer<DIV>#scrollbox) [8,8 202x202] overflow: [9,9 200x1000] scroll-offset: [0,100]
+        PaintableWithLines (BlockContainer<DIV>#content) [9,9 200x1000]

+ 22 - 0
Tests/LibWeb/Layout/input/misc/scroll.html

@@ -0,0 +1,22 @@
+<style>
+    #scrollbox {
+        width: 200px;
+        height: 200px;
+        overflow: scroll;
+        border: 1px solid black;
+    }
+
+    #content {
+        height: 1000px;
+    }
+</style>
+<script>
+    document.addEventListener(
+        "DOMContentLoaded",
+        function () {
+            document.getElementById("scrollbox").scroll(0, 100);
+        },
+        false
+    );
+</script>
+<div id="scrollbox"><div id="content"></div></div>