<!DOCTYPE html>
<script src="../../../resources/js-test.js"></script>
<style>
.theme ::-webkit-file-upload-button { background-color: green }
</style>
<div id="t">
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <input type="file"></input>
</div>
<script>
description("Check that targeted class invalidation works for custom pseudo elements.");

shouldBeTrue("!!window.internals");

if (window.internals) {
    var gray = "rgb(192, 192, 192)";
    var green = "rgb(0, 128, 0)";

    fileUploadButton = internals.shadowRoot(document.querySelector("input")).firstChild;

    shouldBe("getComputedStyle(fileUploadButton, null).backgroundColor", "gray");

    document.body.offsetLeft; // force style recalc.

    document.getElementById("t").className = "theme";

    shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1");
    shouldBe("getComputedStyle(fileUploadButton, null).backgroundColor", "green");
}
</script>