[new feature] Dialog: add confirmButtonText、cancelButtonText prop (#3107)

This commit is contained in:
neverland
2019-04-08 20:27:50 +08:00
committed by GitHub
parent d3054fd4b0
commit fc412ce1aa
7 changed files with 63 additions and 10 deletions
@@ -0,0 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`button color 1`] = `
<div class="van-dialog" name="van-dialog-bounce">
<div class="van-hairline--top van-dialog__footer van-dialog__footer--buttons"><button class="van-button van-button--default van-button--large van-dialog__cancel" style="color: white;"><span class="van-button__text">取消</span></button><button class="van-button van-button--default van-button--large van-dialog__confirm van-hairline--left" style="color: red;"><span class="van-button__text">确认</span></button></div>
</div>
`;
exports[`button text 1`] = `
<div class="van-dialog" name="van-dialog-bounce">
<div class="van-hairline--top van-dialog__footer van-dialog__footer--buttons"><button class="van-button van-button--default van-button--large van-dialog__cancel"><span class="van-button__text">Custom cancel</span></button><button class="van-button van-button--default van-button--large van-dialog__confirm van-hairline--left"><span class="van-button__text">Custom confirm</span></button></div>
</div>
`;
+24
View File
@@ -76,3 +76,27 @@ test('register component', () => {
Vue.use(Dialog);
expect(Vue.component(DialogVue.name)).toBeTruthy();
});
test('button color', () => {
const wrapper = mount(DialogVue, {
propsData: {
value: true,
showCancelButton: true,
cancelButtonColor: 'white',
confirmButtonColor: 'red'
}
});
expect(wrapper).toMatchSnapshot();
});
test('button text', () => {
const wrapper = mount(DialogVue, {
propsData: {
value: true,
showCancelButton: true,
cancelButtonText: 'Custom cancel',
confirmButtonText: 'Custom confirm'
}
});
expect(wrapper).toMatchSnapshot();
});