mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
parent
1de88fb939
commit
dd5e2eefa9
@ -11,12 +11,13 @@ var ISNTALL_COMPONENT_TEMPLATE = ' Vue.component({{name}}.name, {{name}});';
|
||||
var MAIN_TEMPLATE = `{{include}}
|
||||
|
||||
const install = function(Vue) {
|
||||
/* istanbul ignore if */
|
||||
if (install.installed) return;
|
||||
|
||||
{{install}}
|
||||
};
|
||||
|
||||
// auto install
|
||||
/* istanbul ignore if */
|
||||
if (typeof window !== 'undefined' && window.Vue) {
|
||||
install(window.Vue);
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ import SwipeItem from '../packages/swipe-item/index.js';
|
||||
import DatetimePicker from '../packages/datetime-picker/index.js';
|
||||
|
||||
const install = function(Vue) {
|
||||
/* istanbul ignore if */
|
||||
if (install.installed) return;
|
||||
|
||||
Vue.component(Button.name, Button);
|
||||
@ -73,7 +74,7 @@ const install = function(Vue) {
|
||||
Vue.component(DatetimePicker.name, DatetimePicker);
|
||||
};
|
||||
|
||||
// auto install
|
||||
/* istanbul ignore if */
|
||||
if (typeof window !== 'undefined' && window.Vue) {
|
||||
install(window.Vue);
|
||||
}
|
||||
|
@ -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/,
|
||||
exclude: /node_modules|vue-router\/|vue-loader\/|vue-hot-reload-api\/|docs|test|src\/index|packages\/swipe/,
|
||||
use: ['isparta-loader']
|
||||
},
|
||||
{
|
||||
@ -76,7 +76,7 @@ const webpackConfig = {
|
||||
}]
|
||||
},
|
||||
{
|
||||
test: /test\/unit\/components\/.*\.vue$/,
|
||||
test: /test\/unit\/components\/.*\.vue$|packages\/swipe\/.*\.vue$/,
|
||||
use: [{
|
||||
loader: 'vue-loader',
|
||||
options: {
|
||||
@ -92,6 +92,7 @@ const webpackConfig = {
|
||||
},
|
||||
{
|
||||
test: /packages\/.*\.vue$/,
|
||||
exclude: /packages\/swipe/,
|
||||
use: [{
|
||||
loader: 'vue-loader',
|
||||
options: {
|
||||
|
31
test/unit/specs/utils.dom.spec.js
Normal file
31
test/unit/specs/utils.dom.spec.js
Normal file
@ -0,0 +1,31 @@
|
||||
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);
|
||||
});
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user