Skip to content

Truly independent web browser

1.1 KB
Raw Blame
<!DOCTYPE html>
<script src="../include.js"></script>
<script src="../work-test.js"></script>
<style>
    body { margin: 0; }
    #scroller { overflow: auto; width: 100px; height: 100px; }
    #sticky { position: sticky; top: 0; height: 20px; }
    #filler { height: 500px; }
</style>
<div id="scroller"><div id="sticky"></div><div id="filler"></div></div>
<script>
    visualContextTest({
        steps: [
            {
                name: "the scroller grows and scrolls",
                mutate: () => {
                    scroller.style.height = "150px";
                    scroller.scrollTop = 60;
                },
                check: equal => {
                    equal(scroller.scrollTop, 60, "scrollTop");
                    equal(sticky.getBoundingClientRect().y, 0, "sticky y after resize and scroll");
                    equal(scroller.getBoundingClientRect().y, 0, "scroller y");
                },
                expect: `
                    update DIRTY-PATH
                      div#scroller clip UPDATED
                      div#scroller scroll UPDATED
                `,
            },
        ],
    });
</script>