blob: 9d7e79852e15a5120f859cfc94d0135eb295054f [file] [log] [blame]
<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>PlayPauseButton</code> class.");
const playButton = new PlayPauseButton({ layoutTraits: LayoutTraits.macOS });
shouldBeEqualToString("playButton.element.localName", "button");
shouldBeTrue('playButton.element.classList.contains("play-pause")');
shouldBe("playButton.iconName", "Icons.Play");
shouldBeFalse("playButton.playing");
const fullscreenPlayButton = new PlayPauseButton({ layoutTraits: LayoutTraits.macOS | LayoutTraits.Fullscreen });
const iOSPlayButton = new PlayPauseButton({ layoutTraits: LayoutTraits.iOS });
const pauseButton = new PlayPauseButton({ layoutTraits: LayoutTraits.macOS });
pauseButton.playing = true;
shouldBeTrue("pauseButton.playing");
shouldBe("pauseButton.iconName", "Icons.Pause");
const fullscreenPauseButton = new PlayPauseButton({ layoutTraits: LayoutTraits.macOS | LayoutTraits.Fullscreen });
fullscreenPauseButton.playing = true;
const iOSPauseButton = new PlayPauseButton({ layoutTraits: LayoutTraits.iOS });
iOSPauseButton.playing = true;
shouldBecomeEqual('playButton.image.element.style.webkitMaskImage.includes("macOS/Play.svg")', "true", () => {
shouldBecomeEqual('pauseButton.image.element.style.webkitMaskImage.includes("macOS/Pause.svg")', "true", () => {
shouldBecomeEqual('iOSPlayButton.image.element.style.webkitMaskImage.includes("iOS/Play.svg")', "true", () => {
shouldBecomeEqual('iOSPauseButton.image.element.style.webkitMaskImage.includes("iOS/Pause.svg")', "true", () => {
debug("");
finishJSTest();
});
});
});
});
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>