| <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: new MacOSLayoutTraits(LayoutTraits.Mode.Inline) }); |
| |
| 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: new MacOSLayoutTraits(LayoutTraits.Mode.Fullscreen) }); |
| const iOSPlayButton = new PlayPauseButton({ layoutTraits: new IOSLayoutTraits(LayoutTraits.Mode.Inline) }); |
| |
| const pauseButton = new PlayPauseButton({ layoutTraits: new MacOSLayoutTraits(LayoutTraits.Mode.Inline) }); |
| pauseButton.playing = true; |
| shouldBeTrue("pauseButton.playing"); |
| shouldBe("pauseButton.iconName", "Icons.Pause"); |
| |
| const fullscreenPauseButton = new PlayPauseButton({ layoutTraits: new MacOSLayoutTraits(LayoutTraits.Mode.Fullscreen) }); |
| fullscreenPauseButton.playing = true; |
| |
| const iOSPauseButton = new PlayPauseButton({ layoutTraits: new IOSLayoutTraits(LayoutTraits.Mode.Inline) }); |
| 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> |