1
1
mirror of https://github.com/primer/css.git synced 2025-01-01 18:53:34 +03:00

Updating test, and adding to all modules

This commit is contained in:
Jon Rohan 2017-07-25 14:52:18 -07:00
parent 6e073f1b9a
commit f321b410c7
22 changed files with 106 additions and 27 deletions

View File

@ -17,15 +17,18 @@
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"ava": "ava --verbose \"../../tests/modules/test-*.js\"",
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm run build && npm run lint && npm run ava"
},
"dependencies": {
"primer-support": "^4.1.0"
},
"devDependencies": {
"ava": "^0.21.0",
"glob": "^7.1.2",
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"

View File

@ -17,15 +17,18 @@
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"ava": "ava --verbose \"../../tests/modules/test-*.js\"",
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm run build && npm run lint && npm run ava"
},
"dependencies": {
"primer-support": "^4.1.0"
},
"devDependencies": {
"ava": "^0.21.0",
"glob": "^7.1.2",
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"

View File

@ -17,15 +17,18 @@
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"ava": "ava --verbose \"../../tests/modules/test-*.js\"",
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm run build && npm run lint && npm run ava"
},
"dependencies": {
"primer-support": "^4.1.0"
},
"devDependencies": {
"ava": "^0.21.0",
"glob": "^7.1.2",
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"

View File

@ -17,15 +17,18 @@
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"ava": "ava --verbose \"../../tests/modules/test-*.js\"",
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm run build && npm run lint && npm run ava"
},
"dependencies": {
"primer-support": "^4.1.0"
},
"devDependencies": {
"ava": "^0.21.0",
"glob": "^7.1.2",
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"

View File

@ -17,16 +17,19 @@
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"ava": "ava --verbose \"../../tests/modules/test-*.js\"",
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm run build && npm run lint && npm run ava"
},
"dependencies": {
"primer-marketing-support": "^1.1.0",
"primer-support": "^4.1.0"
},
"devDependencies": {
"ava": "^0.21.0",
"glob": "^7.1.2",
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"

View File

@ -17,15 +17,18 @@
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"ava": "ava --verbose \"../../tests/modules/test-*.js\"",
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm run build && npm run lint && npm run ava"
},
"dependencies": {
"primer-support": "^4.1.0"
},
"devDependencies": {
"ava": "^0.21.0",
"glob": "^7.1.2",
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"

View File

@ -17,16 +17,19 @@
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"ava": "ava --verbose \"../../tests/modules/test-*.js\"",
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm run build && npm run lint && npm run ava"
},
"dependencies": {
"primer-marketing-support": "^1.1.0",
"primer-support": "^4.1.0"
},
"devDependencies": {
"ava": "^0.21.0",
"glob": "^7.1.2",
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"

View File

@ -17,15 +17,18 @@
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"ava": "ava --verbose \"../../tests/modules/test-*.js\"",
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm run build && npm run lint && npm run ava"
},
"dependencies": {
"primer-support": "^4.1.0"
},
"devDependencies": {
"ava": "^0.21.0",
"glob": "^7.1.2",
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"

View File

@ -17,15 +17,18 @@
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"ava": "ava --verbose \"../../tests/modules/test-*.js\"",
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm run build && npm run lint && npm run ava"
},
"dependencies": {
"primer-support": "^4.1.0"
},
"devDependencies": {
"ava": "^0.21.0",
"glob": "^7.1.2",
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"

View File

@ -17,15 +17,18 @@
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"ava": "ava --verbose \"../../tests/modules/test-*.js\"",
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm run build && npm run lint && npm run ava"
},
"dependencies": {
"primer-support": "^4.1.0"
},
"devDependencies": {
"ava": "^0.21.0",
"glob": "^7.1.2",
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"

View File

@ -17,15 +17,18 @@
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"ava": "ava --verbose \"../../tests/modules/test-*.js\"",
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm run build && npm run lint && npm run ava"
},
"dependencies": {
"primer-support": "^4.1.0"
},
"devDependencies": {
"ava": "^0.21.0",
"glob": "^7.1.2",
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"

View File

@ -17,16 +17,19 @@
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"ava": "ava --verbose \"../../tests/modules/test-*.js\"",
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm run build && npm run lint && npm run ava"
},
"dependencies": {
"primer-marketing-support": "^1.1.0",
"primer-support": "^4.1.0"
},
"devDependencies": {
"ava": "^0.21.0",
"glob": "^7.1.2",
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"

View File

@ -17,16 +17,19 @@
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"ava": "ava --verbose \"../../tests/modules/test-*.js\"",
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm run build && npm run lint && npm run ava"
},
"dependencies": {
"primer-marketing-support": "^1.1.0",
"primer-support": "^4.1.0"
},
"devDependencies": {
"ava": "^0.21.0",
"glob": "^7.1.2",
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"

View File

@ -17,15 +17,18 @@
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"ava": "ava --verbose \"../../tests/modules/test-*.js\"",
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm run build && npm run lint && npm run ava"
},
"dependencies": {
"primer-support": "^4.1.0"
},
"devDependencies": {
"ava": "^0.21.0",
"glob": "^7.1.2",
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"

View File

@ -17,16 +17,19 @@
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"ava": "ava --verbose \"../../tests/modules/test-*.js\"",
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm run build && npm run lint && npm run ava"
},
"dependencies": {
"primer-marketing-support": "^1.1.0",
"primer-support": "^4.1.0"
},
"devDependencies": {
"ava": "^0.21.0",
"glob": "^7.1.2",
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"

View File

@ -17,12 +17,15 @@
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"ava": "ava --verbose \"../../tests/modules/test-*.js\"",
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm run build && npm run lint && npm run ava"
},
"dependencies": {
"ava": "^0.21.0",
"glob": "^7.1.2",
"primer-marketing-support": "^1.1.0",
"primer-support": "^4.1.0"
},

View File

@ -17,15 +17,18 @@
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"ava": "ava --verbose \"../../tests/modules/test-*.js\"",
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm run build && npm run lint && npm run ava"
},
"dependencies": {
"primer-support": "^4.1.0"
},
"devDependencies": {
"ava": "^0.21.0",
"glob": "^7.1.2",
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"

View File

@ -17,16 +17,19 @@
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"ava": "ava --verbose \"../../tests/modules/test-*.js\"",
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm run build && npm run lint && npm run ava"
},
"dependencies": {
"primer-marketing-support": "^1.1.0",
"primer-support": "^4.1.0"
},
"devDependencies": {
"ava": "^0.21.0",
"glob": "^7.1.2",
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"

View File

@ -17,15 +17,18 @@
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"ava": "ava --verbose \"../../tests/modules/test-*.js\"",
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm run build && npm run lint && npm run ava"
},
"dependencies": {
"primer-support": "^4.1.0"
},
"devDependencies": {
"ava": "^0.21.0",
"glob": "^7.1.2",
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"

View File

@ -17,15 +17,18 @@
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"ava": "ava --verbose \"../../tests/modules/test-*.js\"",
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm run build && npm run lint && npm run ava"
},
"dependencies": {
"primer-support": "^4.1.0"
},
"devDependencies": {
"ava": "^0.21.0",
"glob": "^7.1.2",
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"

View File

@ -17,15 +17,18 @@
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"ava": "ava --verbose \"../../tests/modules/test-*.js\"",
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm run build && npm run lint && npm run ava"
},
"dependencies": {
"primer-support": "^4.1.0"
},
"devDependencies": {
"ava": "^0.21.0",
"glob": "^7.1.2",
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"

View File

@ -1,12 +1,15 @@
const test = require("ava")
const css = require(process.env.PWD)
const fs = require("fs")
const glob = require("glob")
var selectors, classnames = null
const classRegex = /class="([^"]+)"/ig
function uniqueSelectors(s) {
return s.filter(s => {
// remove any selectors with hover states
return !s.includes(":")
return !s.includes(":") && !s.includes(".")
}).map(s => {
// split multi-selectors into last class used .foo .bar .baz
return s.split(" ").pop()
@ -14,7 +17,16 @@ function uniqueSelectors(s) {
}
function documentedClassnames(sources) {
return sources
var cn = []
sources.forEach( f => {
glob.sync(f).forEach( g => {
var match = null
while ((match = classRegex.exec(fs.readFileSync(g).toString())) != null) {
cn = cn.concat(match[1].split(" "))
}
})
})
return [...new Set(cn)]
}
test.before(async t => {
@ -25,8 +37,12 @@ test.before(async t => {
])
})
test("builds test css", t => {
console.log(selectors);
console.log(classnames);
t.truthy(false)
test("Every selector class is documented", t => {
var undocumented = []
selectors.forEach( selector => {
if (!classnames.includes(selector.replace(".", ""))) {
undocumented.push(selector)
}
})
t.is(undocumented.length, 0, `I did not find documentation for the "${undocumented.join(", ")}" selector(s) in the ${process.env.npm_package_name} module.`);
})