<script src="../../../resources/js-test-pre.js"></script>
<script src="../resources/media-controls-loader.js" type="text/javascript"></script>
<script src="../resources/media-controls-utils.js" type="text/javascript"></script>
<body>
<script type="text/javascript">

window.jsTestIsAsync = true;

description("Testing the <code>AirplayButton</code> class.");

const airplayButton = new AirplayButton({ layoutTraits: new MacOSLayoutTraits(LayoutTraits.Mode.Inline) });
airplayButton.on = true;

document.body.appendChild(airplayButton.element);

// Obtain the plaform-specific color by creating an element using -apple-wireless-playback-target-active.
const airplayColorButton = document.body.appendChild(document.createElement("div"));
airplayColorButton.style.color = "-apple-wireless-playback-target-active";
const airplayColor = getComputedStyle(airplayColorButton).color;
airplayColorButton.remove();

shouldBecomeEqual('airplayButton.element.classList.contains("on")', "true", () => {
    shouldBecomeEqualToString("window.getComputedStyle(airplayButton.element).backgroundColor", "rgba(0, 0, 0, 0)", () => {
        shouldBecomeEqual("window.getComputedStyle(airplayButton.image.element).backgroundColor", "airplayColor", () => {
            airplayButton.element.remove();
            finishMediaControlsTest();
        });
    });
});

setTimeout(() => {
    debug(window.getComputedStyle(airplayButton.image.element).backgroundColor);
    finishMediaControlsTest();
}, 4000);

</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
