[improvement] NavBar: add test cases
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`render left & right slot 1`] = `
|
||||
<div class="van-nav-bar van-hairline--bottom" style="z-index: 1;">
|
||||
<div class="van-nav-bar__left">Custom Left</div>
|
||||
<div class="van-nav-bar__title van-ellipsis"></div>
|
||||
<div class="van-nav-bar__right">Custom Right</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`render title slot 1`] = `
|
||||
<div class="van-nav-bar van-hairline--bottom" style="z-index: 1;">
|
||||
<div class="van-nav-bar__left"></div>
|
||||
<div class="van-nav-bar__title van-ellipsis">Custom Title</div>
|
||||
<div class="van-nav-bar__right"></div>
|
||||
</div>
|
||||
`;
|
||||
@@ -0,0 +1,23 @@
|
||||
import NavBar from '..';
|
||||
import { mount } from '../../../test/utils';
|
||||
|
||||
test('render left & right slot', () => {
|
||||
const wrapper = mount(NavBar, {
|
||||
scopedSlots: {
|
||||
left: () => 'Custom Left',
|
||||
right: () => 'Custom Right'
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('render title slot', () => {
|
||||
const wrapper = mount(NavBar, {
|
||||
scopedSlots: {
|
||||
title: () => 'Custom Title'
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
Reference in New Issue
Block a user