This commit is contained in:
David Graham 2018-04-17 14:10:02 -06:00
Родитель e870d3c93c
Коммит 2a82e80be7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: AA9405DCE2E0D208
5 изменённых файлов: 3628 добавлений и 9 удалений

3585
package-lock.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"
}

12
test/.eslintrc.json Normal file
Просмотреть файл

@ -0,0 +1,12 @@
{
"rules": {
"flowtype/require-valid-file-annotation": "off"
},
"env": {
"mocha": true
},
"globals": {
"assert": true
},
"extends": "../.eslintrc.json"
}

14
test/karma.config.js Normal file
Просмотреть файл

@ -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
})
}

14
test/test.js Normal file
Просмотреть файл

@ -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)
})
})
})