mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
test(Loading): update test cases
This commit is contained in:
parent
a13f4fd1e4
commit
2b34fac38d
@ -67,7 +67,7 @@ test('should render badge correctly', () => {
|
||||
expect(wrapper.find('.van-badge').html()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('should change icon size after using size prop', () => {
|
||||
test('should change icon size when using size prop', () => {
|
||||
const wrapper = mount(Icon, {
|
||||
props: {
|
||||
size: 20,
|
||||
|
@ -1,5 +0,0 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`size prop 1`] = `<div class="van-loading van-loading--circular"><span class="van-loading__spinner van-loading__spinner--circular" style="width: 20px; height: 20px;"><svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span></div>`;
|
||||
|
||||
exports[`text-size prop 1`] = `<div class="van-loading van-loading--circular"><span class="van-loading__spinner van-loading__spinner--circular"><svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span><span class="van-loading__text" style="font-size: 20px;">Text</span></div>`;
|
@ -1,25 +0,0 @@
|
||||
import { mount } from '@vue/test-utils';
|
||||
import Loading from '..';
|
||||
|
||||
test('size prop', () => {
|
||||
const wrapper = mount(Loading, {
|
||||
props: {
|
||||
size: 20,
|
||||
},
|
||||
});
|
||||
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('text-size prop', () => {
|
||||
const wrapper = mount(Loading, {
|
||||
props: {
|
||||
textSize: 20,
|
||||
},
|
||||
slots: {
|
||||
default: () => 'Text',
|
||||
},
|
||||
});
|
||||
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
});
|
29
src/loading/test/index.spec.js
Normal file
29
src/loading/test/index.spec.js
Normal file
@ -0,0 +1,29 @@
|
||||
import { mount } from '@vue/test-utils';
|
||||
import Loading from '..';
|
||||
|
||||
test('should change loading size when using size prop', () => {
|
||||
const wrapper = mount(Loading, {
|
||||
props: {
|
||||
size: 20,
|
||||
},
|
||||
});
|
||||
|
||||
const spinner = wrapper.find('.van-loading__spinner').element;
|
||||
expect(spinner.style.width).toEqual('20px');
|
||||
expect(spinner.style.height).toEqual('20px');
|
||||
});
|
||||
|
||||
test('should change text font-size when using text-size prop', () => {
|
||||
const wrapper = mount(Loading, {
|
||||
props: {
|
||||
textSize: 20,
|
||||
},
|
||||
slots: {
|
||||
default: () => 'Text',
|
||||
},
|
||||
});
|
||||
|
||||
expect(wrapper.find('.van-loading__text').element.style.fontSize).toEqual(
|
||||
'20px'
|
||||
);
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user