提交 e3538203 编写于 作者: fxy060608's avatar fxy060608

chore: tests

上级 c45cd37d
......@@ -16,12 +16,9 @@ const defaultRoute = 'pages/index/index'
describe('webviewStyle', () => {
test('basic', () => {
expect(
parseWebviewStyle(1, defaultPath, {
path: defaultPath,
meta: {
route: defaultRoute,
navigationBar: {},
},
parseWebviewStyle(defaultPath, {
route: defaultRoute,
navigationBar: {},
})
).toMatchSnapshot()
})
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`page mergePageMeta 1`] = `
exports[`page initRouteMeta 1`] = `
Object {
"id": 1,
"navigationBar": Object {
......@@ -11,7 +11,7 @@ Object {
}
`;
exports[`page mergePageMeta 2`] = `
exports[`page initRouteMeta 2`] = `
Object {
"enablePullDownRefresh": true,
"id": 1,
......@@ -24,7 +24,7 @@ Object {
}
`;
exports[`page mergePageMeta 3`] = `
exports[`page initRouteMeta 3`] = `
Object {
"enablePullDownRefresh": true,
"id": 1,
......
import { mergePageMeta } from '../../src/helpers/page'
import { initRouteMeta } from '../../src/helpers/page'
function initDefaultUniConfig() {
return JSON.parse(
......@@ -11,31 +11,40 @@ function initDefaultUniConfig() {
}
describe('page', () => {
test('mergePageMeta', () => {
test('initRouteMeta', () => {
global.__uniConfig = initDefaultUniConfig()
global.__uniConfig.globalStyle.navigationBar.titleText = 'uni-app'
expect(
mergePageMeta(1, {
route: '',
navigationBar: {},
})
initRouteMeta(
{
route: '',
navigationBar: {},
},
1
)
).toMatchSnapshot()
expect(
mergePageMeta(1, {
route: '',
navigationBar: { titleText: 'hello', titleColor: '#000000' },
enablePullDownRefresh: true,
})
initRouteMeta(
{
route: '',
navigationBar: { titleText: 'hello', titleColor: '#000000' },
enablePullDownRefresh: true,
},
1
)
).toMatchSnapshot()
expect(
mergePageMeta(1, {
route: '',
navigationBar: { titleColor: '#000000' },
enablePullDownRefresh: true,
pullToRefresh: {
offset: 100,
initRouteMeta(
{
route: '',
navigationBar: { titleColor: '#000000' },
enablePullDownRefresh: true,
pullToRefresh: {
offset: 100,
},
},
})
1
)
).toMatchSnapshot()
})
})
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册