<script src="../../../resources/js-test.js"></script>
<div></div>
<script>
    var div = document.querySelector('div');
    var root = div.createShadowRoot();
    root.innerHTML = '<style> .red { background: red; }</style><div>tap to toggle red</div>';
    var rootDiv = root.querySelector('div');
    rootDiv.offsetHeight;

    rootDiv.classList.toggle('red');
    shouldBe("internals.updateStyleAndReturnAffectedElementCount()", '1');
    shouldBe('getComputedStyle(rootDiv).backgroundColor', '"rgb(255, 0, 0)"');

    rootDiv.offsetHeight;
    rootDiv.classList.toggle('red');
    shouldBe("internals.updateStyleAndReturnAffectedElementCount()", '1');
    shouldBe('getComputedStyle(rootDiv).backgroundColor', '"rgba(0, 0, 0, 0)"');
</script>