| <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: LayoutTraits.macOS } |
| }); |
| |
| 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"); |
| shouldBeTrue("placard.children[0].children[0] instanceof Button"); |
| shouldBe("placard.children[0].children[0].iconName", "Icons.AirplayPlacard"); |
| shouldBeTrue("placard.children[0].children[0].element.disabled"); |
| shouldBeTrue("placard.children[0].children[1] instanceof 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"); |
| shouldBeTrue("placard.children[0].children[2] instanceof 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"); |
| shouldBeTrue("onlyDescriptionPlacard.children[0].children[0] instanceof 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"); |
| shouldBeTrue("onlyTitlePlacard.children[0].children[0] instanceof 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: LayoutTraits.macOS } }); |
| shouldBe("onlyIconPlacard.children[0].children.length", "1"); |
| shouldBeTrue("onlyIconPlacard.children[0].children[0] instanceof Button"); |
| |
| </script> |
| <script src="../../../resources/js-test-post.js"></script> |
| </body> |