From fab9682e9aa8bc1f60e5dddd42e7e8dc1ca2944b Mon Sep 17 00:00:00 2001 From: Yao Date: Tue, 25 Apr 2017 20:39:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95=20?= =?UTF-8?q?=E6=8E=92=E9=99=A4src/=E7=9B=AE=E5=BD=95=20(#13)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * unit test exclude src/ --- package.json | 2 +- test/unit/get-webpack-conf.js | 2 +- test/unit/specs/utils.dom.spec.js | 31 ------------------------------- 3 files changed, 2 insertions(+), 33 deletions(-) delete mode 100644 test/unit/specs/utils.dom.spec.js diff --git a/package.json b/package.json index 13abf5833..374306b19 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "clean": "rimraf lib && rimraf packages/*/lib", "lint": "felint lint src/**/*.js packages/**/*.{js,vue} build/**/*.js", "test": "karma start test/unit/karma.conf.js --single-run", - "test:coverage": "find test/unit/coverage/lcov-report -name 'index.html' | sed -n 1,1p | xargs -I {} open {} ", + "test:coverage": "open test/unit/coverage/lcov-report/index.html", "test:watch": "karma start test/unit/karma.conf.js", "release": "npm run bootstrap && sh build/release.sh" }, diff --git a/test/unit/get-webpack-conf.js b/test/unit/get-webpack-conf.js index d1f22f309..4e0059db4 100644 --- a/test/unit/get-webpack-conf.js +++ b/test/unit/get-webpack-conf.js @@ -47,7 +47,7 @@ const webpackConfig = { { enforce: 'pre', test: /\.js$/, - exclude: /node_modules|vue-router\/|vue-loader\/|vue-hot-reload-api\/|docs|test|src\/index|packages\/swipe/, + exclude: /node_modules|vue-router\/|vue-loader\/|vue-hot-reload-api\/|docs|test|src\/index|src\/utils|src\/mixins|packages\/swipe/, use: ['isparta-loader'] }, { diff --git a/test/unit/specs/utils.dom.spec.js b/test/unit/specs/utils.dom.spec.js deleted file mode 100644 index fd8258501..000000000 --- a/test/unit/specs/utils.dom.spec.js +++ /dev/null @@ -1,31 +0,0 @@ -import { hasClass, addClass, removeClass } from 'src/utils/dom'; - -describe('Utils Dom', () => { - let wrapper; - beforeEach(() => { - wrapper = document.createElement('div'); - wrapper.classList.add('test-class'); - document.body.appendChild(wrapper); - }); - - afterEach(() => { - document.body.removeChild(wrapper); - }); - - it('hasClass', () => { - expect(hasClass(wrapper, 'test-class')).to.be.true; - expect(hasClass()).to.be.false; - }); - - it('addClass and removeClass', () => { - expect(hasClass(wrapper, 'test-class')).to.be.true; - - addClass(wrapper, ' other-class'); - expect(hasClass(wrapper, 'other-class')).to.be.true; - expect(addClass()).to.equal(undefined); - - removeClass(wrapper, ' other-class'); - expect(hasClass(wrapper, 'other-class')).to.be.false; - expect(removeClass()).to.equal(undefined); - }); -});