feat(Popover): support config action color (#8049)

This commit is contained in:
neverland
2021-01-31 18:36:11 +08:00
committed by GitHub
parent 94b9e3981c
commit d27626ada2
5 changed files with 21 additions and 4 deletions
@@ -17,7 +17,7 @@ exports[`should locate to reference element when showed 1`] = `
exports[`should locate to reference element when showed 2`] = `
<transition-stub>
<div style="z-index: 2006; position: absolute; left: 0px; top: 8px; margin: 0px;"
<div style="z-index: 2007; position: absolute; left: 0px; top: 8px; margin: 0px;"
class="van-popup van-popover van-popover--light"
data-popper-placement="bottom"
>
@@ -33,7 +33,7 @@ exports[`should locate to reference element when showed 2`] = `
exports[`should locate to reference element when showed 3`] = `
<transition-stub>
<div style="z-index: 2006; display: none;"
<div style="z-index: 2007; display: none;"
class="van-popup van-popover van-popover--light"
>
<div class="van-popover__arrow">
@@ -48,7 +48,7 @@ exports[`should locate to reference element when showed 3`] = `
exports[`should watch placement prop and update location 1`] = `
<transition-stub>
<div style="z-index: 2007; position: absolute; left: 0px; top: -8px; margin: 0px;"
<div style="z-index: 2008; position: absolute; left: 0px; top: -8px; margin: 0px;"
class="van-popup van-popover van-popover--light"
data-popper-placement="top"
>
+14
View File
@@ -82,6 +82,20 @@ test('should allow to custom the className of action', () => {
expect(wrapper.find('.van-popover__action').html()).toMatchSnapshot();
});
test('should allow to custom the color of action test', () => {
const wrapper = mount(Popover, {
props: {
show: true,
teleport: null,
actions: [{ text: 'Option', color: 'red' }],
},
});
expect(wrapper.find('.van-popover__action').element.style.color).toEqual(
'red'
);
});
test('should locate to reference element when showed', async () => {
const root = document.createElement('div');
const wrapper = mount(Popover, {