blob: 9d92ba99fc1c9232148d0415cc53b9cacab75d85 [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>Placard</code> class.");
debug("Placard with all parameters");
const placard = new Placard({
iconName: Icons.AirplayPlacard,
title: "My title",
description: "My description",
layoutDelegate: { layoutTraits: new MacOSLayoutTraits(LayoutTraits.Mode.Inline) }
});
shouldBeEqualToString("placard.element.localName", "div");
shouldBeEqualToString("placard.element.className", "placard");
shouldBe("placard.children.length", "1");
shouldBeEqualToString("placard.children[0].element.localName", "div");
shouldBeEqualToString("placard.children[0].element.className", "container");
shouldBe("placard.children[0].children.length", "3");
shouldBeType("placard.children[0].children[0]", "Button");
shouldBe("placard.children[0].children[0].iconName", "Icons.AirplayPlacard");
shouldBeTrue("placard.children[0].children[0].element.disabled");
shouldBeType("placard.children[0].children[1]", "LayoutNode");
shouldBeEqualToString("placard.children[0].children[1].element.localName", "div");
shouldBeEqualToString("placard.children[0].children[1].element.className", "title");
shouldBeEqualToString("placard.children[0].children[1].element.innerText", "My title");
shouldBeType("placard.children[0].children[2]", "LayoutNode");
shouldBeEqualToString("placard.children[0].children[2].element.localName", "div");
shouldBeEqualToString("placard.children[0].children[2].element.className", "description");
shouldBeEqualToString("placard.children[0].children[2].element.innerText", "My description");
debug("");
debug("Placard without any parameter");
const defaultPlacard = new Placard;
shouldBe("defaultPlacard.children[0].children.length", "0");
debug("");
debug("Placard with only a description");
const onlyDescriptionPlacard = new Placard({ description: "My description" });
shouldBe("onlyDescriptionPlacard.children[0].children.length", "1");
shouldBeType("onlyDescriptionPlacard.children[0].children[0]", "LayoutNode");
shouldBeEqualToString("onlyDescriptionPlacard.children[0].children[0].element.className", "description");
debug("");
debug("Placard with only a title");
const onlyTitlePlacard = new Placard({ title: "My title" });
shouldBe("onlyTitlePlacard.children[0].children.length", "1");
shouldBeType("onlyTitlePlacard.children[0].children[0]", "LayoutNode");
shouldBeEqualToString("onlyTitlePlacard.children[0].children[0].element.className", "title");
debug("");
debug("Placard with only an icon");
const onlyIconPlacard = new Placard({ iconName: Icons.AirplayPlacard, layoutDelegate: { layoutTraits: new MacOSLayoutTraits(LayoutTraits.Mode.Inline) } });
shouldBe("onlyIconPlacard.children[0].children.length", "1");
shouldBeType("onlyIconPlacard.children[0].children[0]", "Button");
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>