diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /devtools/client/scratchpad/test/browser_scratchpad_inspect_primitives.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/client/scratchpad/test/browser_scratchpad_inspect_primitives.js')
-rw-r--r-- | devtools/client/scratchpad/test/browser_scratchpad_inspect_primitives.js | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/devtools/client/scratchpad/test/browser_scratchpad_inspect_primitives.js b/devtools/client/scratchpad/test/browser_scratchpad_inspect_primitives.js new file mode 100644 index 000000000..914f0a6d8 --- /dev/null +++ b/devtools/client/scratchpad/test/browser_scratchpad_inspect_primitives.js @@ -0,0 +1,61 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +// Test that inspecting primitive values uses the object inspector, not an +// inline comment. + +var {Task} = require("devtools/shared/task"); + +function test() { + const options = { + tabContent: "test inspecting primitive values" + }; + openTabAndScratchpad(options) + .then(Task.async(runTests)) + .then(finish, console.error); +} + +function* runTests([win, sp]) { + // Inspect a number. + yield checkResults(sp, 7); + + // Inspect a string. + yield checkResults(sp, "foobar", true); + + // Inspect a boolean. + yield checkResults(sp, true); +} + +// Helper function that does the actual testing. +var checkResults = Task.async(function* (sp, value, isString = false) { + let sourceValue = value; + if (isString) { + sourceValue = '"' + value + '"'; + } + let source = "var foobar = " + sourceValue + "; foobar"; + sp.setText(source); + yield sp.inspect(); + + let sidebar = sp.sidebar; + ok(sidebar.visible, "sidebar is open"); + + let found = false; + + outer: for (let scope of sidebar.variablesView) { + for (let [, obj] of scope) { + for (let [, prop] of obj) { + if (prop.name == "value" && prop.value == value) { + found = true; + break outer; + } + } + } + } + + ok(found, "found the value of " + value); + + let tabbox = sidebar._sidebar._tabbox; + ok(!tabbox.hasAttribute("hidden"), "Scratchpad sidebar visible"); + sidebar.hide(); + ok(tabbox.hasAttribute("hidden"), "Scratchpad sidebar hidden"); +}); |