1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/styleeditor/test/browser_styleeditor_selectstylesheet.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,47 @@ 1.4 +/* vim: set ts=2 et sw=2 tw=80: */ 1.5 +/* Any copyright is dedicated to the Public Domain. 1.6 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.7 + 1.8 +const TESTCASE_URI = TEST_BASE_HTTPS + "simple.html"; 1.9 +const NEW_URI = TEST_BASE_HTTPS + "media.html"; 1.10 + 1.11 +const LINE_NO = 5; 1.12 +const COL_NO = 0; 1.13 + 1.14 +let gContentWin; 1.15 +let gUI; 1.16 + 1.17 +function test() 1.18 +{ 1.19 + waitForExplicitFinish(); 1.20 + 1.21 + addTabAndOpenStyleEditors(2, function(panel) { 1.22 + gContentWin = gBrowser.selectedTab.linkedBrowser.contentWindow.wrappedJSObject; 1.23 + gUI = panel.UI; 1.24 + gUI.editors[0].getSourceEditor().then(runTests); 1.25 + }); 1.26 + 1.27 + content.location = TESTCASE_URI; 1.28 +} 1.29 + 1.30 +function runTests() 1.31 +{ 1.32 + let count = 0; 1.33 + 1.34 + // Make sure Editor doesn't go into an infinite loop when 1.35 + // column isn't passed. See bug 941018. 1.36 + gUI.once("editor-selected", (event, editor) => { 1.37 + editor.getSourceEditor().then(() => { 1.38 + is(gUI.selectedEditor, gUI.editors[1], "second editor is selected"); 1.39 + let {line, ch} = gUI.selectedEditor.sourceEditor.getCursor(); 1.40 + 1.41 + is(line, LINE_NO, "correct line selected"); 1.42 + is(ch, COL_NO, "correct column selected"); 1.43 + 1.44 + gUI = null; 1.45 + finish(); 1.46 + }); 1.47 + }); 1.48 + 1.49 + gUI.selectStyleSheet(gUI.editors[1].styleSheet.href, LINE_NO); 1.50 +} 1.51 \ No newline at end of file