From 7b4bdf4adfa3e55f5d5a06de30fa8cdab1997c73 Mon Sep 17 00:00:00 2001 From: Swagatam Mitra Date: Wed, 26 Apr 2017 14:04:18 +0530 Subject: [PATCH] Fix for eslint errors --- .../default/CSSAtRuleCodeHints/unittests.js | 29 +++++++------ .../CSSPseudoSelectorHints/unittests.js | 43 ++++++++++--------- 2 files changed, 37 insertions(+), 35 deletions(-) diff --git a/src/extensions/default/CSSAtRuleCodeHints/unittests.js b/src/extensions/default/CSSAtRuleCodeHints/unittests.js index 77d408c85..3044c706c 100644 --- a/src/extensions/default/CSSAtRuleCodeHints/unittests.js +++ b/src/extensions/default/CSSAtRuleCodeHints/unittests.js @@ -121,7 +121,7 @@ define(function (require, exports, module) { return modesToTest[modeCounter]; }; - describe("'@' rules in CSS mode (selection of correct restricted block based on input)", function () { + describe("'@' rules in styles mode (selection of correct restricted block based on input)", function () { beforeEach(function () { // create Editor instance (containing a CodeMirror instance) @@ -136,9 +136,7 @@ define(function (require, exports, module) { testDocument = null; }); - for (modeCounter in modesToTest) { - - it("should list all rule hints right after @", function () { + var testAllHints = function () { testEditor.setCursorPos({ line: 0, ch: 1 }); // after @ var hintList = expectHints(CSSAtRuleCodeHints.restrictedBlockHints); verifyFirstEntry(hintList, "@charset"); // filtered on "empty string" @@ -150,24 +148,27 @@ define(function (require, exports, module) { "@namespace", "@page", "@supports"]); - }); - - it("should list filtered rule hints right after @m", function () { + }, + testFilteredHints = function () { testEditor.setCursorPos({ line: 3, ch: 2 }); // after @m var hintList = expectHints(CSSAtRuleCodeHints.restrictedBlockHints); verifyFirstEntry(hintList, "@media"); // filtered on "@m" verifyListsAreIdentical(hintList, ["@media"]); - }); - - it("should not list rule hints on space", function () { + }, + testNoHintsOnSpace = function () { testEditor.setCursorPos({ line: 3, ch: 3 }); // after { expect(CSSAtRuleCodeHints.restrictedBlockHints.hasHints(testEditor, '')).toBe(false); - }); - - it("should not list rule hints if the cursor is before @", function () { + }, + testNoHints = function () { testEditor.setCursorPos({ line: 0, ch: 0 }); // after { expect(CSSAtRuleCodeHints.restrictedBlockHints.hasHints(testEditor, 'c')).toBe(false); - }); + }; + + for (modeCounter in modesToTest) { + it("should list all rule hints right after @", testAllHints); + it("should list filtered rule hints right after @m", testFilteredHints); + it("should not list rule hints on space", testNoHintsOnSpace); + it("should not list rule hints if the cursor is before @", testNoHints); } }); diff --git a/src/extensions/default/CSSPseudoSelectorHints/unittests.js b/src/extensions/default/CSSPseudoSelectorHints/unittests.js index f5c658a97..17c86f1ca 100644 --- a/src/extensions/default/CSSPseudoSelectorHints/unittests.js +++ b/src/extensions/default/CSSPseudoSelectorHints/unittests.js @@ -127,7 +127,6 @@ define(function (require, exports, module) { }; describe("Pseudo selectors in different style modes", function () { - beforeEach(function () { // create Editor instance (containing a CodeMirror instance) var mock = SpecRunnerUtils.createMockEditor(defaultContent, selectMode()); @@ -141,17 +140,14 @@ define(function (require, exports, module) { testDocument = null; }); - for (modeCounter in modesToTest) { - - it("should list all Pseudo selectors right after :", function () { + var testAllHints = function () { testEditor.setCursorPos({ line: 0, ch: 11 }); // after : var hintList = expectHints(CSSPseudoSelectorCodeHints.pseudoSelectorHints); console.log(JSON.stringify(hintList)); verifyFirstEntry(hintList, "active"); // filtered on "empty string" verifyListsAreIdentical(hintList, Object.keys(PseudoStaticData.selectors).sort()); - }); - - it("should list filtered pseudo selectors right after :n", function () { + }, + testFilteredHints = function () { testEditor.setCursorPos({ line: 4, ch: 12 }); // after :n var hintList = expectHints(CSSPseudoSelectorCodeHints.pseudoSelectorHints); console.log(JSON.stringify(hintList)); @@ -161,12 +157,16 @@ define(function (require, exports, module) { "nth-last-child(n)", "nth-last-of-type(n)", "nth-of-type(n)"]); - }); - - it("should not list rule hints if the cursor is before :", function () { + }, + testNoHints = function () { testEditor.setCursorPos({ line: 0, ch: 10 }); // after { expect(CSSPseudoSelectorCodeHints.pseudoSelectorHints.hasHints(testEditor, 'a')).toBe(false); - }); + }; + + for (modeCounter in modesToTest) { + it("should list all Pseudo selectors right after :", testAllHints); + it("should list filtered pseudo selectors right after :n", testFilteredHints); + it("should not list rule hints if the cursor is before :", testNoHints); } }); @@ -186,29 +186,30 @@ define(function (require, exports, module) { testDocument = null; }); - for (modeCounter in modesToTest) { - - it("should list all Pseudo selectors right after :", function () { + var testAllHints = function () { testEditor.setCursorPos({ line: 2, ch: 12 }); // after :: var hintList = expectHints(CSSPseudoSelectorCodeHints.pseudoSelectorHints); console.log(JSON.stringify(hintList)); verifyFirstEntry(hintList, "after"); // filtered on "empty string" verifyListsAreIdentical(hintList, Object.keys(PseudoStaticData.elements).sort()); - }); - - it("should list filtered pseudo selectors right after ::f", function () { + }, + testFilteredHints = function () { testEditor.setCursorPos({ line: 6, ch: 13 }); // after ::f var hintList = expectHints(CSSPseudoSelectorCodeHints.pseudoSelectorHints); console.log(JSON.stringify(hintList)); verifyFirstEntry(hintList, "first-letter"); // filtered on "f" verifyListsAreIdentical(hintList, ["first-letter", "first-line"]); - }); - - it("should not list rule hints if the cursor is before :", function () { + }, + testNoHints = function () { testEditor.setCursorPos({ line: 2, ch: 10 }); // after ::f expect(CSSPseudoSelectorCodeHints.pseudoSelectorHints.hasHints(testEditor, 'c')).toBe(false); - }); + }; + + for (modeCounter in modesToTest) { + it("should list all Pseudo selectors right after :", testAllHints); + it("should list filtered pseudo selectors right after ::f", testFilteredHints); + it("should not list rule hints if the cursor is before :", testNoHints); } });