blob: 5018fd216be96e4c88f58d5a09199ed26f2bd64a [file] [log] [blame]
<script src="../../../resources/js-test-pre.js"></script>
<script src="../resources/media-controls-loader.js" type="text/javascript"></script>
<body>
<script type="text/javascript">
description("Testing the <code>MacOSInlineMediaControls</code> constructor.");
const mediaControls = new MacOSInlineMediaControls;
shouldBeEqualToString("mediaControls.element.localName", "div");
shouldBeEqualToString("mediaControls.element.className", "media-controls mac inline");
shouldBe("mediaControls.layoutTraits", "LayoutTraits.macOS");
debug("");
debug("Controls bar");
shouldBe("mediaControls.controlsBar.children.length", "4");
shouldBeTrue("mediaControls.controlsBar.children[1] instanceof ButtonsContainer");
shouldBeTrue("mediaControls.controlsBar.children[2] instanceof ButtonsContainer");
shouldBeTrue("mediaControls.controlsBar.children[3] instanceof LayoutNode");
debug("");
debug("Left container");
shouldBe("mediaControls.controlsBar.children[1].buttons", "[mediaControls.playPauseButton, mediaControls.skipBackButton]");
shouldBeEqualToString("mediaControls.controlsBar.children[1].element.className", "buttons-container left");
shouldBe("mediaControls.controlsBar.children[1].leftMargin", "24");
shouldBe("mediaControls.controlsBar.children[1].rightMargin", "24");
shouldBe("mediaControls.controlsBar.children[1].buttonMargin", "24");
debug("");
debug("Right container");
shouldBe("mediaControls.controlsBar.children[2].buttons", "[mediaControls.muteButton, mediaControls.airplayButton, mediaControls.pipButton, mediaControls.tracksButton, mediaControls.fullscreenButton]");
shouldBeEqualToString("mediaControls.controlsBar.children[2].element.className", "buttons-container right");
shouldBe("mediaControls.controlsBar.children[2].leftMargin", "24");
shouldBe("mediaControls.controlsBar.children[2].rightMargin", "24");
shouldBe("mediaControls.controlsBar.children[2].buttonMargin", "24");
debug("");
debug("Volume slider");
shouldBeEqualToString("mediaControls.controlsBar.children[3].element.className", "volume-slider-container");
shouldBe("mediaControls.controlsBar.children[3].children.slice(-1)", "[mediaControls.volumeSlider]");
shouldBeFalse("mediaControls.controlsBar.children[3].visible");
shouldBe("mediaControls.volumeSlider.width", "60");
mediaControls.bottomControlsBar.element.id = "groupping-label";
document.body.appendChild(mediaControls.bottomControlsBar.element);
mediaControls.shouldUseAudioLayout = false;
shouldBeEqualToString("accessibilityController.accessibleElementById('groupping-label').description","AXDescription: Video Controls");
mediaControls.shouldUseAudioLayout = true;
shouldBeEqualToString("accessibilityController.accessibleElementById('groupping-label').description","AXDescription: Audio Controls");
debug("");
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>