2013-11-26 10:01:02 -08:00
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
|
|
|
|
const TESTCASE_URI = TEST_BASE_HTTPS + "simple.html";
|
|
|
|
const NEW_URI = TEST_BASE_HTTPS + "media.html";
|
|
|
|
|
|
|
|
const LINE_NO = 5;
|
|
|
|
const COL_NO = 0;
|
|
|
|
|
|
|
|
let gContentWin;
|
|
|
|
let gUI;
|
|
|
|
|
|
|
|
function test()
|
|
|
|
{
|
|
|
|
waitForExplicitFinish();
|
|
|
|
|
2014-01-08 10:53:16 -08:00
|
|
|
addTabAndOpenStyleEditors(2, function(panel) {
|
2013-11-26 10:01:02 -08:00
|
|
|
gContentWin = gBrowser.selectedTab.linkedBrowser.contentWindow.wrappedJSObject;
|
|
|
|
gUI = panel.UI;
|
2014-01-08 10:53:16 -08:00
|
|
|
gUI.editors[0].getSourceEditor().then(runTests);
|
2013-11-26 10:01:02 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
content.location = TESTCASE_URI;
|
|
|
|
}
|
|
|
|
|
|
|
|
function runTests()
|
|
|
|
{
|
|
|
|
let count = 0;
|
|
|
|
|
|
|
|
// Make sure Editor doesn't go into an infinite loop when
|
|
|
|
// column isn't passed. See bug 941018.
|
2014-06-05 23:02:23 -07:00
|
|
|
gUI.on("editor-selected", function editorSelected(event, editor) {
|
|
|
|
if (editor.styleSheet != gUI.editors[1].styleSheet) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
gUI.off("editor-selected", editorSelected);
|
|
|
|
|
2013-11-26 10:01:02 -08:00
|
|
|
editor.getSourceEditor().then(() => {
|
|
|
|
is(gUI.selectedEditor, gUI.editors[1], "second editor is selected");
|
|
|
|
let {line, ch} = gUI.selectedEditor.sourceEditor.getCursor();
|
2014-05-26 10:52:24 -07:00
|
|
|
|
2013-11-26 10:01:02 -08:00
|
|
|
is(line, LINE_NO, "correct line selected");
|
|
|
|
is(ch, COL_NO, "correct column selected");
|
|
|
|
|
|
|
|
gUI = null;
|
|
|
|
finish();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
gUI.selectStyleSheet(gUI.editors[1].styleSheet.href, LINE_NO);
|
|
|
|
}
|