提交 4b51c6ad 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

feat(error): 运行时异常示例及测试

上级 4acfe5e6
...@@ -764,6 +764,18 @@ ...@@ -764,6 +764,18 @@
"navigationBarTitleText": "", "navigationBarTitleText": "",
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
},
{
"path": "pages/error/runtime-error/runtime-error-options",
"style": {
"navigationBarTitleText": "runtime error 选项式 API"
}
},
{
"path": "pages/error/runtime-error/runtime-error-composition",
"style": {
"navigationBarTitleText": "runtime error 组合式 API"
}
} }
], ],
"globalStyle": { "globalStyle": {
......
<template>
<view class="page">
<text>{{ arr[1] }}</text>
</view>
</template>
<script setup lang="uts">
const arr = [0]
</script>
<template>
<view class="page">
<text>{{ arr[1] }}</text>
</view>
</template>
<script lang="uts">
export default {
data(){
return {
arr: [0]
}
}
}
</script>
const OPTIONS_PAGE_PATH = '/pages/error/runtime-error/runtime-error-options'
const COMPOSITION_PAGE_PATH = '/pages/error/runtime-error/runtime-error-composition'
const HOME_PAGE = '/pages/index/index'
describe('运行时异常', () => {
let page
const test = async (pagePath) => {
page = await program.reLaunch(pagePath)
await page.waitFor(1000)
expect(page.path).toBe(pagePath.substring(1))
page = await program.navigateTo(HOME_PAGE)
await page.waitFor(1000)
expect(page.path).toBe(HOME_PAGE.substring(1))
}
it('数组下标越位 options API', async () => {
await test(OPTIONS_PAGE_PATH)
})
it('数组下标越位 composition API', async () => {
await test(COMPOSITION_PAGE_PATH)
})
})
...@@ -884,6 +884,28 @@ export default { ...@@ -884,6 +884,28 @@ export default {
] ]
} }
] as Page[] ] as Page[]
},
{
id: 'error',
name: '异常示例',
pages: [
{
id: 'runtime-error',
name: '运行时异常',
children: [
{
id: 'runtime-error-options',
name: '运行时异常 选项式 API',
url: 'runtime-error-options'
},
{
id: 'runtime-error-composition',
name: '运行时异常 组合式 API',
url: 'runtime-error-composition'
},
]
}
]
} }
] as Menu[] ] as Menu[]
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册