chromium/third_party/blink/web_tests/wpt_internal/css/css-overflow/scroll-marker-controls-scroll-tracking-001.html

<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Test: scroll tracking for ::scroll-marker </title>
<link rel="help" href="https://drafts.csswg.org/css-overflow-5/#scroll-container-scroll">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
    #scroller {
        overflow: scroll;
        scroll-marker-group: before;
        height: 100px;
    }

    #scroller::scroll-marker-group {
        border: 3px solid black;
        display: flex;
        width: 100px;
        height: 20px;
    }

    #scroller div {
        width: 100px;
        height: 100px;
    }

    #scroller div::scroll-marker {
        content: '';
        background-color: red;
        display: inline-flex;
        width: 10px;
        height: 10px;
        border-radius: 50%;
    }

    #scroller div::scroll-marker:checked {
        background-color: green;
    }
</style>
<div id='scroller'>
    <div></div>
    <div id='target'></div>
</div>
<script>
    function assertPseudoElementProperty(originatingElement, pseudoType, backgroundColor) {
        const pseudoStyle = getComputedStyle(originatingElement, pseudoType);
        const pseudoBackgroundColor = pseudoStyle.getPropertyValue('background-color');
        assert_equals(pseudoBackgroundColor, backgroundColor, pseudoType +
                      " background-color should be " + backgroundColor.toString() +
                      " but was " + pseudoBackgroundColor.toString());
    }
    test(() => {
        assertPseudoElementProperty(target, "::scroll-marker", "rgb(255, 0, 0)");
    }, "::scroll-marker is not activated when its originating element is not scrolled into the view");
    scroller.scrollTop = 150;
    test(() => {
        assertPseudoElementProperty(target, "::scroll-marker", "rgb(0, 128, 0)");
    }, "::scroll-marker is activated when its originating element is scrolled into the view");
</script>