browser/devtools/styleeditor/test/browser_styleeditor_selectstylesheet.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial