browser_cubic-bezier-01.js (1255B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Tests that the CubicBezierWidget generates content in a given parent node 7 8 const { 9 CubicBezierWidget, 10 } = require("resource://devtools/client/shared/widgets/CubicBezierWidget.js"); 11 12 const TEST_URI = CHROME_URL_ROOT + "doc_cubic-bezier-01.html"; 13 14 add_task(async function () { 15 const { host, doc } = await createHost("bottom", TEST_URI); 16 17 info("Checking that the graph markup is created in the parent"); 18 const container = doc.querySelector("#cubic-bezier-container"); 19 const w = new CubicBezierWidget(container); 20 21 ok(container.querySelector(".display-wrap"), "The display has been added"); 22 23 ok( 24 container.querySelector(".coordinate-plane"), 25 "The coordinate plane has been added" 26 ); 27 const buttons = container.querySelectorAll("button"); 28 is(buttons.length, 2, "The 2 control points have been added"); 29 is(buttons[0].className, "control-point"); 30 is(buttons[1].className, "control-point"); 31 ok(container.querySelector("canvas"), "The curve canvas has been added"); 32 33 info("Destroying the widget"); 34 w.destroy(); 35 is(container.children.length, 0, "All nodes have been removed"); 36 37 host.destroy(); 38 });