summaryrefslogtreecommitdiffstats
path: root/devtools/client/sourceeditor/test/browser_editor_script_injection.js
blob: 05487b4f21eb3f1cbb14a3ca7125c9567494aef7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

// Test the externalScripts option, which allows custom language modes or
// other scripts to be injected into the editor window.  See Bug 1089428.

"use strict";

add_task(function* () {
  yield runTest();
});

function* runTest() {
  const baseURL =
    "chrome://mochitests/content/browser/devtools/client/sourceeditor/test";
  const injectedText = "Script successfully injected!";

  let {ed, win} = yield setup(null, {
    mode: "ruby",
    externalScripts: [`${baseURL}/cm_script_injection_test.js`,
                      `${baseURL}/cm_mode_ruby.js`]
  });

  is(ed.getText(), injectedText, "The text has been injected");
  is(ed.getOption("mode"), "ruby", "The ruby mode is correctly set");
  teardown(ed, win);
}