提交 8c1900b9 编写于 作者: W wangjinxin613

test(watch-effect):调整示例兼容 safari

上级 3fd967a7
const PAGE_PATH = '/pages/composition-api/reactivity/watch-effect/watch-effect' const PAGE_PATH = '/pages/composition-api/reactivity/watch-effect/watch-effect'
describe('watchEffect', () => { describe('watchEffect', () => {
const isSafari = process.env.uniTestPlatformInfo.indexOf('safari') > -1
let page = null let page = null
beforeAll(async () => { beforeAll(async () => {
page = await program.reLaunch(PAGE_PATH) page = await program.reLaunch(PAGE_PATH)
...@@ -76,7 +77,7 @@ describe('watchEffect', () => { ...@@ -76,7 +77,7 @@ describe('watchEffect', () => {
const objBool = await page.$('#obj-bool') const objBool = await page.$('#obj-bool')
expect(await objBool.text()).toBe('obj.bool: false') expect(await objBool.text()).toBe('obj.bool: false')
const objArr = await page.$('#obj-arr') const objArr = await page.$('#obj-arr')
expect(await objArr.text()).toBe('obj.arr: [0]') expect(await objArr.text()).toBe(isSafari ? 'obj.arr: [ 0]' : 'obj.arr: [0]')
const watchObjRes = await page.$('#watch-obj-res') const watchObjRes = await page.$('#watch-obj-res')
if (process.env.uniTestPlatformInfo.startsWith('android')) { if (process.env.uniTestPlatformInfo.startsWith('android')) {
...@@ -104,7 +105,7 @@ describe('watchEffect', () => { ...@@ -104,7 +105,7 @@ describe('watchEffect', () => {
expect(await objStr.text()).toBe('obj.str: num: 1') expect(await objStr.text()).toBe('obj.str: num: 1')
expect(await objNum.text()).toBe('obj.num: 1') expect(await objNum.text()).toBe('obj.num: 1')
expect(await objBool.text()).toBe('obj.bool: true') expect(await objBool.text()).toBe('obj.bool: true')
expect(await objArr.text()).toBe('obj.arr: [0,1]') expect(await objArr.text()).toBe(isSafari ? 'obj.arr: [ 0, 1]' : 'obj.arr: [0,1]')
if (process.env.uniTestPlatformInfo.startsWith('android')) { if (process.env.uniTestPlatformInfo.startsWith('android')) {
expect(await watchObjRes.text()).toBe( expect(await watchObjRes.text()).toBe(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册