Bug 1316809 - Fix eslint errors in devtools/client/sourceeditor/test. r=tromey
authorTim Nguyen <ntim.bugs@gmail.com>
Sat, 12 Nov 2016 16:57:41 +0000
changeset 322420 8314e332761363771cefaff1b37e92b142e6370c
parent 322419 c4917d6cf7764fecda6e2b9a5a1ab3545d3f955f
child 322421 6a2be354a0dde2ec69df3936712f2eaa4cd2f0ab
push id30951
push usercbook@mozilla.com
push dateTue, 15 Nov 2016 11:25:40 +0000
treeherdermozilla-central@85a9d908e91a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstromey
bugs1316809
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1316809 - Fix eslint errors in devtools/client/sourceeditor/test. r=tromey MozReview-Commit-ID: HjmCUoAsqlZ
.eslintignore
devtools/client/sourceeditor/test/.eslintrc.js
devtools/client/sourceeditor/test/browser_css_autocompletion.js
devtools/client/sourceeditor/test/browser_css_getInfo.js
devtools/client/sourceeditor/test/browser_css_statemachine.js
devtools/client/sourceeditor/test/browser_editor_autocomplete_events.js
devtools/client/sourceeditor/test/browser_editor_find_again.js
devtools/client/sourceeditor/test/cm_script_injection_test.js
devtools/client/sourceeditor/test/css_autocompletion_tests.json
devtools/client/sourceeditor/test/css_statemachine_tests.json
devtools/client/sourceeditor/test/head.js
devtools/client/sourceeditor/test/helper_codemirror_runner.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -90,17 +90,16 @@ devtools/client/netmonitor/har/test/**
 devtools/client/projecteditor/**
 devtools/client/promisedebugger/**
 devtools/client/responsivedesign/**
 devtools/client/scratchpad/**
 devtools/client/shadereditor/**
 devtools/client/shared/*.jsm
 devtools/client/shared/webgl-utils.js
 devtools/client/shared/widgets/*.jsm
-devtools/client/sourceeditor/test/*.js
 devtools/client/webaudioeditor/**
 devtools/client/webconsole/**
 !devtools/client/webconsole/panel.js
 !devtools/client/webconsole/jsterm.js
 !devtools/client/webconsole/console-commands.js
 devtools/client/webide/**
 !devtools/client/webide/components/webideCli.js
 devtools/server/*.js
@@ -167,16 +166,17 @@ devtools/shared/pretty-fast/*
 devtools/shared/sourcemap/*
 devtools/shared/sprintfjs/*
 devtools/shared/qrcode/decoder/*
 devtools/shared/qrcode/encoder/*
 devtools/client/shared/demangle.js
 devtools/client/shared/vendor/*
 devtools/client/sourceeditor/codemirror/*.js
 devtools/client/sourceeditor/codemirror/**/*.js
+devtools/client/sourceeditor/test/cm_mode_ruby.js
 devtools/client/sourceeditor/test/codemirror/*
 devtools/client/inspector/markup/test/lib_*
 devtools/client/jsonview/lib/require.js
 devtools/server/actors/utils/automation-timeline.js
 
 # Ignore devtools files testing sourcemaps / code style
 devtools/client/debugger/test/mochitest/code_binary_search.js
 devtools/client/debugger/test/mochitest/code_math.min.js
--- a/devtools/client/sourceeditor/test/.eslintrc.js
+++ b/devtools/client/sourceeditor/test/.eslintrc.js
@@ -1,6 +1,10 @@
 "use strict";
 
 module.exports = {
   // Extend from the shared list of defined globals for mochitests.
-  "extends": "../../../.eslintrc.mochitests.js"
+  "extends": "../../../.eslintrc.mochitests.js",
+  "globals": {
+    "runCodeMirrorTest": true,
+    "gBrowser": true
+  }
 };
--- a/devtools/client/sourceeditor/test/browser_css_autocompletion.js
+++ b/devtools/client/sourceeditor/test/browser_css_autocompletion.js
@@ -8,17 +8,17 @@ const CSSCompleter = require("devtools/c
 const {InspectorFront} = require("devtools/shared/fronts/inspector");
 
 const CSS_URI = "http://mochi.test:8888/browser/devtools/client/sourceeditor" +
                 "/test/css_statemachine_testcases.css";
 const TESTS_URI = "http://mochi.test:8888/browser/devtools/client" +
                   "/sourceeditor/test/css_autocompletion_tests.json";
 
 const source = read(CSS_URI);
-const tests = eval(read(TESTS_URI));
+const {tests} = JSON.parse(read(TESTS_URI));
 
 const TEST_URI = "data:text/html;charset=UTF-8," + encodeURIComponent(
   ["<!DOCTYPE html>",
    "<html>",
    " <head>",
    "  <title>CSS State machine tests.</title>",
    "  <style type='text/css'>",
    "#progress {",
@@ -55,17 +55,19 @@ const TEST_URI = "data:text/html;charset
    "  <div id='devtools-toolbarbutton' class='devtools-menulist'></div>",
    "  <div id='devtools-anotherone'></div>",
    "  <div id='devtools-yetagain'></div>",
    "  <div id='devtools-itjustgoeson'></div>",
    "  <div id='devtools-okstopitnow'></div>",
    "  <div class='hidden-labels-box devtools-toolbarbutton devtools-menulist'></div>",
    "  <div class='devtools-menulist'></div>",
    "  <div class='devtools-menulist'></div>",
+   /* eslint-disable max-len */
    "  <tabs class='devtools-toolbarbutton'><tab></tab><tab></tab><tab></tab></tabs><tabs></tabs>",
+   /* eslint-enable max-len */
    "  <button class='category-name visible'></button>",
    "  <div class='devtools-toolbarbutton' label='true'>",
    "   <hbox class='toolbarbutton-menubutton-button'></hbox></div>",
    " </body>",
    " </html>"
   ].join("\n"));
 
 let doc = null;
@@ -73,17 +75,19 @@ let index = 0;
 let completer = null;
 let progress;
 let progressDiv;
 let inspector;
 
 function test() {
   waitForExplicitFinish();
   addTab(TEST_URI).then(function () {
+    /* eslint-disable mozilla/no-cpows-in-tests */
     doc = content.document;
+    /* eslint-enable mozilla/no-cpows-in-tests */
     runTests();
   });
 }
 
 function runTests() {
   progress = doc.getElementById("progress");
   progressDiv = doc.querySelector("#progress > div");
   let target = TargetFactory.forTab(gBrowser.selectedTab);
--- a/devtools/client/sourceeditor/test/browser_css_getInfo.js
+++ b/devtools/client/sourceeditor/test/browser_css_getInfo.js
@@ -51,16 +51,18 @@ const source = [
 // Format of test cases :
 // [
 //  {line, ch}, - The caret position at which the getInfo call should be made
 //  expectedState, - The expected state at the caret
 //  expectedSelector, - The expected selector for the state
 //  expectedProperty, - The expected property name for states value and property
 //  expectedValue, - If state is value, then the expected value
 // ]
+
+/* eslint-disable max-len */
 const tests = [
   [{line: 0, ch: 13}, "selector", ".devtools-toolbar"],
   [{line: 8, ch: 13}, "property", ["#devtools-menu.devtools-menulist",
                                    ".devtools-toolbarbutton#devtools-menu "], "-moz-appearance"],
   [{line: 28, ch: 25}, "value", [".devtools-menulist:active",
                                  "#devtools-toolbarbutton:focus "], "outline-offset", "-4px"],
   [{line: 4, ch: 1}, "null"],
   [{line: 5, ch: 0}, "null"],
@@ -74,16 +76,17 @@ const tests = [
    "linear-gradient(hsla(212,7%,57%,.35),\n              hsla(212,7%,57%,.1)) padding-box"],
   [{line: 16, ch: 3}, "value", ["#devtools-menu.devtools-menulist",
                                 ".devtools-toolbarbutton#devtools-menu "], "background",
    "linear-gradient(hsla(212,7%,57%,.35),\n              hsla(212,7%,57%,.1)) padding-box"],
   [{line: 15, ch: 25}, "value", ["#devtools-menu.devtools-menulist",
                                  ".devtools-toolbarbutton#devtools-menu "], "background",
    "linear-gradient(hsla(212,7%,57%,.35),\n              hsla(212,7%,57%,.1)) padding-box"],
 ];
+/* eslint-enable max-len */
 
 const TEST_URI = "data:text/html;charset=UTF-8," + encodeURIComponent(
   ["<!DOCTYPE html>",
    "<html>",
    " <head>",
    "  <title>CSS contextual information tests.</title>",
    "  <style type='text/css'>",
    "#progress {",
@@ -120,24 +123,28 @@ const TEST_URI = "data:text/html;charset
    " </html>"
   ].join("\n"));
 
 let doc = null;
 function test() {
   waitForExplicitFinish();
   gBrowser.selectedTab = gBrowser.addTab();
   BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
+    /* eslint-disable mozilla/no-cpows-in-tests */
     doc = content.document;
+    /* eslint-enable mozilla/no-cpows-in-tests */
     runTests();
   });
   gBrowser.loadURI(TEST_URI);
 }
 
 function runTests() {
-  let completer = new CSSCompleter({cssProperties: getClientCssProperties()});
+  let completer = new CSSCompleter({
+    cssProperties: getClientCssProperties()
+  });
   let matches = (arr, toCheck) => !arr.some((x, i) => x != toCheck[i]);
   let checkState = (expected, actual) => {
     if (expected[0] == "null" && actual == null) {
       return true;
     } else if (expected[0] == actual.state && expected[0] == "selector" &&
                expected[1] == actual.selector) {
       return true;
     } else if (expected[0] == actual.state && expected[0] == "property" &&
--- a/devtools/client/sourceeditor/test/browser_css_statemachine.js
+++ b/devtools/client/sourceeditor/test/browser_css_statemachine.js
@@ -7,17 +7,17 @@
 const CSSCompleter = require("devtools/client/sourceeditor/css-autocompleter");
 
 const CSS_URI = "http://mochi.test:8888/browser/devtools/client/sourceeditor" +
                 "/test/css_statemachine_testcases.css";
 const TESTS_URI = "http://mochi.test:8888/browser/devtools/client" +
                   "/sourceeditor/test/css_statemachine_tests.json";
 
 const source = read(CSS_URI);
-const tests = eval(read(TESTS_URI));
+const {tests} = JSON.parse(read(TESTS_URI));
 
 const TEST_URI = "data:text/html;charset=UTF-8," + encodeURIComponent(
   ["<!DOCTYPE html>",
    "<html>",
    " <head>",
    "  <title>CSS State machine tests.</title>",
    "  <style type='text/css'>",
    "#progress {",
@@ -54,23 +54,27 @@ const TEST_URI = "data:text/html;charset
    " </html>"
   ].join("\n"));
 
 var doc = null;
 function test() {
   waitForExplicitFinish();
   gBrowser.selectedTab = gBrowser.addTab(TEST_URI);
   BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
+    /* eslint-disable mozilla/no-cpows-in-tests */
     doc = content.document;
+    /* eslint-enable mozilla/no-cpows-in-tests */
     runTests();
   });
 }
 
 function runTests() {
-  let completer = new CSSCompleter({cssProperties: getClientCssProperties()});
+  let completer = new CSSCompleter({
+    cssProperties: getClientCssProperties()
+  });
   let checkState = state => {
     if (state[0] == "null" && (!completer.state || completer.state == "null")) {
       return true;
     } else if (state[0] == completer.state && state[0] == "selector" &&
                state[1] == completer.selectorState &&
                state[2] == completer.completing &&
                state[3] == completer.selector) {
       return true;
@@ -84,25 +88,25 @@ function runTests() {
       return true;
     }
     return false;
   };
 
   let progress = doc.getElementById("progress");
   let progressDiv = doc.querySelector("#progress > div");
   let i = 0;
-  for (let test of tests) {
+  for (let testcase of tests) {
     progress.dataset.progress = ++i;
     progressDiv.style.width = 100 * i / tests.length + "%";
-    completer.resolveState(limit(source, test[0]),
-                           {line: test[0][0], ch: test[0][1]});
-    if (checkState(test[1])) {
+    completer.resolveState(limit(source, testcase[0]),
+                           {line: testcase[0][0], ch: testcase[0][1]});
+    if (checkState(testcase[1])) {
       ok(true, "Test " + i + " passed. ");
     } else {
-      ok(false, "Test " + i + " failed. Expected state : [" + test[1] + "] " +
+      ok(false, "Test " + i + " failed. Expected state : [" + testcase[1] + "] " +
          "but found [" + completer.state + ", " + completer.selectorState +
          ", " + completer.completing + ", " +
          (completer.propertyName || completer.selector) + "].");
       progress.classList.add("failed");
     }
   }
   gBrowser.removeCurrentTab();
   finish();
--- a/devtools/client/sourceeditor/test/browser_editor_autocomplete_events.js
+++ b/devtools/client/sourceeditor/test/browser_editor_autocomplete_events.js
@@ -1,16 +1,15 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const {InspectorFront} = require("devtools/shared/fronts/inspector");
-const AUTOCOMPLETION_PREF = "devtools.editor.autocomplete";
 const TEST_URI = "data:text/html;charset=UTF-8,<html><body><bar></bar>" +
                  "<div id='baz'></div><body></html>";
 
 add_task(function* () {
   yield addTab(TEST_URI);
   yield runTests();
 });
 
@@ -94,17 +93,19 @@ function* testKeyboardCycleForPrefixedSt
 
 function* testKeyboardCSSComma(ed, win) {
   ed.focus();
   ed.setText("b");
   ed.setCursor({line: 1, ch: 1});
 
   let isPopupOpened = false;
   let popupOpened = ed.getAutocompletionPopup().once("popup-opened");
-  popupOpened.then(() => isPopupOpened = true);
+  popupOpened.then(() => {
+    isPopupOpened = true;
+  });
 
   EventUtils.synthesizeKey(",", { }, win);
 
   yield wait(500);
 
   ok(!isPopupOpened, "Autocompletion shouldn't be opened");
 }
 
--- a/devtools/client/sourceeditor/test/browser_editor_find_again.js
+++ b/devtools/client/sourceeditor/test/browser_editor_find_again.js
@@ -10,17 +10,18 @@ const L10N = new LocalizationHelper("dev
 
 const { OS } = Services.appinfo;
 
 // On linux, getting immediately the selection's range here fails, returning
 const FIND_KEY = L10N.getStr("find.key");
 const FINDNEXT_KEY = L10N.getStr("findNext.key");
 const FINDPREV_KEY = L10N.getStr("findPrev.key");
 // the replace's key with the appropriate modifiers based on OS
-const REPLACE_KEY = OS == "Darwin" ? L10N.getStr("replaceAllMac.key") : L10N.getStr("replaceAll.key");
+const REPLACE_KEY = OS == "Darwin" ? L10N.getStr("replaceAllMac.key")
+                                   : L10N.getStr("replaceAll.key");
 
 // values like it's not selected – even if the selection is visible.
 // For the record, setting the selection's range immediately doesn't have
 // any effect.
 // It's like the <input> is not ready yet.
 // Therefore, we trigger the UI focus event to the <input>, waiting for the
 // response.
 // Using a timeout could also work, but that is more precise, ensuring also
--- a/devtools/client/sourceeditor/test/cm_script_injection_test.js
+++ b/devtools/client/sourceeditor/test/cm_script_injection_test.js
@@ -1,8 +1,10 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
+/* global editor */
+
 "use strict";
 
 window.addEventListener("editorReady", function () {
   editor.setText("Script successfully injected!");
 });
--- a/devtools/client/sourceeditor/test/css_autocompletion_tests.json
+++ b/devtools/client/sourceeditor/test/css_autocompletion_tests.json
@@ -1,39 +1,43 @@
-// Test states to be tested for css state machine in css-autocompelter.js file.
-// Test cases are of the following format:
-// [
-//   [
-//     line, // The line location of the cursor
-//     ch    // The column locaiton of the cursor
-//   ],
-//   suggestions // Array of expected results
-// ]
-[
-  [[0, 10], []],
-  [[4,  7], ['.devtools-menulist', '.devtools-toolbarbutton']],
-  [[5,  8], ['-moz-animation', '-moz-animation-delay', '-moz-animation-direction',
-             '-moz-animation-duration', '-moz-animation-fill-mode',
-             '-moz-animation-iteration-count', '-moz-animation-name',
-             '-moz-animation-play-state', '-moz-animation-timing-function',
-             '-moz-appearance']],
-  [[12, 20], ['none', 'number-input']],
-  [[12, 22], ['none']],
-  [[17, 22], ['hsl', 'hsla']],
-  [[19, 10], ['background', 'background-attachment', 'background-blend-mode',
-              'background-clip', 'background-color', 'background-image',
-              'background-origin', 'background-position', 'background-position-x',
-              'background-position-y', 'background-repeat', 'background-size']],
-  [[21,  9], ["-moz-calc", "auto", "calc", "inherit", "initial","unset"]],
-  [[25, 26], ['.devtools-toolbarbutton > tab',
-              '.devtools-toolbarbutton > hbox',
-              '.devtools-toolbarbutton > .toolbarbutton-menubutton-button']],
-  [[25, 31], ['.devtools-toolbarbutton > hbox.toolbarbutton-menubutton-button']],
-  [[29, 20], ['.devtools-menulist:after', '.devtools-menulist:active']],
-  [[30, 10], ['#devtools-anotherone', '#devtools-itjustgoeson', '#devtools-menu',
-              '#devtools-okstopitnow', '#devtools-toolbarbutton', '#devtools-yetagain']],
-  [[39, 39], ['.devtools-toolbarbutton:not([label]) > tab']],
-  [[43, 51], ['.devtools-toolbarbutton:not([checked=true]):hover:after',
-              '.devtools-toolbarbutton:not([checked=true]):hover:active']],
-  [[58, 36], ['!important;']],
-  [[73, 42], [':lang(', ':last-of-type', ':link', ':last-child']],
-  [[77, 25], ['.visible']],
-]
+{
+  "description": [
+    "Test states to be tested for css state machine in css-autocompelter.js file.",
+    "Test cases are of the following format:",
+    "[",
+    "  [",
+    "    line, # The line location of the cursor",
+    "    ch    # The column locaiton of the cursor",
+    "  ],",
+    "  suggestions # Array of expected results",
+    "]"
+  ],
+  "tests": [
+    [[0, 10], []],
+    [[4,  7], [".devtools-menulist", ".devtools-toolbarbutton"]],
+    [[5,  8], ["-moz-animation", "-moz-animation-delay", "-moz-animation-direction",
+               "-moz-animation-duration", "-moz-animation-fill-mode",
+               "-moz-animation-iteration-count", "-moz-animation-name",
+               "-moz-animation-play-state", "-moz-animation-timing-function",
+               "-moz-appearance"]],
+    [[12, 20], ["none", "number-input"]],
+    [[12, 22], ["none"]],
+    [[17, 22], ["hsl", "hsla"]],
+    [[19, 10], ["background", "background-attachment", "background-blend-mode",
+                "background-clip", "background-color", "background-image",
+                "background-origin", "background-position", "background-position-x",
+                "background-position-y", "background-repeat", "background-size"]],
+    [[21,  9], ["-moz-calc", "auto", "calc", "inherit", "initial","unset"]],
+    [[25, 26], [".devtools-toolbarbutton > tab",
+                ".devtools-toolbarbutton > hbox",
+                ".devtools-toolbarbutton > .toolbarbutton-menubutton-button"]],
+    [[25, 31], [".devtools-toolbarbutton > hbox.toolbarbutton-menubutton-button"]],
+    [[29, 20], [".devtools-menulist:after", ".devtools-menulist:active"]],
+    [[30, 10], ["#devtools-anotherone", "#devtools-itjustgoeson", "#devtools-menu",
+                "#devtools-okstopitnow", "#devtools-toolbarbutton", "#devtools-yetagain"]],
+    [[39, 39], [".devtools-toolbarbutton:not([label]) > tab"]],
+    [[43, 51], [".devtools-toolbarbutton:not([checked=true]):hover:after",
+                ".devtools-toolbarbutton:not([checked=true]):hover:active"]],
+    [[58, 36], ["!important;"]],
+    [[73, 42], [":lang(", ":last-of-type", ":link", ":last-child"]],
+    [[77, 25], [".visible"]]
+  ]
+}
--- a/devtools/client/sourceeditor/test/css_statemachine_tests.json
+++ b/devtools/client/sourceeditor/test/css_statemachine_tests.json
@@ -1,84 +1,88 @@
-// Test states to be tested for css state machine in css-autocompelter.js file.
-// Test cases are of the following format:
-// [
-//   [
-//     line, // The line location of the cursor
-//     ch    // The column locaiton of the cursor
-//   ],
-//   [
-//     state,         // one of CSS_STATES
-//     selectorState, // one of SELECTOR_STATES
-//     completing,    // what is being completed
-//     propertyName,  // what property is being completed in case of value state
-//                    // or the current selector that is being completed
-//   ]
-// ]
-[
-  [[0, 10], ['null', '', '', '']],
-  [[4,  3], ['selector', 'class', 'de', '.de']],
-  [[5,  8], ['property', 'null', '-moz-a']],
-  [[5, 21], ['value', 'null', 'no', '-moz-appearance']],
-  [[6, 18], ['property', 'null', 'padding']],
-  [[6, 24], ['value', 'null', '3', 'padding']],
-  [[6, 29], ['property', 'null', 'bo']],
-  [[6, 50], ['value', 'null', '1p', 'border-bottom-width']],
-  [[7, 24], ['value', 'null', 's', 'border-bottom-style']],
-  [[9,  0], ['null', 'null', '', '']],
-  [[10, 6], ['selector', 'id', 'devto', '#devto']],
-  [[10, 17], ['selector', 'class', 'de', '#devtools-menu.de']],
-  [[11,  5], ['selector', 'class', 'devt', '.devt']],
-  [[11, 30], ['selector', 'id', 'devtoo', '.devtools-toolbarbutton#devtoo']],
-  [[12, 10], ['property', 'null', '-moz-app']],
-  [[16, 27], ['value', 'null', 'hsl', 'text-shadow']],
-  [[19, 24], ['value', 'null', 'linear-gra', 'background']],
-  [[19, 55], ['value', 'null', 'hsl', 'background']],
-  [[19, 79], ['value', 'null', 'paddin', 'background']],
-  [[20, 47], ['value', 'null', 'ins', 'box-shadow']],
-  [[22, 15], ['value', 'null', 'inheri', 'color']],
-  [[25, 26], ['selector', 'null', '', '.devtools-toolbarbutton > ']],
-  [[25, 28], ['selector', 'tag', 'hb', '.devtools-toolbarbutton > hb']],
-  [[25, 41], ['selector', 'class', 'toolbarbut', '.devtools-toolbarbutton > hbox.toolbarbut']],
-  [[29, 21], ['selector', 'pseudo', 'ac', '.devtools-menulist:ac']],
-  [[30, 27], ['selector', 'pseudo', 'foc', '#devtools-toolbarbutton:foc']],
-  [[31, 18], ['value', 'null', 'dot', 'outline']],
-  [[32, 25], ['value', 'null', '-4p', 'outline-offset']],
-  [[35, 26], ['selector', 'pseudo', 'no', '.devtools-toolbarbutton:no']],
-  [[35, 28], ['selector', 'null', 'not', '']],
-  [[35, 30], ['selector', 'attribute', 'l', '[l']],
-  [[39, 46], ['selector', 'class', 'toolba', '.devtools-toolbarbutton:not([label]) > .toolba']],
-  [[43, 39], ['selector', 'value', 'tr', '[checked=tr']],
-  [[43, 47], ['selector', 'pseudo', 'hov', '.devtools-toolbarbutton:not([checked=true]):hov']],
-  [[43, 53], ['selector', 'pseudo', 'act', '.devtools-toolbarbutton:not([checked=true]):hover:act']],
-  [[47, 22], ['selector', 'attribute', 'op', '.devtools-menulist[op']],
-  [[47, 33], ['selector', 'value', 'tr', '.devtools-menulist[open =tr']],
-  [[48, 38], ['selector', 'value', 'tr', '.devtools-toolbarbutton[open = tr']],
-  [[49, 40], ['selector', 'value', 'true', '.devtools-toolbarbutton[checked= true']],
-  [[53, 34], ['selector', 'value', '=', '.devtools-toolbarbutton[checked=']],
-  [[58, 38], ['value', 'null', '!impor', 'background-color']],
-  [[61, 41], ['selector', 'pseudo', 'hov', '.devtools-toolbarbutton[checked=true]:hov']],
-  [[65, 47], ['selector', 'class', 'to', '.devtools-toolbarbutton[type=menu-button] > .to']],
-  [[69, 44], ['selector', 'pseudo', 'first-of', '.devtools-sidebar-tabs > tabs > tab:first-of']],
-  [[73, 45], ['selector', 'pseudo', 'last', ':last']],
-  [[77, 27], ['selector', 'class', 'vis', '.vis']],
-  [[78, 34], ['selector', 'class', 'hidd', '.hidden-labels-box.visible ~ .hidd']],
-  [[83,  5], ['media', 'null', 'medi']],
-  [[83, 22], ['media', 'null', '800']],
-  [[84,  9], ['selector', 'class', 'catego', '.catego']],
-  [[89,  9], ['media', 'null', 'al']],
-  [[90,  6], ['selector', 'id', 'err', '#err']],
-  [[93, 11], ['property', 'null', 'backgro']],
-  [[98,  6], ['selector', 'tag', 'butt', 'butt']],
-  [[99, 22], ['value', 'null', '!impor', 'width']],
-  [[103, 5], ['keyframes', 'null', 'ke']],
-  [[104, 7], ['frame', 'null', 'fro']],
-  [[104, 15], ['property', 'null', 'opac']],
-  [[104, 29], ['property', 'null', 'transf']],
-  [[104, 38], ['value', 'null', 'scal', 'transform']],
-  [[105,  8], ['frame', 'null', '']],
-  [[113,  6], ['keyframes', 'null', 'keyfr']],
-  [[114,  4], ['frame', 'null', 'fr']],
-  [[115,  3], ['frame', 'null', '2']],
-  [[117,  8], ['property', 'null', 'opac']],
-  [[117, 16], ['value', 'null', '0', 'opacity']],
-  [[121,  0], ['null', '', '']],
-]
+{
+  "description": [
+    "Test states to be tested for css state machine in css-autocompleter.js file.",
+    "Test cases are of the following format:",
+    "[",
+    "  [",
+    "    line, // The line location of the cursor",
+    "    ch    // The column locaiton of the cursor",
+    "  ],",
+    "  [",
+    "    state,         // one of CSS_STATES",
+    "    selectorState, // one of SELECTOR_STATES",
+    "    completing,    // what is being completed",
+    "    propertyName,  // what property is being completed in case of value state",
+    "                   // or the current selector that is being completed",
+    "  ]",
+    "]"
+  ],
+  "tests": [
+    [[0, 10], ["null", "", "", ""]],
+    [[4,  3], ["selector", "class", "de", ".de"]],
+    [[5,  8], ["property", "null", "-moz-a"]],
+    [[5, 21], ["value", "null", "no", "-moz-appearance"]],
+    [[6, 18], ["property", "null", "padding"]],
+    [[6, 24], ["value", "null", "3", "padding"]],
+    [[6, 29], ["property", "null", "bo"]],
+    [[6, 50], ["value", "null", "1p", "border-bottom-width"]],
+    [[7, 24], ["value", "null", "s", "border-bottom-style"]],
+    [[9,  0], ["null", "null", "", ""]],
+    [[10, 6], ["selector", "id", "devto", "#devto"]],
+    [[10, 17], ["selector", "class", "de", "#devtools-menu.de"]],
+    [[11,  5], ["selector", "class", "devt", ".devt"]],
+    [[11, 30], ["selector", "id", "devtoo", ".devtools-toolbarbutton#devtoo"]],
+    [[12, 10], ["property", "null", "-moz-app"]],
+    [[16, 27], ["value", "null", "hsl", "text-shadow"]],
+    [[19, 24], ["value", "null", "linear-gra", "background"]],
+    [[19, 55], ["value", "null", "hsl", "background"]],
+    [[19, 79], ["value", "null", "paddin", "background"]],
+    [[20, 47], ["value", "null", "ins", "box-shadow"]],
+    [[22, 15], ["value", "null", "inheri", "color"]],
+    [[25, 26], ["selector", "null", "", ".devtools-toolbarbutton > "]],
+    [[25, 28], ["selector", "tag", "hb", ".devtools-toolbarbutton > hb"]],
+    [[25, 41], ["selector", "class", "toolbarbut", ".devtools-toolbarbutton > hbox.toolbarbut"]],
+    [[29, 21], ["selector", "pseudo", "ac", ".devtools-menulist:ac"]],
+    [[30, 27], ["selector", "pseudo", "foc", "#devtools-toolbarbutton:foc"]],
+    [[31, 18], ["value", "null", "dot", "outline"]],
+    [[32, 25], ["value", "null", "-4p", "outline-offset"]],
+    [[35, 26], ["selector", "pseudo", "no", ".devtools-toolbarbutton:no"]],
+    [[35, 28], ["selector", "null", "not", ""]],
+    [[35, 30], ["selector", "attribute", "l", "[l"]],
+    [[39, 46], ["selector", "class", "toolba", ".devtools-toolbarbutton:not([label]) > .toolba"]],
+    [[43, 39], ["selector", "value", "tr", "[checked=tr"]],
+    [[43, 47], ["selector", "pseudo", "hov", ".devtools-toolbarbutton:not([checked=true]):hov"]],
+    [[43, 53], ["selector", "pseudo", "act", ".devtools-toolbarbutton:not([checked=true]):hover:act"]],
+    [[47, 22], ["selector", "attribute", "op", ".devtools-menulist[op"]],
+    [[47, 33], ["selector", "value", "tr", ".devtools-menulist[open =tr"]],
+    [[48, 38], ["selector", "value", "tr", ".devtools-toolbarbutton[open = tr"]],
+    [[49, 40], ["selector", "value", "true", ".devtools-toolbarbutton[checked= true"]],
+    [[53, 34], ["selector", "value", "=", ".devtools-toolbarbutton[checked="]],
+    [[58, 38], ["value", "null", "!impor", "background-color"]],
+    [[61, 41], ["selector", "pseudo", "hov", ".devtools-toolbarbutton[checked=true]:hov"]],
+    [[65, 47], ["selector", "class", "to", ".devtools-toolbarbutton[type=menu-button] > .to"]],
+    [[69, 44], ["selector", "pseudo", "first-of", ".devtools-sidebar-tabs > tabs > tab:first-of"]],
+    [[73, 45], ["selector", "pseudo", "last", ":last"]],
+    [[77, 27], ["selector", "class", "vis", ".vis"]],
+    [[78, 34], ["selector", "class", "hidd", ".hidden-labels-box.visible ~ .hidd"]],
+    [[83,  5], ["media", "null", "medi"]],
+    [[83, 22], ["media", "null", "800"]],
+    [[84,  9], ["selector", "class", "catego", ".catego"]],
+    [[89,  9], ["media", "null", "al"]],
+    [[90,  6], ["selector", "id", "err", "#err"]],
+    [[93, 11], ["property", "null", "backgro"]],
+    [[98,  6], ["selector", "tag", "butt", "butt"]],
+    [[99, 22], ["value", "null", "!impor", "width"]],
+    [[103, 5], ["keyframes", "null", "ke"]],
+    [[104, 7], ["frame", "null", "fro"]],
+    [[104, 15], ["property", "null", "opac"]],
+    [[104, 29], ["property", "null", "transf"]],
+    [[104, 38], ["value", "null", "scal", "transform"]],
+    [[105,  8], ["frame", "null", ""]],
+    [[113,  6], ["keyframes", "null", "keyfr"]],
+    [[114,  4], ["frame", "null", "fr"]],
+    [[115,  3], ["frame", "null", "2"]],
+    [[117,  8], ["property", "null", "opac"]],
+    [[117, 16], ["value", "null", "0", "opacity"]],
+    [[121,  0], ["null", "", ""]]
+  ]
+}
\ No newline at end of file
--- a/devtools/client/sourceeditor/test/head.js
+++ b/devtools/client/sourceeditor/test/head.js
@@ -1,12 +1,15 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 /* import-globals-from ../../framework/test/shared-head.js */
+/* exported promiseWaitForFocus, setup, ch, teardown, loadHelperScript,
+            limit, ch, read, codemirrorSetStatus */
+
 "use strict";
 
 // shared-head.js handles imports, constants, and utility functions
 Services.scriptloader.loadSubScript(
   "chrome://mochitests/content/browser/devtools/client/framework/test/shared-head.js",
   this);
 
 const { NetUtil } = require("resource://gre/modules/NetUtil.jsm");
@@ -99,26 +102,26 @@ function loadHelperScript(filePath) {
   let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
   Services.scriptloader.loadSubScript(testDir + "/" + filePath, this);
 }
 
 /**
  * This method returns the portion of the input string `source` up to the
  * [line, ch] location.
  */
-function limit(source, [line, ch]) {
+function limit(source, [line, char]) {
   line++;
   let list = source.split("\n");
   if (list.length < line) {
     return source;
   }
   if (line == 1) {
-    return list[0].slice(0, ch);
+    return list[0].slice(0, char);
   }
-  return [...list.slice(0, line - 1), list[line - 1].slice(0, ch)].join("\n");
+  return [...list.slice(0, line - 1), list[line - 1].slice(0, char)].join("\n");
 }
 
 function read(url) {
   let scriptableStream = Cc["@mozilla.org/scriptableinputstream;1"]
     .getService(Ci.nsIScriptableInputStream);
 
   let channel = NetUtil.newChannel({
     uri: url,
--- a/devtools/client/sourceeditor/test/helper_codemirror_runner.js
+++ b/devtools/client/sourceeditor/test/helper_codemirror_runner.js
@@ -1,11 +1,13 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/* exported runCodeMirrorTest */
 /* globals codemirrorSetStatus */
 
 "use strict";
 
 function runCodeMirrorTest(browser) {
   let mm = browser.messageManager;
   mm.addMessageListener("setStatus", function listener({data}) {
     let {statusMsg, type, customMsg} = data;
@@ -19,20 +21,22 @@ function runCodeMirrorTest(browser) {
     mm = null;
     finish();
   });
 
   // Interact with the content iframe, giving it a function to
   //  1) Proxy CM test harness calls into ok() calls
   //  2) Detecting when it finishes by checking the DOM and
   //     setting a timeout to check again if not.
+  /* eslint-disable max-len */
   mm.loadFrameScript("data:," +
     "content.wrappedJSObject.mozilla_setStatus = function(statusMsg, type, customMsg) {" +
     "  sendSyncMessage('setStatus', {statusMsg: statusMsg, type: type, customMsg: customMsg});" +
     "};" +
     "function check() { " +
     "  var doc = content.document; var out = doc.getElementById('status'); " +
     "  if (!out || !out.classList.contains('done')) { return setTimeout(check, 100); }" +
     "  sendAsyncMessage('done', { failed: content.wrappedJSObject.failed });" +
     "}" +
     "check();"
   , true);
+  /* eslint-enable max-len */
 }