chromium/third_party/blink/web_tests/fast/css/invalidation/class-invalidation-after-adding-sheet.html

<!DOCTYPE html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<div id="d1">This text should be green</div>
<script>
    test(() => {
        document.body.offsetTop;
        assert_equals(getComputedStyle(d1).color, "rgb(0, 0, 0)", "Precondition - text is black.");

        var sheet = document.createElement("style");
        sheet.innerText = ".green { color: green }"
        document.head.appendChild(sheet);
        d1.className = "green";
        assert_equals(getComputedStyle(d1).color, "rgb(0, 128, 0)", "Check that d1 with class 'green' is green.");
    }, "Check that style invalidation works when class is changed immediately after adding sheet with rule for class.");
</script>