单元测试 排除src/目录 (#13)

* unit test exclude src/
This commit is contained in:
Yao
2017-04-25 20:39:18 +08:00
committed by GitHub
parent 13d6935b1a
commit fab9682e9a
3 changed files with 2 additions and 33 deletions

View File

@@ -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']
},
{

View File

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