test(NavBar): improve test cases name

This commit is contained in:
chenjiahan 2020-11-08 16:18:21 +08:00 committed by neverland
parent be25a478df
commit e7d9cae593
2 changed files with 14 additions and 14 deletions

View File

@ -1,6 +1,6 @@
// 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__content">
<div class="van-nav-bar__left">Custom Left</div>
@ -10,15 +10,7 @@ exports[`should allow render left/right slot 1`] = `
</div>
`;
exports[`should allow render title slot 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`] = `
exports[`should render placeholder element when using placeholder prop 1`] = `
<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__content">
@ -27,3 +19,11 @@ exports[`should render placeholder element when enabling placeholder prop 1`] =
</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>
`;

View File

@ -1,7 +1,7 @@
import NavBar from '..';
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, {
scopedSlots: {
left: () => 'Custom Left',
@ -12,7 +12,7 @@ test('should allow render left/right slot', () => {
expect(wrapper).toMatchSnapshot();
});
test('should allow render title slot', () => {
test('should render title slot and match snapshot', () => {
const wrapper = mount(NavBar, {
scopedSlots: {
title: () => 'Custom Title',
@ -22,7 +22,7 @@ test('should allow render title slot', () => {
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 wrapper = mount(NavBar, {
@ -59,7 +59,7 @@ test('should emit click-right event when clicking right text', () => {
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, {
propsData: {
safeAreaInsetTop: true,