browser/devtools/styleeditor/test/browser_styleeditor_selectstylesheet.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:bcbfd41bccd4
1 /* vim: set ts=2 et sw=2 tw=80: */
2 /* Any copyright is dedicated to the Public Domain.
3 http://creativecommons.org/publicdomain/zero/1.0/ */
4
5 const TESTCASE_URI = TEST_BASE_HTTPS + "simple.html";
6 const NEW_URI = TEST_BASE_HTTPS + "media.html";
7
8 const LINE_NO = 5;
9 const COL_NO = 0;
10
11 let gContentWin;
12 let gUI;
13
14 function test()
15 {
16 waitForExplicitFinish();
17
18 addTabAndOpenStyleEditors(2, function(panel) {
19 gContentWin = gBrowser.selectedTab.linkedBrowser.contentWindow.wrappedJSObject;
20 gUI = panel.UI;
21 gUI.editors[0].getSourceEditor().then(runTests);
22 });
23
24 content.location = TESTCASE_URI;
25 }
26
27 function runTests()
28 {
29 let count = 0;
30
31 // Make sure Editor doesn't go into an infinite loop when
32 // column isn't passed. See bug 941018.
33 gUI.once("editor-selected", (event, editor) => {
34 editor.getSourceEditor().then(() => {
35 is(gUI.selectedEditor, gUI.editors[1], "second editor is selected");
36 let {line, ch} = gUI.selectedEditor.sourceEditor.getCursor();
37
38 is(line, LINE_NO, "correct line selected");
39 is(ch, COL_NO, "correct column selected");
40
41 gUI = null;
42 finish();
43 });
44 });
45
46 gUI.selectStyleSheet(gUI.editors[1].styleSheet.href, LINE_NO);
47 }

mercurial