vant components
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<zan-badge-group>
|
||||
<zan-badge title="热销榜" info="8" @click="onItemClick"></zan-badge>
|
||||
<zan-badge title="手握寿司" info="199" @click="onItemClick"></zan-badge>
|
||||
</zan-badge-group>
|
||||
<van-badge-group>
|
||||
<van-badge title="热销榜" info="8" @click="onItemClick"></van-badge>
|
||||
<van-badge title="手握寿司" info="199" @click="onItemClick"></van-badge>
|
||||
</van-badge-group>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -11,8 +11,8 @@ import BadgeGroup from 'packages/badge-group';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
'zan-badge': Badge,
|
||||
'zan-badge-group': BadgeGroup
|
||||
'van-badge': Badge,
|
||||
'van-badge-group': BadgeGroup
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<zan-checkbox-group v-model="result">
|
||||
<zan-checkbox v-for="item in list" :name="item">复选框{{item}}</zan-checkbox>
|
||||
</zan-checkbox-group>
|
||||
<van-checkbox-group v-model="result">
|
||||
<van-checkbox v-for="item in list" :name="item">复选框{{item}}</van-checkbox>
|
||||
</van-checkbox-group>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -10,8 +10,8 @@ import CheckboxGroup from 'packages/checkbox-group';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
'zan-checkbox': Checkbox,
|
||||
'zan-checkbox-group': CheckboxGroup
|
||||
'van-checkbox': Checkbox,
|
||||
'van-checkbox-group': CheckboxGroup
|
||||
},
|
||||
|
||||
data() {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<zan-radio-group v-model="radio">
|
||||
<zan-radio name="1">单选框1</zan-radio>
|
||||
<zan-radio name="2">单选框2</zan-radio>
|
||||
</zan-radio-group>
|
||||
<van-radio-group v-model="radio">
|
||||
<van-radio name="1">单选框1</van-radio>
|
||||
<van-radio name="2">单选框2</van-radio>
|
||||
</van-radio-group>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -11,8 +11,8 @@ import RadioGroup from 'packages/radio-group';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
'zan-radio': Radio,
|
||||
'zan-radio-group': RadioGroup
|
||||
'van-radio': Radio,
|
||||
'van-radio-group': RadioGroup
|
||||
},
|
||||
|
||||
data() {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<zan-steps :active="active">
|
||||
<zan-step>买家下单</zan-step>
|
||||
<zan-step>商家接单</zan-step>
|
||||
<zan-step>买家提货</zan-step>
|
||||
<zan-step>交易完成</zan-step>
|
||||
</zan-steps>
|
||||
<van-steps :active="active">
|
||||
<van-step>买家下单</van-step>
|
||||
<van-step>商家接单</van-step>
|
||||
<van-step>买家提货</van-step>
|
||||
<van-step>交易完成</van-step>
|
||||
</van-steps>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -13,8 +13,8 @@ import Step from 'packages/step';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
'zan-step': Step,
|
||||
'zan-steps': Steps
|
||||
'van-step': Step,
|
||||
'van-steps': Steps
|
||||
},
|
||||
|
||||
data() {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<zan-tabs>
|
||||
<zan-tab title="选项一">内容一</zan-tab>
|
||||
<zan-tab title="选项二" disabled>内容二</zan-tab>
|
||||
<zan-tab title="选项三">内容三</zan-tab>
|
||||
<zan-tab title="选项四">内容四</zan-tab>
|
||||
<zan-tab title="选项五">内容五</zan-tab>
|
||||
</zan-tabs>
|
||||
<van-tabs>
|
||||
<van-tab title="选项一">内容一</van-tab>
|
||||
<van-tab title="选项二" disabled>内容二</van-tab>
|
||||
<van-tab title="选项三">内容三</van-tab>
|
||||
<van-tab title="选项四">内容四</van-tab>
|
||||
<van-tab title="选项五">内容五</van-tab>
|
||||
</van-tabs>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -14,8 +14,8 @@ import Tabs from 'packages/tabs';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
'zan-tab': Tab,
|
||||
'zan-tabs': Tabs
|
||||
'van-tab': Tab,
|
||||
'van-tabs': Tabs
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
require('packages/zanui-css/src/index.css');
|
||||
require('packages/vant-css/src/index.css');
|
||||
|
||||
// require all test files (files that ends with .spec.js)
|
||||
const testsReq = require.context('./specs', true, /\.spec$/);
|
||||
|
||||
@@ -12,8 +12,8 @@ describe('ActionSheet', () => {
|
||||
propsData: {}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-actionsheet')).to.be.true;
|
||||
expect(wrapper.contains('.zan-actionsheet__list')).to.be.true;
|
||||
expect(wrapper.hasClass('van-actionsheet')).to.be.true;
|
||||
expect(wrapper.contains('.van-actionsheet__list')).to.be.true;
|
||||
expect(wrapper.instance().actions.length).to.equal(0);
|
||||
expect(wrapper.instance().overlay).to.be.true;
|
||||
expect(wrapper.instance().closeOnClickOverlay).to.be.true;
|
||||
@@ -36,9 +36,9 @@ describe('ActionSheet', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-actionsheet--withtitle')).to.be.true;
|
||||
expect(wrapper.contains('.zan-actionsheet__header')).to.be.true;
|
||||
expect(wrapper.contains('.zan-actionsheet__content')).to.be.true;
|
||||
expect(wrapper.hasClass('van-actionsheet--withtitle')).to.be.true;
|
||||
expect(wrapper.contains('.van-actionsheet__header')).to.be.true;
|
||||
expect(wrapper.contains('.van-actionsheet__content')).to.be.true;
|
||||
});
|
||||
|
||||
it('create actions actionsheet', () => {
|
||||
@@ -57,12 +57,12 @@ describe('ActionSheet', () => {
|
||||
}
|
||||
});
|
||||
|
||||
const actionItems = wrapper.find('.zan-actionsheet__item');
|
||||
const actionItems = wrapper.find('.van-actionsheet__item');
|
||||
|
||||
expect(actionItems.length).to.equal(2);
|
||||
expect(actionItems[0].contains('.zan-actionsheet__name')).to.be.true;
|
||||
expect(actionItems[0].contains('.zan-actionsheet__subname')).to.be.true;
|
||||
expect(actionItems[1].contains('.zan-actionsheet__loading')).to.be.true;
|
||||
expect(actionItems[0].contains('.van-actionsheet__name')).to.be.true;
|
||||
expect(actionItems[0].contains('.van-actionsheet__subname')).to.be.true;
|
||||
expect(actionItems[1].contains('.van-actionsheet__loading')).to.be.true;
|
||||
});
|
||||
|
||||
it('handle actionsheet item click with callback', () => {
|
||||
@@ -80,7 +80,7 @@ describe('ActionSheet', () => {
|
||||
}
|
||||
});
|
||||
|
||||
const actionItem = wrapper.find('.zan-actionsheet__item')[0];
|
||||
const actionItem = wrapper.find('.van-actionsheet__item')[0];
|
||||
actionItem.simulate('click');
|
||||
expect(called).to.be.true;
|
||||
});
|
||||
@@ -92,8 +92,8 @@ describe('ActionSheet', () => {
|
||||
}
|
||||
});
|
||||
|
||||
const cancelButton = wrapper.find('.zan-actionsheet__button')[0];
|
||||
expect(wrapper.contains('.zan-actionsheet__button')).to.be.true;
|
||||
const cancelButton = wrapper.find('.van-actionsheet__button')[0];
|
||||
expect(wrapper.contains('.van-actionsheet__button')).to.be.true;
|
||||
expect(cancelButton.text()).to.equal('cancel');
|
||||
});
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ describe('BadgeGroup', () => {
|
||||
it('create a badge-group', () => {
|
||||
wrapper = mount(BadgeTestComponent);
|
||||
|
||||
expect(wrapper.hasClass('zan-badge-group')).to.be.true;
|
||||
expect(wrapper.hasClass('van-badge-group')).to.be.true;
|
||||
|
||||
expect(wrapper.vNode.child.activeKey).to.equal(0);
|
||||
expect(wrapper.vNode.child.badges.length).to.equal(2);
|
||||
@@ -19,7 +19,7 @@ describe('BadgeGroup', () => {
|
||||
it('emit a click event when click badge', () => {
|
||||
wrapper = mount(BadgeTestComponent);
|
||||
|
||||
const badge = wrapper.find('.zan-badge')[0];
|
||||
const badge = wrapper.find('.van-badge')[0];
|
||||
const eventStub = sinon.stub(badge.vNode.child, '$emit');
|
||||
badge.simulate('click');
|
||||
|
||||
|
||||
@@ -12,9 +12,9 @@ describe('Button', () => {
|
||||
it('create a simple button', () => {
|
||||
wrapper = mount(Button);
|
||||
|
||||
expect(wrapper.hasClass('zan-button')).to.be.true;
|
||||
expect(wrapper.hasClass('zan-button--default')).to.be.true;
|
||||
expect(wrapper.hasClass('zan-button--normal')).to.be.true;
|
||||
expect(wrapper.hasClass('van-button')).to.be.true;
|
||||
expect(wrapper.hasClass('van-button--default')).to.be.true;
|
||||
expect(wrapper.hasClass('van-button--normal')).to.be.true;
|
||||
|
||||
const eventStub = sinon.stub(wrapper.vm, '$emit');
|
||||
wrapper.simulate('click');
|
||||
@@ -30,8 +30,8 @@ describe('Button', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-button')).to.be.true;
|
||||
expect(wrapper.hasClass('zan-button--primary')).to.be.true;
|
||||
expect(wrapper.hasClass('van-button')).to.be.true;
|
||||
expect(wrapper.hasClass('van-button--primary')).to.be.true;
|
||||
});
|
||||
|
||||
it('create a danger button', () => {
|
||||
@@ -41,8 +41,8 @@ describe('Button', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-button')).to.be.true;
|
||||
expect(wrapper.hasClass('zan-button--danger')).to.be.true;
|
||||
expect(wrapper.hasClass('van-button')).to.be.true;
|
||||
expect(wrapper.hasClass('van-button--danger')).to.be.true;
|
||||
});
|
||||
|
||||
it('create a large button', () => {
|
||||
@@ -52,8 +52,8 @@ describe('Button', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-button')).to.be.true;
|
||||
expect(wrapper.hasClass('zan-button--large')).to.be.true;
|
||||
expect(wrapper.hasClass('van-button')).to.be.true;
|
||||
expect(wrapper.hasClass('van-button--large')).to.be.true;
|
||||
});
|
||||
|
||||
it('create a small button', () => {
|
||||
@@ -63,8 +63,8 @@ describe('Button', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-button')).to.be.true;
|
||||
expect(wrapper.hasClass('zan-button--small')).to.be.true;
|
||||
expect(wrapper.hasClass('van-button')).to.be.true;
|
||||
expect(wrapper.hasClass('van-button--small')).to.be.true;
|
||||
});
|
||||
|
||||
it('create a mini button', () => {
|
||||
@@ -74,8 +74,8 @@ describe('Button', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-button')).to.be.true;
|
||||
expect(wrapper.hasClass('zan-button--mini')).to.be.true;
|
||||
expect(wrapper.hasClass('van-button')).to.be.true;
|
||||
expect(wrapper.hasClass('van-button--mini')).to.be.true;
|
||||
});
|
||||
|
||||
it('create a block button', () => {
|
||||
@@ -85,8 +85,8 @@ describe('Button', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-button')).to.be.true;
|
||||
expect(wrapper.hasClass('zan-button--block')).to.be.true;
|
||||
expect(wrapper.hasClass('van-button')).to.be.true;
|
||||
expect(wrapper.hasClass('van-button--block')).to.be.true;
|
||||
});
|
||||
|
||||
it('create a bottom action button', () => {
|
||||
@@ -96,8 +96,8 @@ describe('Button', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-button')).to.be.true;
|
||||
expect(wrapper.hasClass('zan-button--bottom-action')).to.be.true;
|
||||
expect(wrapper.hasClass('van-button')).to.be.true;
|
||||
expect(wrapper.hasClass('van-button--bottom-action')).to.be.true;
|
||||
});
|
||||
|
||||
it('create a disabled button', () => {
|
||||
@@ -107,8 +107,8 @@ describe('Button', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-button')).to.be.true;
|
||||
expect(wrapper.hasClass('zan-button--disabled')).to.be.true;
|
||||
expect(wrapper.hasClass('van-button')).to.be.true;
|
||||
expect(wrapper.hasClass('van-button--disabled')).to.be.true;
|
||||
|
||||
const eventStub = sinon.stub(wrapper.vm, '$emit');
|
||||
wrapper.simulate('click');
|
||||
@@ -124,7 +124,7 @@ describe('Button', () => {
|
||||
});
|
||||
const loading = wrapper.find(ZanLoading)[0];
|
||||
|
||||
expect(wrapper.hasClass('zan-button')).to.be.true;
|
||||
expect(wrapper.hasClass('van-button')).to.be.true;
|
||||
expect(loading.isVueComponent).to.be.true;
|
||||
|
||||
const eventStub = sinon.stub(wrapper.vm, '$emit');
|
||||
|
||||
@@ -14,6 +14,6 @@ describe('Card', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-card')).to.be.true;
|
||||
expect(wrapper.hasClass('van-card')).to.be.true;
|
||||
});
|
||||
});
|
||||
|
||||
@@ -13,7 +13,7 @@ describe('CellGroup', () => {
|
||||
propsData: {}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-cell-group')).to.be.true;
|
||||
expect(wrapper.hasClass('van-cell-group')).to.be.true;
|
||||
});
|
||||
});
|
||||
|
||||
@@ -26,7 +26,7 @@ describe('Cell', () => {
|
||||
it('create', () => {
|
||||
wrapper = mount(Cell);
|
||||
|
||||
expect(wrapper.hasClass('zan-cell')).to.be.true;
|
||||
expect(wrapper.hasClass('van-cell')).to.be.true;
|
||||
});
|
||||
|
||||
it('create a required cell', () => {
|
||||
@@ -36,8 +36,8 @@ describe('Cell', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-cell')).to.be.true;
|
||||
expect(wrapper.hasClass('zan-cell--required')).to.be.true;
|
||||
expect(wrapper.hasClass('van-cell')).to.be.true;
|
||||
expect(wrapper.hasClass('van-cell--required')).to.be.true;
|
||||
});
|
||||
|
||||
it('emit a click event', () => {
|
||||
|
||||
@@ -11,7 +11,7 @@ describe('CheckboxGroup', () => {
|
||||
it('create a checkbox-group', () => {
|
||||
wrapper = mount(CheckboxTestComponent);
|
||||
|
||||
expect(wrapper.hasClass('zan-checkbox-group')).to.be.true;
|
||||
expect(wrapper.hasClass('van-checkbox-group')).to.be.true;
|
||||
|
||||
expect(wrapper.vNode.child.value.length).to.equal(2);
|
||||
expect(wrapper.vNode.child.disabled).to.be.false;
|
||||
@@ -40,7 +40,7 @@ describe('CheckboxGroup', () => {
|
||||
|
||||
const eventStub = sinon.stub(wrapper.vNode.child, '$emit');
|
||||
|
||||
const firstCheckboxLabel = wrapper.find('.zan-checkbox')[0].find('.zan-checkbox__label')[0];
|
||||
const firstCheckboxLabel = wrapper.find('.van-checkbox')[0].find('.van-checkbox__label')[0];
|
||||
firstCheckboxLabel.simulate('click');
|
||||
|
||||
wrapper.update();
|
||||
@@ -56,7 +56,7 @@ describe('CheckboxGroup', () => {
|
||||
|
||||
const eventStub = sinon.stub(wrapper.vNode.child, '$emit');
|
||||
|
||||
const lastCheckboxLabel = wrapper.find('.zan-checkbox')[3].find('.zan-checkbox__label')[0];
|
||||
const lastCheckboxLabel = wrapper.find('.van-checkbox')[3].find('.van-checkbox__label')[0];
|
||||
lastCheckboxLabel.simulate('click');
|
||||
|
||||
wrapper.update();
|
||||
@@ -82,7 +82,7 @@ describe('Checkbox', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-checkbox')).to.be.true;
|
||||
expect(wrapper.hasClass('van-checkbox')).to.be.true;
|
||||
expect(wrapper.instance().currentValue).to.be.false;
|
||||
expect(wrapper.instance().isDisabled).to.be.false;
|
||||
expect(wrapper.instance().isChecked).to.be.false;
|
||||
@@ -96,10 +96,10 @@ describe('Checkbox', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-checkbox')).to.be.true;
|
||||
expect(wrapper.hasClass('van-checkbox')).to.be.true;
|
||||
const eventStub = sinon.stub(wrapper.vm, '$emit');
|
||||
|
||||
const checkboxLabel = wrapper.find('.zan-checkbox__label')[0];
|
||||
const checkboxLabel = wrapper.find('.van-checkbox__label')[0];
|
||||
checkboxLabel.simulate('click');
|
||||
|
||||
wrapper.update();
|
||||
@@ -118,12 +118,12 @@ describe('Checkbox', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-checkbox')).to.be.true;
|
||||
expect(wrapper.hasClass('zan-checkbox--disabled')).to.be.true;
|
||||
expect(wrapper.hasClass('van-checkbox')).to.be.true;
|
||||
expect(wrapper.hasClass('van-checkbox--disabled')).to.be.true;
|
||||
expect(wrapper.instance().currentValue).to.be.false;
|
||||
expect(wrapper.instance().isDisabled).to.be.true;
|
||||
|
||||
const checkboxLabel = wrapper.find('.zan-checkbox__label')[0];
|
||||
const checkboxLabel = wrapper.find('.van-checkbox__label')[0];
|
||||
checkboxLabel.simulate('click');
|
||||
|
||||
expect(wrapper.instance().currentValue).to.be.false;
|
||||
|
||||
@@ -15,7 +15,7 @@ describe('Field', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-field')).to.be.true;
|
||||
expect(wrapper.hasClass('van-field')).to.be.true;
|
||||
expect(wrapper.propsData().type).to.equal('text');
|
||||
});
|
||||
|
||||
@@ -26,7 +26,7 @@ describe('Field', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-field')).to.be.true;
|
||||
expect(wrapper.hasClass('van-field')).to.be.true;
|
||||
expect(wrapper.data().currentValue).to.equal('test');
|
||||
|
||||
const eventStub = sinon.stub(wrapper.vm, '$emit');
|
||||
@@ -48,7 +48,7 @@ describe('Field', () => {
|
||||
});
|
||||
|
||||
const eventStub = sinon.stub(wrapper.vm, '$emit');
|
||||
const input = wrapper.find('.zan-field__control')[0];
|
||||
const input = wrapper.find('.van-field__control')[0];
|
||||
input.simulate('focus');
|
||||
|
||||
wrapper.update();
|
||||
@@ -65,7 +65,7 @@ describe('Field', () => {
|
||||
}
|
||||
});
|
||||
|
||||
const input = wrapper.find('.zan-field__control')[0];
|
||||
const input = wrapper.find('.van-field__control')[0];
|
||||
|
||||
input.element.value = 'test';
|
||||
input.simulate('input');
|
||||
@@ -85,8 +85,8 @@ describe('Field', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-field')).to.be.true;
|
||||
expect(wrapper.hasClass('zan-field--hastextarea')).to.be.true;
|
||||
expect(wrapper.hasClass('van-field')).to.be.true;
|
||||
expect(wrapper.hasClass('van-field--hastextarea')).to.be.true;
|
||||
});
|
||||
|
||||
it('create a autosize textarea field', (done) => {
|
||||
@@ -97,10 +97,10 @@ describe('Field', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-field')).to.be.true;
|
||||
expect(wrapper.hasClass('zan-field--autosize')).to.be.true;
|
||||
expect(wrapper.hasClass('van-field')).to.be.true;
|
||||
expect(wrapper.hasClass('van-field--autosize')).to.be.true;
|
||||
|
||||
const textarea = wrapper.find('.zan-field__control')[0];
|
||||
const textarea = wrapper.find('.van-field__control')[0];
|
||||
const textareaElement = textarea.element;
|
||||
const textAreaDiff = (parseInt(textareaElement.style.paddingBottom, 10) +
|
||||
parseInt(textareaElement.style.paddingTop, 10)) || 0;
|
||||
|
||||
@@ -15,8 +15,8 @@ describe('Icon', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-icon')).to.be.true;
|
||||
expect(wrapper.hasClass('zan-icon-arrow')).to.be.true;
|
||||
expect(wrapper.hasClass('van-icon')).to.be.true;
|
||||
expect(wrapper.hasClass('van-icon-arrow')).to.be.true;
|
||||
});
|
||||
|
||||
it('emit a click event', () => {
|
||||
|
||||
@@ -10,7 +10,7 @@ describe('Loading', () => {
|
||||
it('create default', () => {
|
||||
wrapper = mount(Loading);
|
||||
|
||||
expect(wrapper.hasClass('zan-loading')).to.be.true;
|
||||
expect(wrapper.hasClass('van-loading')).to.be.true;
|
||||
});
|
||||
|
||||
it('create gradient-circle black', () => {
|
||||
@@ -20,10 +20,10 @@ describe('Loading', () => {
|
||||
color: 'black'
|
||||
}
|
||||
});
|
||||
const spinner = wrapper.find('.zan-loading__spinner')[0];
|
||||
const spinner = wrapper.find('.van-loading__spinner')[0];
|
||||
|
||||
expect(spinner.hasClass('zan-loading__spinner--gradient-circle')).to.be.true;
|
||||
expect(spinner.hasClass('zan-loading__spinner--black')).to.be.true;
|
||||
expect(spinner.hasClass('van-loading__spinner--gradient-circle')).to.be.true;
|
||||
expect(spinner.hasClass('van-loading__spinner--black')).to.be.true;
|
||||
});
|
||||
|
||||
it('create gradient-circle white', () => {
|
||||
@@ -33,10 +33,10 @@ describe('Loading', () => {
|
||||
color: 'white'
|
||||
}
|
||||
});
|
||||
const spinner = wrapper.find('.zan-loading__spinner')[0];
|
||||
const spinner = wrapper.find('.van-loading__spinner')[0];
|
||||
|
||||
expect(spinner.hasClass('zan-loading__spinner--gradient-circle')).to.be.true;
|
||||
expect(spinner.hasClass('zan-loading__spinner--white')).to.be.true;
|
||||
expect(spinner.hasClass('van-loading__spinner--gradient-circle')).to.be.true;
|
||||
expect(spinner.hasClass('van-loading__spinner--white')).to.be.true;
|
||||
});
|
||||
|
||||
it('create circle black', () => {
|
||||
@@ -46,10 +46,10 @@ describe('Loading', () => {
|
||||
color: 'black'
|
||||
}
|
||||
});
|
||||
const spinner = wrapper.find('.zan-loading__spinner')[0];
|
||||
const spinner = wrapper.find('.van-loading__spinner')[0];
|
||||
|
||||
expect(spinner.hasClass('zan-loading__spinner--circle')).to.be.true;
|
||||
expect(spinner.hasClass('zan-loading__spinner--black')).to.be.true;
|
||||
expect(spinner.hasClass('van-loading__spinner--circle')).to.be.true;
|
||||
expect(spinner.hasClass('van-loading__spinner--black')).to.be.true;
|
||||
});
|
||||
|
||||
it('create circle white', () => {
|
||||
@@ -59,9 +59,9 @@ describe('Loading', () => {
|
||||
color: 'white'
|
||||
}
|
||||
});
|
||||
const spinner = wrapper.find('.zan-loading__spinner')[0];
|
||||
const spinner = wrapper.find('.van-loading__spinner')[0];
|
||||
|
||||
expect(spinner.hasClass('zan-loading__spinner--circle')).to.be.true;
|
||||
expect(spinner.hasClass('zan-loading__spinner--white')).to.be.true;
|
||||
expect(spinner.hasClass('van-loading__spinner--circle')).to.be.true;
|
||||
expect(spinner.hasClass('van-loading__spinner--white')).to.be.true;
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@ describe('Popup', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-popup')).to.be.true;
|
||||
expect(wrapper.hasClass('van-popup')).to.be.true;
|
||||
expect(wrapper.instance().currentTransition).to.equal('popup-slide-bottom');
|
||||
});
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ describe('Progress', () => {
|
||||
wrapper = mount(Progress, {
|
||||
propsData: propsData
|
||||
});
|
||||
bar = wrapper.find('.zan-progress__bar__finished-portion')[0];
|
||||
pivot = wrapper.find('.zan-progress__bar__pivot')[0];
|
||||
bar = wrapper.find('.van-progress__bar__finished-portion')[0];
|
||||
pivot = wrapper.find('.van-progress__bar__pivot')[0];
|
||||
};
|
||||
|
||||
afterEach(() => {
|
||||
@@ -20,7 +20,7 @@ describe('Progress', () => {
|
||||
it('create active 3% progress bar', () => {
|
||||
initProgressBar({ percentage: 3 });
|
||||
|
||||
expect(wrapper.hasClass('zan-progress')).to.be.true;
|
||||
expect(wrapper.hasClass('van-progress')).to.be.true;
|
||||
expect(bar.is('span')).to.be.true;
|
||||
expect(bar.hasStyle('width', '3%'));
|
||||
|
||||
@@ -33,7 +33,7 @@ describe('Progress', () => {
|
||||
it('create active 35% progress bar', () => {
|
||||
initProgressBar({ percentage: 35 });
|
||||
|
||||
expect(wrapper.hasClass('zan-progress')).to.be.true;
|
||||
expect(wrapper.hasClass('van-progress')).to.be.true;
|
||||
expect(bar.is('span')).to.be.true;
|
||||
expect(bar.hasStyle('width', '35%'));
|
||||
|
||||
@@ -46,7 +46,7 @@ describe('Progress', () => {
|
||||
it('create active 98% progress bar', () => {
|
||||
initProgressBar({ percentage: 98 });
|
||||
|
||||
expect(wrapper.hasClass('zan-progress')).to.be.true;
|
||||
expect(wrapper.hasClass('van-progress')).to.be.true;
|
||||
expect(bar.is('span')).to.be.true;
|
||||
expect(bar.hasStyle('width', '98%'));
|
||||
|
||||
|
||||
@@ -15,15 +15,15 @@ describe('Quantity', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-quantity')).to.be.true;
|
||||
expect(wrapper.hasClass('van-quantity')).to.be.true;
|
||||
expect(wrapper.data().currentValue).to.equal(1);
|
||||
|
||||
const plusButton = wrapper.find('.zan-quantity__plus')[0];
|
||||
const plusButton = wrapper.find('.van-quantity__plus')[0];
|
||||
plusButton.simulate('click');
|
||||
|
||||
expect(wrapper.data().currentValue).to.equal(2);
|
||||
|
||||
const minusButton = wrapper.find('.zan-quantity__minus')[0];
|
||||
const minusButton = wrapper.find('.van-quantity__minus')[0];
|
||||
minusButton.simulate('click');
|
||||
expect(wrapper.data().currentValue).to.equal(1);
|
||||
});
|
||||
@@ -35,9 +35,9 @@ describe('Quantity', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-quantity')).to.be.true;
|
||||
const minusButton = wrapper.find('.zan-quantity__minus')[0];
|
||||
expect(minusButton.hasClass('zan-quantity__minus--disabled')).to.be.true;
|
||||
expect(wrapper.hasClass('van-quantity')).to.be.true;
|
||||
const minusButton = wrapper.find('.van-quantity__minus')[0];
|
||||
expect(minusButton.hasClass('van-quantity__minus--disabled')).to.be.true;
|
||||
|
||||
const eventStub = sinon.stub(wrapper.vm, '$emit');
|
||||
minusButton.simulate('click');
|
||||
@@ -48,8 +48,8 @@ describe('Quantity', () => {
|
||||
done();
|
||||
});
|
||||
|
||||
const plusButton = wrapper.find('.zan-quantity__plus')[0];
|
||||
expect(plusButton.hasClass('zan-quantity__plus--disabled')).to.be.true;
|
||||
const plusButton = wrapper.find('.van-quantity__plus')[0];
|
||||
expect(plusButton.hasClass('van-quantity__plus--disabled')).to.be.true;
|
||||
|
||||
plusButton.simulate('click');
|
||||
|
||||
@@ -67,7 +67,7 @@ describe('Quantity', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-quantity')).to.be.true;
|
||||
expect(wrapper.hasClass('van-quantity')).to.be.true;
|
||||
const eventStub = sinon.stub(wrapper.vm, '$emit');
|
||||
|
||||
wrapper.vm.value = 2;
|
||||
@@ -87,7 +87,7 @@ describe('Quantity', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-quantity')).to.be.true;
|
||||
expect(wrapper.hasClass('van-quantity')).to.be.true;
|
||||
const eventStub = sinon.stub(wrapper.vm, '$emit');
|
||||
wrapper.update();
|
||||
wrapper.vm.$nextTick(() => {
|
||||
@@ -103,7 +103,7 @@ describe('Quantity', () => {
|
||||
}
|
||||
});
|
||||
|
||||
const input = wrapper.find('.zan-quantity__input')[0];
|
||||
const input = wrapper.find('.van-quantity__input')[0];
|
||||
input.element.value = 2;
|
||||
input.simulate('input');
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ describe('RadioGroup', () => {
|
||||
it('create a radio-group', () => {
|
||||
wrapper = mount(RadioTestComponent);
|
||||
|
||||
expect(wrapper.hasClass('zan-radio-group')).to.be.true;
|
||||
expect(wrapper.hasClass('van-radio-group')).to.be.true;
|
||||
|
||||
expect(wrapper.vNode.child.value).to.equal('1');
|
||||
expect(wrapper.vNode.child.disabled).to.be.false;
|
||||
@@ -40,7 +40,7 @@ describe('RadioGroup', () => {
|
||||
|
||||
const eventStub = sinon.stub(wrapper.vNode.child, '$emit');
|
||||
|
||||
const uncheckedRadioLabel = wrapper.find('.zan-radio')[1].find('.zan-radio__label')[0];
|
||||
const uncheckedRadioLabel = wrapper.find('.van-radio')[1].find('.van-radio__label')[0];
|
||||
uncheckedRadioLabel.simulate('click');
|
||||
|
||||
wrapper.update();
|
||||
@@ -67,8 +67,8 @@ describe('Radio', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-radio')).to.be.true;
|
||||
expect(wrapper.hasClass('zan-radio--disabled')).to.be.false;
|
||||
expect(wrapper.hasClass('van-radio')).to.be.true;
|
||||
expect(wrapper.hasClass('van-radio--disabled')).to.be.false;
|
||||
expect(wrapper.instance().currentValue).to.equal('1');
|
||||
expect(wrapper.instance().isDisabled).to.be.false;
|
||||
});
|
||||
@@ -82,7 +82,7 @@ describe('Radio', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-radio')).to.be.true;
|
||||
expect(wrapper.hasClass('van-radio')).to.be.true;
|
||||
const eventStub = sinon.stub(wrapper.vm, '$emit');
|
||||
|
||||
wrapper.simulate('click');
|
||||
@@ -103,10 +103,10 @@ describe('Radio', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-radio')).to.be.true;
|
||||
expect(wrapper.hasClass('van-radio')).to.be.true;
|
||||
const eventStub = sinon.stub(wrapper.vm, '$emit');
|
||||
|
||||
const checkboxLabel = wrapper.find('.zan-radio__label')[0];
|
||||
const checkboxLabel = wrapper.find('.van-radio__label')[0];
|
||||
checkboxLabel.simulate('click');
|
||||
|
||||
wrapper.update();
|
||||
@@ -126,12 +126,12 @@ describe('Radio', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-radio')).to.be.true;
|
||||
expect(wrapper.hasClass('zan-radio--disabled')).to.be.true;
|
||||
expect(wrapper.hasClass('van-radio')).to.be.true;
|
||||
expect(wrapper.hasClass('van-radio--disabled')).to.be.true;
|
||||
expect(wrapper.instance().currentValue).to.equal('1');
|
||||
expect(wrapper.instance().isDisabled).to.be.true;
|
||||
|
||||
const checkboxLabel = wrapper.find('.zan-radio__label')[0];
|
||||
const checkboxLabel = wrapper.find('.van-radio__label')[0];
|
||||
checkboxLabel.simulate('click');
|
||||
|
||||
expect(wrapper.instance().currentValue).to.equal('1');
|
||||
|
||||
@@ -11,7 +11,7 @@ describe('Search', () => {
|
||||
it('create a quantity', () => {
|
||||
wrapper = mount(Search);
|
||||
|
||||
expect(wrapper.hasClass('zan-search')).to.be.true;
|
||||
expect(wrapper.hasClass('van-search')).to.be.true;
|
||||
expect(wrapper.data().focusStatus).to.be.false;
|
||||
expect(wrapper.data().isFocus).to.be.false;
|
||||
});
|
||||
@@ -19,7 +19,7 @@ describe('Search', () => {
|
||||
it('focus on input', () => {
|
||||
wrapper = mount(Search);
|
||||
|
||||
const input = wrapper.find('.zan-search__input')[0];
|
||||
const input = wrapper.find('.van-search__input')[0];
|
||||
input.simulate('focus');
|
||||
|
||||
expect(wrapper.data().isFocus).to.be.true;
|
||||
@@ -45,10 +45,10 @@ describe('Search', () => {
|
||||
wrapper.setData({ value: 'test' });
|
||||
expect(wrapper.data().value).to.be.equal('test');
|
||||
|
||||
const input = wrapper.find('.zan-search__input')[0];
|
||||
const input = wrapper.find('.van-search__input')[0];
|
||||
input.simulate('focus');
|
||||
|
||||
const cleanBtn = wrapper.find('.zan-icon-clear')[0];
|
||||
const cleanBtn = wrapper.find('.van-icon-clear')[0];
|
||||
cleanBtn.simulate('click');
|
||||
expect(wrapper.data().value).to.equal('');
|
||||
expect(wrapper.data().focusStatus).to.be.true;
|
||||
@@ -62,10 +62,10 @@ describe('Search', () => {
|
||||
|
||||
const eventStub = sinon.stub(wrapper.vm, '$emit');
|
||||
|
||||
const input = wrapper.find('.zan-search__input')[0];
|
||||
const input = wrapper.find('.van-search__input')[0];
|
||||
input.simulate('focus');
|
||||
|
||||
const cancelBtn = wrapper.find('.zan-search__cancel')[0];
|
||||
const cancelBtn = wrapper.find('.van-search__cancel')[0];
|
||||
cancelBtn.simulate('click');
|
||||
|
||||
wrapper.vm.$nextTick(() => {
|
||||
@@ -83,7 +83,7 @@ describe('Search', () => {
|
||||
|
||||
const eventStub = sinon.stub(wrapper.vm, '$emit');
|
||||
|
||||
const input = wrapper.find('.zan-search__input')[0];
|
||||
const input = wrapper.find('.van-search__input')[0];
|
||||
input.simulate('keyup.enter');
|
||||
|
||||
wrapper.vm.$nextTick(() => {
|
||||
|
||||
@@ -12,17 +12,17 @@ describe('Steps', () => {
|
||||
it('create a steps', () => {
|
||||
wrapper = mount(Steps);
|
||||
|
||||
expect(wrapper.hasClass('zan-steps')).to.be.true;
|
||||
expect(wrapper.hasClass('van-steps')).to.be.true;
|
||||
expect(wrapper.data().steps.length).to.equal(0);
|
||||
});
|
||||
|
||||
it('create a steps with step', () => {
|
||||
wrapper = mount(StepsTestComponent);
|
||||
|
||||
const finishStep = wrapper.find('.zan-step')[0];
|
||||
expect(finishStep.hasClass('zan-step--finish')).to.be.true;
|
||||
const finishStep = wrapper.find('.van-step')[0];
|
||||
expect(finishStep.hasClass('van-step--finish')).to.be.true;
|
||||
|
||||
const proccessStep = wrapper.find('.zan-step')[1];
|
||||
expect(proccessStep.hasClass('zan-step--process')).to.be.true;
|
||||
const proccessStep = wrapper.find('.van-step')[1];
|
||||
expect(proccessStep.hasClass('van-step--process')).to.be.true;
|
||||
});
|
||||
});
|
||||
|
||||
@@ -17,8 +17,8 @@ describe('Switch', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-switch')).to.be.true;
|
||||
expect(wrapper.hasClass('zan-switch--on')).to.be.true;
|
||||
expect(wrapper.hasClass('van-switch')).to.be.true;
|
||||
expect(wrapper.hasClass('van-switch--on')).to.be.true;
|
||||
});
|
||||
|
||||
it('create off switch', () => {
|
||||
@@ -28,8 +28,8 @@ describe('Switch', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-switch')).to.be.true;
|
||||
expect(wrapper.hasClass('zan-switch--off')).to.be.true;
|
||||
expect(wrapper.hasClass('van-switch')).to.be.true;
|
||||
expect(wrapper.hasClass('van-switch--off')).to.be.true;
|
||||
});
|
||||
|
||||
it('create loading switch', () => {
|
||||
@@ -40,7 +40,7 @@ describe('Switch', () => {
|
||||
});
|
||||
const loading = wrapper.find(ZanLoading)[0];
|
||||
|
||||
expect(wrapper.hasClass('zan-switch')).to.be.true;
|
||||
expect(wrapper.hasClass('van-switch')).to.be.true;
|
||||
expect(loading.isVueComponent).to.be.true;
|
||||
});
|
||||
|
||||
@@ -52,9 +52,9 @@ describe('Switch', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-switch--on')).to.be.true;
|
||||
expect(wrapper.hasClass('van-switch--on')).to.be.true;
|
||||
wrapper.simulate('click');
|
||||
expect(wrapper.hasClass('zan-switch--on')).to.be.true;
|
||||
expect(wrapper.hasClass('van-switch--on')).to.be.true;
|
||||
});
|
||||
|
||||
it('create disabled switch', () => {
|
||||
@@ -64,8 +64,8 @@ describe('Switch', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-switch')).to.be.true;
|
||||
expect(wrapper.hasClass('zan-switch--disabled')).to.be.true;
|
||||
expect(wrapper.hasClass('van-switch')).to.be.true;
|
||||
expect(wrapper.hasClass('van-switch--disabled')).to.be.true;
|
||||
});
|
||||
|
||||
it('disabled switch should be unclickable', () => {
|
||||
@@ -76,9 +76,9 @@ describe('Switch', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-switch--off')).to.be.true;
|
||||
expect(wrapper.hasClass('van-switch--off')).to.be.true;
|
||||
wrapper.simulate('click');
|
||||
expect(wrapper.hasClass('zan-switch--off')).to.be.true;
|
||||
expect(wrapper.hasClass('van-switch--off')).to.be.true;
|
||||
});
|
||||
|
||||
it('click should toggle the switch', () => {
|
||||
@@ -88,9 +88,9 @@ describe('Switch', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-switch--off')).to.be.true;
|
||||
expect(wrapper.hasClass('van-switch--off')).to.be.true;
|
||||
wrapper.simulate('click');
|
||||
expect(wrapper.hasClass('zan-switch--on')).to.be.true;
|
||||
expect(wrapper.hasClass('van-switch--on')).to.be.true;
|
||||
});
|
||||
|
||||
it('click should call callback function', () => {
|
||||
@@ -102,9 +102,9 @@ describe('Switch', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-switch--off')).to.be.true;
|
||||
expect(wrapper.hasClass('van-switch--off')).to.be.true;
|
||||
wrapper.simulate('click');
|
||||
expect(wrapper.hasClass('zan-switch--off')).to.be.true;
|
||||
expect(wrapper.hasClass('van-switch--off')).to.be.true;
|
||||
expect(stub.calledOnce).to.be.true;
|
||||
expect(stub.calledWith(true));
|
||||
});
|
||||
@@ -117,11 +117,11 @@ describe('Switch', () => {
|
||||
});
|
||||
const eventStub = sinon.stub(wrapper.vm, '$emit');
|
||||
|
||||
expect(wrapper.hasClass('zan-switch--off')).to.be.true;
|
||||
expect(wrapper.hasClass('van-switch--off')).to.be.true;
|
||||
wrapper.vm.value = true;
|
||||
wrapper.update();
|
||||
Vue.nextTick(() => {
|
||||
expect(wrapper.hasClass('zan-switch--on')).to.be.true;
|
||||
expect(wrapper.hasClass('van-switch--on')).to.be.true;
|
||||
expect(eventStub.calledOnce).to.be.true;
|
||||
expect(eventStub.calledWith('input'));
|
||||
done();
|
||||
|
||||
@@ -16,19 +16,19 @@ describe('Tabs', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.hasClass('zan-tabs')).to.be.true;
|
||||
expect(wrapper.hasClass('zan-tabs--card')).to.be.true;
|
||||
expect(wrapper.hasClass('van-tabs')).to.be.true;
|
||||
expect(wrapper.hasClass('van-tabs--card')).to.be.true;
|
||||
});
|
||||
|
||||
it('create a tabs with four tab', () => {
|
||||
// wrapper = mount(TabsTestComponent);
|
||||
|
||||
// expect(wrapper.hasClass('zan-tabs')).to.be.true;
|
||||
// expect(wrapper.hasClass('zan-tabs--line')).to.be.true;
|
||||
// expect(wrapper.hasClass('van-tabs')).to.be.true;
|
||||
// expect(wrapper.hasClass('van-tabs--line')).to.be.true;
|
||||
|
||||
// const eventStub = sinon.stub(wrapper.vNode.child, '$emit');
|
||||
|
||||
// const tabTitle = wrapper.find('.zan-tab__pane')[2];
|
||||
// const tabTitle = wrapper.find('.van-tab__pane')[2];
|
||||
// tabTitle.simulate('click');
|
||||
|
||||
// wrapper.vm.$nextTick(() => {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// describe('Toast', () => {
|
||||
// // it('create simple toast', () => {
|
||||
// // Toast('a message');
|
||||
// // var toast = document.querySelector('.zan-toast');
|
||||
// // var toast = document.querySelector('.van-toast');
|
||||
|
||||
// // expect(toast).not.to.be.underfined;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
// // it('create loading toast', () => {
|
||||
// // Toast.loading('');
|
||||
// // var toast = document.querySelector('.zan-toast');
|
||||
// // var toast = document.querySelector('.van-toast');
|
||||
|
||||
// // expect(toast).not.to.be.underfined;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
// // });
|
||||
// // it('create loading toast', () => {
|
||||
// // Toast.success('');
|
||||
// // var toast = document.querySelector('.zan-toast');
|
||||
// // var toast = document.querySelector('.van-toast');
|
||||
|
||||
// // expect(toast).not.to.be.underfined;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user