Wed, 31 Dec 2014 07:53:36 +0100
Correct small whitespace inconsistency, lost while renaming variables.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | "use strict"; |
michael@0 | 4 | |
michael@0 | 5 | function test() { |
michael@0 | 6 | let dom = TiltUtils.DOM; |
michael@0 | 7 | ok(dom, "The TiltUtils.DOM wasn't found."); |
michael@0 | 8 | |
michael@0 | 9 | |
michael@0 | 10 | is(dom.initCanvas(), null, |
michael@0 | 11 | "The initCanvas() function shouldn't work if no parent node is set."); |
michael@0 | 12 | |
michael@0 | 13 | |
michael@0 | 14 | dom.parentNode = gBrowser.parentNode; |
michael@0 | 15 | ok(dom.parentNode, |
michael@0 | 16 | "The necessary parent node wasn't found."); |
michael@0 | 17 | |
michael@0 | 18 | |
michael@0 | 19 | let canvas = dom.initCanvas(null, { |
michael@0 | 20 | append: true, |
michael@0 | 21 | focusable: true, |
michael@0 | 22 | width: 123, |
michael@0 | 23 | height: 456, |
michael@0 | 24 | id: "tilt-test-canvas" |
michael@0 | 25 | }); |
michael@0 | 26 | |
michael@0 | 27 | is(canvas.width, 123, |
michael@0 | 28 | "The test canvas doesn't have the correct width set."); |
michael@0 | 29 | is(canvas.height, 456, |
michael@0 | 30 | "The test canvas doesn't have the correct height set."); |
michael@0 | 31 | is(canvas.getAttribute("tabindex"), 1, |
michael@0 | 32 | "The test canvas tab index wasn't set correctly."); |
michael@0 | 33 | is(canvas.getAttribute("id"), "tilt-test-canvas", |
michael@0 | 34 | "The test canvas doesn't have the correct id set."); |
michael@0 | 35 | ok(dom.parentNode.ownerDocument.getElementById(canvas.id), |
michael@0 | 36 | "A canvas should be appended to the parent node if specified."); |
michael@0 | 37 | canvas.parentNode.removeChild(canvas); |
michael@0 | 38 | |
michael@0 | 39 | let canvas2 = dom.initCanvas(null, { id: "tilt-test-canvas2" }); |
michael@0 | 40 | |
michael@0 | 41 | is(canvas2.width, dom.parentNode.clientWidth, |
michael@0 | 42 | "The second test canvas doesn't have the implicit width set."); |
michael@0 | 43 | is(canvas2.height, dom.parentNode.clientHeight, |
michael@0 | 44 | "The second test canvas doesn't have the implicit height set."); |
michael@0 | 45 | is(canvas2.id, "tilt-test-canvas2", |
michael@0 | 46 | "The second test canvas doesn't have the correct id set."); |
michael@0 | 47 | is(dom.parentNode.ownerDocument.getElementById(canvas2.id), null, |
michael@0 | 48 | "A canvas shouldn't be appended to the parent node if not specified."); |
michael@0 | 49 | |
michael@0 | 50 | |
michael@0 | 51 | dom.parentNode = null; |
michael@0 | 52 | is(dom.parentNode, null, |
michael@0 | 53 | "The necessary parent node shouldn't be found anymore."); |
michael@0 | 54 | } |