diff --git a/pages/composition-api/reactivity/effect-scope/effect-scope.test.js b/pages/composition-api/reactivity/effect-scope/effect-scope.test.js new file mode 100644 index 0000000000000000000000000000000000000000..ec421d99afe55fba5ffbd9a56fec6e6567a89340 --- /dev/null +++ b/pages/composition-api/reactivity/effect-scope/effect-scope.test.js @@ -0,0 +1,42 @@ +const PAGE_PATH = '/pages/composition-api/reactivity/effect-scope/effect-scope' + +describe('effectScope', () => { + if (process.env.uniTestPlatformInfo.startsWith('android')) { + let page = null + beforeAll(async () => { + page = await program.reLaunch(PAGE_PATH) + await page.waitFor('view') + }) + it('basic', async () => { + const counter = await page.$('#counter') + expect(await counter.text()).toBe('counter: 0') + + const watchCounterRes = await page.$('#watch-counter-res') + expect(await watchCounterRes.text()).toBe('watch counter result: ') + + const watchEffectCounterRes = await page.$('#watch-effect-counter-res') + expect(await watchEffectCounterRes.text()).toBe('watchEffect counter result: counter: 0') + + const incrementCounterBtn = await page.$('#increment-counter-btn') + await incrementCounterBtn.tap() + + expect(await counter.text()).toBe('counter: 1') + expect(await watchCounterRes.text()).toBe('watch counter result: newVal: 1, oldVal: 0') + expect(await watchEffectCounterRes.text()).toBe('watchEffect counter result: counter: 1') + + const stopEffectScopeBtn = await page.$('#stop-effect-scope-btn') + await stopEffectScopeBtn.tap() + + await incrementCounterBtn.tap() + + expect(await counter.text()).toBe('counter: 2') + expect(await watchCounterRes.text()).toBe('watch counter result: newVal: 1, oldVal: 0') + expect(await watchEffectCounterRes.text()).toBe('watchEffect counter result: counter: 1') + + }) + } else { + it('other platform', () => { + expect(1).toBe(1) + }) + } +}) \ No newline at end of file diff --git a/pages/composition-api/reactivity/effect-scope/effect-scope.uvue b/pages/composition-api/reactivity/effect-scope/effect-scope.uvue index b3c77f941aa299f0f4693a4b4a6b9a7ceed0bd32..524abff142f54a94a9cfacc790549a119fac5924 100644 --- a/pages/composition-api/reactivity/effect-scope/effect-scope.uvue +++ b/pages/composition-api/reactivity/effect-scope/effect-scope.uvue @@ -1 +1,32 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/pages/tab-bar/composition-api.uvue b/pages/tab-bar/composition-api.uvue index 06954a2f11f6b97f1cbe681f1b81b243a5fef08e..2a88a10679ecda9674650891337b57a7b8cf41ca 100644 --- a/pages/tab-bar/composition-api.uvue +++ b/pages/tab-bar/composition-api.uvue @@ -201,7 +201,7 @@ { name: 'effectScope', url: 'effect-scope', - enable: false, + enable: true, }, { name: 'getCurrentScope',