Add test suite
This commit is contained in:
Родитель
e870d3c93c
Коммит
2a82e80be7
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
12
package.json
12
package.json
|
@ -7,10 +7,11 @@
|
|||
"module": "dist/index.esm.js",
|
||||
"scripts": {
|
||||
"clean": "rm -rf dist",
|
||||
"lint": "eslint src/ && flow check",
|
||||
"lint": "eslint src/ test/ && flow check",
|
||||
"prebuild": "npm run clean && npm run lint",
|
||||
"build": "rollup -c && cp src/clipboard-copy-element.js.flow dist/index.esm.js.flow && cp src/clipboard-copy-element.js.flow dist/index.umd.js.flow",
|
||||
"test": "npm run lint",
|
||||
"pretest": "npm run build",
|
||||
"test": "karma start test/karma.config.js",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"keywords": [
|
||||
|
@ -25,9 +26,16 @@
|
|||
"babel-plugin-transform-custom-element-classes": "^0.1.0",
|
||||
"babel-preset-es2015-rollup": "^3.0.0",
|
||||
"babel-preset-flow": "^6.23.0",
|
||||
"chai": "^4.1.2",
|
||||
"eslint": "^4.19.0",
|
||||
"eslint-plugin-github": "^0.24.0",
|
||||
"flow-bin": "^0.68.0",
|
||||
"karma": "^2.0.0",
|
||||
"karma-chai": "^0.1.0",
|
||||
"karma-chrome-launcher": "^2.2.0",
|
||||
"karma-mocha": "^1.3.0",
|
||||
"karma-mocha-reporter": "^2.2.5",
|
||||
"mocha": "^5.1.0",
|
||||
"rollup": "^0.57.1",
|
||||
"rollup-plugin-babel": "^3.0.3"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"rules": {
|
||||
"flowtype/require-valid-file-annotation": "off"
|
||||
},
|
||||
"env": {
|
||||
"mocha": true
|
||||
},
|
||||
"globals": {
|
||||
"assert": true
|
||||
},
|
||||
"extends": "../.eslintrc.json"
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
module.exports = function(config) {
|
||||
config.set({
|
||||
frameworks: ['mocha', 'chai'],
|
||||
files: ['../dist/index.umd.js', 'test.js'],
|
||||
reporters: ['mocha'],
|
||||
port: 9876,
|
||||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
browsers: ['ChromeHeadless'],
|
||||
autoWatch: false,
|
||||
singleRun: true,
|
||||
concurrency: Infinity
|
||||
})
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
describe('clipboard-copy element', function() {
|
||||
describe('element creation', function() {
|
||||
it('creates from document.createElement', function() {
|
||||
const el = document.createElement('clipboard-copy')
|
||||
assert.equal('CLIPBOARD-COPY', el.nodeName)
|
||||
assert(el instanceof window.ClipboardCopyElement)
|
||||
})
|
||||
|
||||
it('creates from constructor', function() {
|
||||
const el = new window.ClipboardCopyElement()
|
||||
assert.equal('CLIPBOARD-COPY', el.nodeName)
|
||||
})
|
||||
})
|
||||
})
|
Загрузка…
Ссылка в новой задаче