mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-08-17 17:50:10 +08:00
test(NavBar): improve test cases name
This commit is contained in:
parent
be25a478df
commit
e7d9cae593
@ -1,6 +1,6 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`should allow render left/right slot 1`] = `
|
exports[`should render left/right slot and match snapshot 1`] = `
|
||||||
<div class="van-nav-bar van-hairline--bottom">
|
<div class="van-nav-bar van-hairline--bottom">
|
||||||
<div class="van-nav-bar__content">
|
<div class="van-nav-bar__content">
|
||||||
<div class="van-nav-bar__left">Custom Left</div>
|
<div class="van-nav-bar__left">Custom Left</div>
|
||||||
@ -10,15 +10,7 @@ exports[`should allow render left/right slot 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`should allow render title slot 1`] = `
|
exports[`should render placeholder element when using placeholder prop 1`] = `
|
||||||
<div class="van-nav-bar van-hairline--bottom">
|
|
||||||
<div class="van-nav-bar__content">
|
|
||||||
<div class="van-nav-bar__title van-ellipsis">Custom Title</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`should render placeholder element when enabling placeholder prop 1`] = `
|
|
||||||
<div class="van-nav-bar__placeholder" style="height: 50px;">
|
<div class="van-nav-bar__placeholder" style="height: 50px;">
|
||||||
<div class="van-nav-bar van-nav-bar--fixed van-hairline--bottom">
|
<div class="van-nav-bar van-nav-bar--fixed van-hairline--bottom">
|
||||||
<div class="van-nav-bar__content">
|
<div class="van-nav-bar__content">
|
||||||
@ -27,3 +19,11 @@ exports[`should render placeholder element when enabling placeholder prop 1`] =
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`should render title slot and match snapshot 1`] = `
|
||||||
|
<div class="van-nav-bar van-hairline--bottom">
|
||||||
|
<div class="van-nav-bar__content">
|
||||||
|
<div class="van-nav-bar__title van-ellipsis">Custom Title</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import NavBar from '..';
|
import NavBar from '..';
|
||||||
import { mount, mockGetBoundingClientRect } from '../../../test';
|
import { mount, mockGetBoundingClientRect } from '../../../test';
|
||||||
|
|
||||||
test('should allow render left/right slot', () => {
|
test('should render left/right slot and match snapshot', () => {
|
||||||
const wrapper = mount(NavBar, {
|
const wrapper = mount(NavBar, {
|
||||||
scopedSlots: {
|
scopedSlots: {
|
||||||
left: () => 'Custom Left',
|
left: () => 'Custom Left',
|
||||||
@ -12,7 +12,7 @@ test('should allow render left/right slot', () => {
|
|||||||
expect(wrapper).toMatchSnapshot();
|
expect(wrapper).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should allow render title slot', () => {
|
test('should render title slot and match snapshot', () => {
|
||||||
const wrapper = mount(NavBar, {
|
const wrapper = mount(NavBar, {
|
||||||
scopedSlots: {
|
scopedSlots: {
|
||||||
title: () => 'Custom Title',
|
title: () => 'Custom Title',
|
||||||
@ -22,7 +22,7 @@ test('should allow render title slot', () => {
|
|||||||
expect(wrapper).toMatchSnapshot();
|
expect(wrapper).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should render placeholder element when enabling placeholder prop', () => {
|
test('should render placeholder element when using placeholder prop', () => {
|
||||||
const restore = mockGetBoundingClientRect({ height: 50 });
|
const restore = mockGetBoundingClientRect({ height: 50 });
|
||||||
|
|
||||||
const wrapper = mount(NavBar, {
|
const wrapper = mount(NavBar, {
|
||||||
@ -59,7 +59,7 @@ test('should emit click-right event when clicking right text', () => {
|
|||||||
expect(wrapper.emitted('click-right')).toBeTruthy();
|
expect(wrapper.emitted('click-right')).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should add safe-area-inset-top classname when using safe-area-inset-top prop', () => {
|
test('should have safe-area-inset-top class when using safe-area-inset-top prop', () => {
|
||||||
const wrapper = mount(NavBar, {
|
const wrapper = mount(NavBar, {
|
||||||
propsData: {
|
propsData: {
|
||||||
safeAreaInsetTop: true,
|
safeAreaInsetTop: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user