From 4b0db2b9929f6e621785aa87529b4f0e567eb766 Mon Sep 17 00:00:00 2001
From: zhenyuWang <13641039885@163.com>
Date: Wed, 17 Jan 2024 10:59:02 +0800
Subject: [PATCH] feat(composition api): onScopeDispose
---
.../on-scope-dispose/on-scope-dispose.test.js | 29 ++++++++++++++++++
.../on-scope-dispose/on-scope-dispose.uvue | 30 ++++++++++++++++++-
pages/tab-bar/composition-api.uvue | 2 +-
3 files changed, 59 insertions(+), 2 deletions(-)
create mode 100644 pages/composition-api/reactivity/on-scope-dispose/on-scope-dispose.test.js
diff --git a/pages/composition-api/reactivity/on-scope-dispose/on-scope-dispose.test.js b/pages/composition-api/reactivity/on-scope-dispose/on-scope-dispose.test.js
new file mode 100644
index 0000000..7c37daa
--- /dev/null
+++ b/pages/composition-api/reactivity/on-scope-dispose/on-scope-dispose.test.js
@@ -0,0 +1,29 @@
+const PAGE_PATH = '/pages/composition-api/reactivity/on-scope-dispose/on-scope-dispose'
+
+describe('onScopeDispose', () => {
+ 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 hasCurrentScope = await page.$('#has-current-scope')
+ expect(await hasCurrentScope.text()).toBe('hasCurrentScope: false')
+
+ const createScopeBtn = await page.$('#create-scope-btn')
+ await createScopeBtn.tap()
+
+ expect(await hasCurrentScope.text()).toBe('hasCurrentScope: true')
+
+ const stopScopeBtn = await page.$('#stop-scope-btn')
+ await stopScopeBtn.tap()
+
+ expect(await hasCurrentScope.text()).toBe('hasCurrentScope: false')
+ })
+ } else {
+ it('other platform', () => {
+ expect(1).toBe(1)
+ })
+ }
+})
\ No newline at end of file
diff --git a/pages/composition-api/reactivity/on-scope-dispose/on-scope-dispose.uvue b/pages/composition-api/reactivity/on-scope-dispose/on-scope-dispose.uvue
index 6de43ac..f0af9cb 100644
--- a/pages/composition-api/reactivity/on-scope-dispose/on-scope-dispose.uvue
+++ b/pages/composition-api/reactivity/on-scope-dispose/on-scope-dispose.uvue
@@ -1 +1,29 @@
- onScopeDispose
\ No newline at end of file
+
+
+ hasCurrentScope: {{ hasCurrentScope }}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/tab-bar/composition-api.uvue b/pages/tab-bar/composition-api.uvue
index 6a86d42..5757268 100644
--- a/pages/tab-bar/composition-api.uvue
+++ b/pages/tab-bar/composition-api.uvue
@@ -211,7 +211,7 @@
{
name: 'onScopeDispose',
url: 'on-scope-dispose',
- enable: false,
+ enable: true,
},
] as PageItem[],
}
--
GitLab