2010-10-11 09:57:56 -07:00
|
|
|
/* vim:set ts=2 sw=2 sts=2 et: */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-10-11 09:57:56 -07:00
|
|
|
|
|
|
|
// Tests the functionality of the "property panel", which allows JavaScript
|
|
|
|
// objects and DOM nodes to be inspected.
|
|
|
|
|
2012-05-25 03:28:47 -07:00
|
|
|
const TEST_URI = "data:text/html;charset=utf8,<p>property panel test";
|
2010-10-11 09:57:56 -07:00
|
|
|
|
|
|
|
function test() {
|
|
|
|
addTab(TEST_URI);
|
2012-05-25 03:28:47 -07:00
|
|
|
browser.addEventListener("load", function onLoad() {
|
|
|
|
browser.removeEventListener("load", onLoad, true);
|
|
|
|
openConsole(null, testPropertyPanel);
|
|
|
|
}, true);
|
2010-10-11 09:57:56 -07:00
|
|
|
}
|
|
|
|
|
2012-05-25 03:28:47 -07:00
|
|
|
function testPropertyPanel(hud) {
|
|
|
|
let jsterm = hud.jsterm;
|
2010-10-11 09:57:56 -07:00
|
|
|
|
2012-05-25 03:28:47 -07:00
|
|
|
let propPanel = jsterm.openPropertyPanel({
|
|
|
|
data: {
|
|
|
|
object: [
|
|
|
|
1,
|
|
|
|
/abc/,
|
|
|
|
null,
|
|
|
|
undefined,
|
|
|
|
function test() {},
|
|
|
|
{}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
});
|
2010-10-11 09:57:56 -07:00
|
|
|
is (propPanel.treeView.rowCount, 6, "six elements shown in propertyPanel");
|
|
|
|
propPanel.destroy();
|
|
|
|
|
2012-05-25 03:28:47 -07:00
|
|
|
propPanel = jsterm.openPropertyPanel({
|
|
|
|
data: {
|
|
|
|
object: {
|
|
|
|
"0.02": 0,
|
|
|
|
"0.01": 1,
|
|
|
|
"02": 2,
|
|
|
|
"1": 3,
|
|
|
|
"11": 4,
|
|
|
|
"1.2": 5,
|
|
|
|
"1.1": 6,
|
|
|
|
"foo": 7,
|
|
|
|
"bar": 8
|
|
|
|
}
|
|
|
|
}
|
2010-10-11 09:57:56 -07:00
|
|
|
});
|
|
|
|
is (propPanel.treeView.rowCount, 9, "nine elements shown in propertyPanel");
|
|
|
|
|
2012-05-25 03:28:47 -07:00
|
|
|
let view = propPanel.treeView;
|
|
|
|
is (view.getCellText(0), "0.01: 1", "1. element is okay");
|
|
|
|
is (view.getCellText(1), "0.02: 0", "2. element is okay");
|
|
|
|
is (view.getCellText(2), "1: 3", "3. element is okay");
|
|
|
|
is (view.getCellText(3), "1.1: 6", "4. element is okay");
|
|
|
|
is (view.getCellText(4), "1.2: 5", "5. element is okay");
|
|
|
|
is (view.getCellText(5), "02: 2", "6. element is okay");
|
|
|
|
is (view.getCellText(6), "11: 4", "7. element is okay");
|
|
|
|
is (view.getCellText(7), "bar: 8", "8. element is okay");
|
|
|
|
is (view.getCellText(8), "foo: 7", "9. element is okay");
|
2010-10-11 09:57:56 -07:00
|
|
|
propPanel.destroy();
|
|
|
|
|
2012-05-25 03:28:47 -07:00
|
|
|
executeSoon(finishTest);
|
2010-10-11 09:57:56 -07:00
|
|
|
}
|
|
|
|
|