diff --git a/.eslintrc b/.eslintrc index 2c7ab90..f904bcb 100644 --- a/.eslintrc +++ b/.eslintrc @@ -40,7 +40,7 @@ "afterColon": true, "on": "colon" } }], - "keyword-spacing": [2, { "before": true, "after": false, "overrides" : { "else": { "after": true }} }], + "keyword-spacing": [2, { "before": true, "after": false, "overrides" : { "else": { "after": true }, "return" : { "after" : true } } }], "new-cap": [2, { "newIsCap": true, "capIsNew": false }], "new-parens": 2, "no-array-constructor": 2, diff --git a/test/addClassNameToNode.js b/test/addClassNameToNode.js index c80cbc1..f1781ce 100644 --- a/test/addClassNameToNode.js +++ b/test/addClassNameToNode.js @@ -2,14 +2,9 @@ const assert = require("assert"), - forEach = require("lodash/forEach"), - concat = require("lodash/concat"), - addClassNameToNode = require("../lib/addClassNameToNode"), - fixtures = require("./fixtures").addClassNameToNode, - - groups = require("../lib/groups"); + fixtures = require("./fixtures").addClassNameToNode; describe("/lib", () => { describe("/addClassNameToNode.js", () => { diff --git a/test/api.js b/test/api.js index da1fde1..2d36c8c 100644 --- a/test/api.js +++ b/test/api.js @@ -3,7 +3,6 @@ const assert = require("assert"), posthtml = require("posthtml"), - pseudo = require("../index"), fixtures = require("./fixtures"); @@ -16,14 +15,5 @@ describe("/lib", () => { assert.equal(result.html, fixtures.basic.expected); }) ); - - // it("should run posthtml with pseudo", () => - // posthtml() - // .use(pseudo()) - // .process(fixtures.groups.all.input) - // .then((result) => { - // assert.equal(result.html, fixtures.groups.all.expected); - // }) - // ); }); }); diff --git a/test/fixtures/addClassNameToNode/emptyClass.js b/test/fixtures/addClassNameToNode/emptyClass.js index bd419fe..a7fd31d 100644 --- a/test/fixtures/addClassNameToNode/emptyClass.js +++ b/test/fixtures/addClassNameToNode/emptyClass.js @@ -2,39 +2,39 @@ module.exports = { input : { - tag: "a", - attrs: { - href: "#", - class: "" + tag : "a", + attrs : { + href : "#", + class : "" }, - content: [ + content : [ "\n ", - { - tag: "span", - attrs: { - class: "animals__cat", - style: "background: url(cat.png)" + { + tag : "span", + attrs : { + class : "animals__cat", + style : "background: url(cat.png)" }, - content: ["Cat"] + content : ["Cat"] }, "\n" ] }, expected : { - tag: "a", - attrs: { - class: ":test", - href: "#" + tag : "a", + attrs : { + class : ":test", + href : "#" }, - content: [ + content : [ "\n ", - { - tag: "span", - attrs: { - class: "animals__cat", - style: "background: url(cat.png)" + { + tag : "span", + attrs : { + class : "animals__cat", + style : "background: url(cat.png)" }, - content: ["Cat"] + content : ["Cat"] }, "\n" ] diff --git a/test/fixtures/addClassNameToNode/endClass.js b/test/fixtures/addClassNameToNode/endClass.js index 3bb799e..01e2490 100644 --- a/test/fixtures/addClassNameToNode/endClass.js +++ b/test/fixtures/addClassNameToNode/endClass.js @@ -2,39 +2,39 @@ module.exports = { input : { - tag: "a", - attrs: { - href: "#", - class: "something" + tag : "a", + attrs : { + href : "#", + class : "something" }, - content: [ + content : [ "\n ", - { - tag: "span", - attrs: { - class: "animals__cat", - style: "background: url(cat.png)" + { + tag : "span", + attrs : { + class : "animals__cat", + style : "background: url(cat.png)" }, - content: ["Cat"] + content : ["Cat"] }, "\n" ] }, expected : { - tag: "a", - attrs: { - class: "something :test", - href: "#" + tag : "a", + attrs : { + class : "something :test", + href : "#" }, - content: [ + content : [ "\n ", - { - tag: "span", - attrs: { - class: "animals__cat", - style: "background: url(cat.png)" + { + tag : "span", + attrs : { + class : "animals__cat", + style : "background: url(cat.png)" }, - content: ["Cat"] + content : ["Cat"] }, "\n" ] diff --git a/test/fixtures/addClassNameToNode/noClass.js b/test/fixtures/addClassNameToNode/noClass.js index b7734ae..4ef57b5 100644 --- a/test/fixtures/addClassNameToNode/noClass.js +++ b/test/fixtures/addClassNameToNode/noClass.js @@ -2,38 +2,38 @@ module.exports = { input : { - tag: "a", - attrs: { - href: "#" + tag : "a", + attrs : { + href : "#" }, - content: [ + content : [ "\n ", - { - tag: "span", - attrs: { - class: "animals__cat", - style: "background: url(cat.png)" + { + tag : "span", + attrs : { + class : "animals__cat", + style : "background: url(cat.png)" }, - content: ["Cat"] + content : ["Cat"] }, "\n" ] }, expected : { - tag: "a", - attrs: { - class: ":test", - href: "#" + tag : "a", + attrs : { + class : ":test", + href : "#" }, - content: [ + content : [ "\n ", - { - tag: "span", - attrs: { - class: "animals__cat", - style: "background: url(cat.png)" + { + tag : "span", + attrs : { + class : "animals__cat", + style : "background: url(cat.png)" }, - content: ["Cat"] + content : ["Cat"] }, "\n" ] diff --git a/test/fixtures/addClassNameToNode/sortClass1.js b/test/fixtures/addClassNameToNode/sortClass1.js index 07858a3..111b6e3 100644 --- a/test/fixtures/addClassNameToNode/sortClass1.js +++ b/test/fixtures/addClassNameToNode/sortClass1.js @@ -2,39 +2,39 @@ module.exports = { input : { - tag: "a", - attrs: { - href: "#", - class: "something :first-child" + tag : "a", + attrs : { + href : "#", + class : "something :first-child" }, - content: [ + content : [ "\n ", - { - tag: "span", - attrs: { - class: "animals__cat", - style: "background: url(cat.png)" + { + tag : "span", + attrs : { + class : "animals__cat", + style : "background: url(cat.png)" }, - content: ["Cat"] + content : ["Cat"] }, "\n" ] }, expected : { - tag: "a", - attrs: { - class: "something :first-child :first-of-type", - href: "#" + tag : "a", + attrs : { + class : "something :first-child :first-of-type", + href : "#" }, - content: [ + content : [ "\n ", - { - tag: "span", - attrs: { - class: "animals__cat", - style: "background: url(cat.png)" + { + tag : "span", + attrs : { + class : "animals__cat", + style : "background: url(cat.png)" }, - content: ["Cat"] + content : ["Cat"] }, "\n" ] diff --git a/test/fixtures/addClassNameToNode/sortClass2.js b/test/fixtures/addClassNameToNode/sortClass2.js index 44f31ae..76edfe9 100644 --- a/test/fixtures/addClassNameToNode/sortClass2.js +++ b/test/fixtures/addClassNameToNode/sortClass2.js @@ -2,39 +2,39 @@ module.exports = { input : { - tag: "a", - attrs: { - href: "#", - class: "something :first-of-type" + tag : "a", + attrs : { + href : "#", + class : "something :first-of-type" }, - content: [ + content : [ "\n ", - { - tag: "span", - attrs: { - class: "animals__cat", - style: "background: url(cat.png)" + { + tag : "span", + attrs : { + class : "animals__cat", + style : "background: url(cat.png)" }, - content: ["Cat"] + content : ["Cat"] }, "\n" ] }, expected : { - tag: "a", - attrs: { - class: "something :first-child :first-of-type", - href: "#" + tag : "a", + attrs : { + class : "something :first-child :first-of-type", + href : "#" }, - content: [ + content : [ "\n ", - { - tag: "span", - attrs: { - class: "animals__cat", - style: "background: url(cat.png)" + { + tag : "span", + attrs : { + class : "animals__cat", + style : "background: url(cat.png)" }, - content: ["Cat"] + content : ["Cat"] }, "\n" ] diff --git a/test/fixtures/addClassNameToNode/sortClass3.js b/test/fixtures/addClassNameToNode/sortClass3.js index ef71131..3af886d 100644 --- a/test/fixtures/addClassNameToNode/sortClass3.js +++ b/test/fixtures/addClassNameToNode/sortClass3.js @@ -2,39 +2,39 @@ module.exports = { input : { - tag: "a", - attrs: { - href: "#", - class: "something :last-child" + tag : "a", + attrs : { + href : "#", + class : "something :last-child" }, - content: [ + content : [ "\n ", - { - tag: "span", - attrs: { - class: "animals__cat", - style: "background: url(cat.png)" + { + tag : "span", + attrs : { + class : "animals__cat", + style : "background: url(cat.png)" }, - content: ["Cat"] + content : ["Cat"] }, "\n" ] }, expected : { - tag: "a", - attrs: { - class: "something :first-child :last-child", - href: "#" + tag : "a", + attrs : { + class : "something :first-child :last-child", + href : "#" }, - content: [ + content : [ "\n ", - { - tag: "span", - attrs: { - class: "animals__cat", - style: "background: url(cat.png)" + { + tag : "span", + attrs : { + class : "animals__cat", + style : "background: url(cat.png)" }, - content: ["Cat"] + content : ["Cat"] }, "\n" ]