diff --git a/pages/composition-api/basic/define-expose/define-expose.test.js b/pages/composition-api/basic/define-expose/define-expose.test.js index e4ea03d3aa6e143b1bebbf5ceb2e9916d2dc5c4a..5ab000e6e569e86d3ba9465de3de804445478ac5 100644 --- a/pages/composition-api/basic/define-expose/define-expose.test.js +++ b/pages/composition-api/basic/define-expose/define-expose.test.js @@ -12,7 +12,7 @@ describe('defineExpose', () => { const fooNum = await page.$('#foo-num') expect(await fooNum.text()).toBe('num from component Foo: 0') - const incrementBtn = await page.$('#increment-btn') + const incrementBtn = await page.$('.increment-btn') await incrementBtn.tap() expect(await fooNum.text()).toBe('num from component Foo: 1') diff --git a/pages/composition-api/basic/define-expose/define-expose.uvue b/pages/composition-api/basic/define-expose/define-expose.uvue index d5de479a93502d648f86815f56f4ca519e070ab3..c5d20b7017a5e6b73f434316742299e561080cb5 100644 --- a/pages/composition-api/basic/define-expose/define-expose.uvue +++ b/pages/composition-api/basic/define-expose/define-expose.uvue @@ -3,7 +3,7 @@ str from component Foo: {{fooStr}} num from component Foo: {{fooNum}} - + diff --git a/pages/composition-api/basic/use-slots/Foo.uvue b/pages/composition-api/basic/use-slots/Foo.uvue index bea3cb5da712f15b902016044085f8e37ab5dafc..a58efe71d87e06b7169835dc760e2b48c188c0e1 100644 --- a/pages/composition-api/basic/use-slots/Foo.uvue +++ b/pages/composition-api/basic/use-slots/Foo.uvue @@ -4,7 +4,7 @@ check useSlots result: {{ checkUseSlotsRes }} - diff --git a/pages/composition-api/basic/use-slots/use-slots.test.js b/pages/composition-api/basic/use-slots/use-slots.test.js index 796c84befd6dbd1bafe413c16360af98c708b801..ab45886c80df7a083dd1a18ed9c343cf77ca4d32 100644 --- a/pages/composition-api/basic/use-slots/use-slots.test.js +++ b/pages/composition-api/basic/use-slots/use-slots.test.js @@ -14,12 +14,12 @@ describe('useSlots', () => { expect(await slotContent.text()).toBe('default slot msg: default msg') const slotFooter = await page.$('#slot-footer') - expect(await slotFooter.text()).toBe('footer slot arr: ["a","b","c"]') + expect((await slotFooter.text()).replaceAll('\n', '')).toBe('footer slot arr: ["a","b","c"]') const checkUseSlotsRes = await page.$('#check-use-slots-res') expect(await checkUseSlotsRes.text()).toBe('check useSlots result: false') - const checkUseSlotsBtn = await page.$('#check-use-slots-btn') + const checkUseSlotsBtn = await page.$('.check-use-slots-btn') await checkUseSlotsBtn.tap() expect(await checkUseSlotsRes.text()).toBe('check useSlots result: true') diff --git a/pages/composition-api/dependency-injection/provide/inject.uvue b/pages/composition-api/dependency-injection/provide/inject.uvue index 3b52b5f8a625ac8eb44da06a919556a2bf067b79..58f09a83ff1bf89d6e42658c258decd0ce4087df 100644 --- a/pages/composition-api/dependency-injection/provide/inject.uvue +++ b/pages/composition-api/dependency-injection/provide/inject.uvue @@ -7,7 +7,7 @@ arr: {{arr}} fn: {{(fn as () => string)()}} hasInjectionContext: - {{checkHasInjectionContextRes}} + {{checkHasInjectionContextRes}} @@ -17,12 +17,15 @@ const num = inject('num') const obj = inject('obj') const arr = inject('arr') - const fn = inject('fn') - + const fn = inject('fn') + const checkHasInjectionContextRes = ref('') const checkHasInjectionContext = () => { + // TODO: web vue 版本低导致 hasInjectionContext 不支持, 待支持后调整 + // #ifdef APP checkHasInjectionContextRes.value = `${hasInjectionContext()}` - } + // #endif + } checkHasInjectionContext() \ No newline at end of file diff --git a/pages/composition-api/dependency-injection/provide/provide-inject.test.js b/pages/composition-api/dependency-injection/provide/provide-inject.test.js index 7ec742e986cff83b3f4c61a1f7799fe44740398c..6e71429ac6e84f4605b80fd2bb1622978f5245c1 100644 --- a/pages/composition-api/dependency-injection/provide/provide-inject.test.js +++ b/pages/composition-api/dependency-injection/provide/provide-inject.test.js @@ -23,12 +23,14 @@ describe('provide-inject-hasInjectionContext', () => { const fn = await page.$('.fn') expect(await fn.text()).toBe('fn: hello') - const hasInjectionContext = await page.$('.has-injection-context') - expect(await hasInjectionContext.text()).toBe('hasInjectionContext: true') + if (process.env.uniTestPlatformInfo.startsWith('android')) { + const hasInjectionContext = await page.$('.has-injection-context') + expect(await hasInjectionContext.text()).toBe('hasInjectionContext: true') - const checkHasInjectionContextBtn = await page.$('.check-has-injection-context-btn') - await checkHasInjectionContextBtn.tap() - - expect(await hasInjectionContext.text()).toBe('hasInjectionContext: false') + const checkHasInjectionContextBtn = await page.$('.check-has-injection-context-btn') + await checkHasInjectionContextBtn.tap() + + expect(await hasInjectionContext.text()).toBe('hasInjectionContext: false') + } }) }) \ No newline at end of file diff --git a/pages/composition-api/reactivity/custom-ref/custom-ref.test.js b/pages/composition-api/reactivity/custom-ref/custom-ref.test.js index 9f418407b8c3655efbc362c87ed0e1504bbdef6b..4fb8ecfc27cb8b15d486754c0628b3288aa5f20b 100644 --- a/pages/composition-api/reactivity/custom-ref/custom-ref.test.js +++ b/pages/composition-api/reactivity/custom-ref/custom-ref.test.js @@ -10,14 +10,17 @@ describe('customRef', () => { const stateCount = await page.$('#state-count') expect(await stateCount.text()).toBe('state.count: 0') - const incrementBtn = await page.$('#increment-btn') + const incrementBtn = await page.$('.increment-btn') await incrementBtn.tap() expect(await stateCount.text()).toBe('state.count: 0') + + // TODO: web 暂不支持 triggerRef + if (process.env.uniTestPlatformInfo.startsWith('android')) { + const triggerRefBtn = await page.$('.trigger-ref-btn') + await triggerRefBtn.tap() - const triggerRefBtn = await page.$('#trigger-ref-btn') - await triggerRefBtn.tap() - - expect(await stateCount.text()).toBe('state.count: 1') + expect(await stateCount.text()).toBe('state.count: 1') + } }) }) \ No newline at end of file diff --git a/pages/composition-api/reactivity/custom-ref/custom-ref.uvue b/pages/composition-api/reactivity/custom-ref/custom-ref.uvue index d0e3292e2da86bfa7683d943caf2bd679bb61660..2af6b8cd826468b93b79d45e32c5e414f67174da 100644 --- a/pages/composition-api/reactivity/custom-ref/custom-ref.uvue +++ b/pages/composition-api/reactivity/custom-ref/custom-ref.uvue @@ -1,8 +1,8 @@ diff --git a/pages/composition-api/reactivity/reactive/reactive.test.js b/pages/composition-api/reactivity/reactive/reactive.test.js index 20c4af429c04b75f7a7d885a66954fcf03ed6700..ad696250bd45b60f010a10e35bb4c6f04d3c6c73 100644 --- a/pages/composition-api/reactivity/reactive/reactive.test.js +++ b/pages/composition-api/reactivity/reactive/reactive.test.js @@ -17,14 +17,14 @@ describe('reactive', () => { expect(await objNum.text()).toBe('obj.num: 0') const objArr = await page.$('#obj-arr') - expect(await objArr.text()).toBe('obj.arr: ["a","b","c"]') + expect((await objArr.text()).replaceAll('\n', '')).toBe('obj.arr: ["a","b","c"]') - const updateBtn = await page.$('#update-btn') + const updateBtn = await page.$('.update-btn') await updateBtn.tap() expect(await count.text()).toBe('count: 2') expect(await objStr.text()).toBe('obj.str: new str') expect(await objNum.text()).toBe('obj.num: 2') - expect(await objArr.text()).toBe('obj.arr: ["a","b","c","d"]') + expect((await objArr.text()).replaceAll('\n', '')).toBe('obj.arr: ["a","b","c","d"]') }) }) \ No newline at end of file diff --git a/pages/composition-api/reactivity/reactive/reactive.uvue b/pages/composition-api/reactivity/reactive/reactive.uvue index a71c5dcb8dba4d1421b48bef5a46b180a4c36d1c..7c061675b3f52961841a2dd353b4e73ae0a4a45d 100644 --- a/pages/composition-api/reactivity/reactive/reactive.uvue +++ b/pages/composition-api/reactivity/reactive/reactive.uvue @@ -4,7 +4,7 @@ obj.str: {{obj['str']}} obj.num: {{obj['num']}} obj.arr: {{obj['arr']}} - +