mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-23 09:52:57 +08:00
parent
1de88fb939
commit
dd5e2eefa9
@ -11,12 +11,13 @@ var ISNTALL_COMPONENT_TEMPLATE = ' Vue.component({{name}}.name, {{name}});';
|
|||||||
var MAIN_TEMPLATE = `{{include}}
|
var MAIN_TEMPLATE = `{{include}}
|
||||||
|
|
||||||
const install = function(Vue) {
|
const install = function(Vue) {
|
||||||
|
/* istanbul ignore if */
|
||||||
if (install.installed) return;
|
if (install.installed) return;
|
||||||
|
|
||||||
{{install}}
|
{{install}}
|
||||||
};
|
};
|
||||||
|
|
||||||
// auto install
|
/* istanbul ignore if */
|
||||||
if (typeof window !== 'undefined' && window.Vue) {
|
if (typeof window !== 'undefined' && window.Vue) {
|
||||||
install(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';
|
import DatetimePicker from '../packages/datetime-picker/index.js';
|
||||||
|
|
||||||
const install = function(Vue) {
|
const install = function(Vue) {
|
||||||
|
/* istanbul ignore if */
|
||||||
if (install.installed) return;
|
if (install.installed) return;
|
||||||
|
|
||||||
Vue.component(Button.name, Button);
|
Vue.component(Button.name, Button);
|
||||||
@ -73,7 +74,7 @@ const install = function(Vue) {
|
|||||||
Vue.component(DatetimePicker.name, DatetimePicker);
|
Vue.component(DatetimePicker.name, DatetimePicker);
|
||||||
};
|
};
|
||||||
|
|
||||||
// auto install
|
/* istanbul ignore if */
|
||||||
if (typeof window !== 'undefined' && window.Vue) {
|
if (typeof window !== 'undefined' && window.Vue) {
|
||||||
install(window.Vue);
|
install(window.Vue);
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ const webpackConfig = {
|
|||||||
{
|
{
|
||||||
enforce: 'pre',
|
enforce: 'pre',
|
||||||
test: /\.js$/,
|
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']
|
use: ['isparta-loader']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -76,7 +76,7 @@ const webpackConfig = {
|
|||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /test\/unit\/components\/.*\.vue$/,
|
test: /test\/unit\/components\/.*\.vue$|packages\/swipe\/.*\.vue$/,
|
||||||
use: [{
|
use: [{
|
||||||
loader: 'vue-loader',
|
loader: 'vue-loader',
|
||||||
options: {
|
options: {
|
||||||
@ -92,6 +92,7 @@ const webpackConfig = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /packages\/.*\.vue$/,
|
test: /packages\/.*\.vue$/,
|
||||||
|
exclude: /packages\/swipe/,
|
||||||
use: [{
|
use: [{
|
||||||
loader: 'vue-loader',
|
loader: 'vue-loader',
|
||||||
options: {
|
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