feat(Loading): add text-color prop (#7806)

This commit is contained in:
晓晓晓晓晓丶vv
2020-12-29 19:52:18 +08:00
committed by GitHub
parent 81f15e868a
commit 680c93d103
6 changed files with 130 additions and 7 deletions
@@ -183,4 +183,48 @@ exports[`should render demo and match snapshot 1`] = `
</span>
</div>
</div>
<div>
<div class="van-loading van-loading--circular van-loading--vertical">
<span class="van-loading__spinner van-loading__spinner--circular"
style="color: rgb(0, 148, 255); width: 24px; height: 24px;"
>
<svg class="van-loading__circular"
viewbox="25 25 50 50"
>
<circle cx="50"
cy="50"
r="20"
fill="none"
>
</circle>
</svg>
</span>
<span class="van-loading__text"
style="color: rgb(0, 148, 255);"
>
Loading...
</span>
</div>
<div class="van-loading van-loading--circular van-loading--vertical">
<span class="van-loading__spinner van-loading__spinner--circular"
style="width: 24px; height: 24px;"
>
<svg class="van-loading__circular"
viewbox="25 25 50 50"
>
<circle cx="50"
cy="50"
r="20"
fill="none"
>
</circle>
</svg>
</span>
<span class="van-loading__text"
style="color: rgb(0, 148, 255);"
>
Loading...
</span>
</div>
</div>
`;
+40
View File
@@ -27,3 +27,43 @@ test('should change text font-size when using text-size prop', () => {
'20px'
);
});
test('should change text color when using text-color prop', async () => {
const wrapper = mount(Loading, {
props: {
textColor: 'red',
},
slots: {
default: () => 'Loading Text',
},
});
expect(wrapper.find('.van-loading__text').element.style.color).toBe('red');
});
test('should change text color when using color prop', async () => {
const wrapper = mount(Loading, {
props: {
color: 'green',
},
slots: {
default: () => 'Loading Text',
},
});
expect(wrapper.find('.van-loading__text').element.style.color).toBe('green');
});
test('should change text color to textColor when using color & textColor prop', async () => {
const wrapper = mount(Loading, {
props: {
color: 'green',
textColor: 'red',
},
slots: {
default: () => 'Loading Text',
},
});
expect(wrapper.find('.van-loading__text').element.style.color).toBe('red');
});