From 70460407b01c74684eda6b5c33abf6e652583046 Mon Sep 17 00:00:00 2001
From: zhenyuWang <13641039885@163.com>
Date: Tue, 16 Jan 2024 21:35:45 +0800
Subject: [PATCH] feat(composition api): toRaw
---
.../reactivity/to-raw/to-raw.test.js | 31 +++++++++++++++++++
.../reactivity/to-raw/to-raw.uvue | 31 ++++++++++++++++++-
pages/tab-bar/composition-api.uvue | 2 +-
3 files changed, 62 insertions(+), 2 deletions(-)
create mode 100644 pages/composition-api/reactivity/to-raw/to-raw.test.js
diff --git a/pages/composition-api/reactivity/to-raw/to-raw.test.js b/pages/composition-api/reactivity/to-raw/to-raw.test.js
new file mode 100644
index 0000000..9147fe4
--- /dev/null
+++ b/pages/composition-api/reactivity/to-raw/to-raw.test.js
@@ -0,0 +1,31 @@
+const PAGE_PATH = '/pages/composition-api/reactivity/to-raw/to-raw'
+
+describe('toRaw', () => {
+ 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 checkToRawRef = await page.$('#check-to-raw-ref')
+ expect(await checkToRawRef.text()).toBe('check toRaw ref: false')
+
+ const checkToRawReactive = await page.$('#check-to-raw-reactive')
+ expect(await checkToRawReactive.text()).toBe('check toRaw reactive: true')
+
+ const checkToRawReadonly = await page.$('#check-to-raw-readonly')
+ expect(await checkToRawReadonly.text()).toBe('check toRaw readonly: true')
+
+ const checkToRawShallowReactive = await page.$('#check-to-raw-shallow-reactive')
+ expect(await checkToRawShallowReactive.text()).toBe('check toRaw shallowReactive: true')
+
+ const checkToRawShallowReadonly = await page.$('#check-to-raw-shallow-readonly')
+ expect(await checkToRawShallowReadonly.text()).toBe('check toRaw shallowReadonly: true')
+ })
+ } else {
+ it('other platform', () => {
+ expect(1).toBe(1)
+ })
+ }
+})
\ No newline at end of file
diff --git a/pages/composition-api/reactivity/to-raw/to-raw.uvue b/pages/composition-api/reactivity/to-raw/to-raw.uvue
index acad9dd..9a42e4a 100644
--- a/pages/composition-api/reactivity/to-raw/to-raw.uvue
+++ b/pages/composition-api/reactivity/to-raw/to-raw.uvue
@@ -1 +1,30 @@
- toRaw
\ No newline at end of file
+
+
+ check toRaw ref: {{ checkToRawRef }}
+ check toRaw reactive: {{ checkToRawReactive }}
+ check toRaw readonly: {{ checkToRawReadonly }}
+ check toRaw shallowReactive:
+ {{ checkToRawShallowReactive }}
+ check toRaw shallowReadonly:
+ {{ checkToRawShallowReadonly }}
+
+
+
+
\ No newline at end of file
diff --git a/pages/tab-bar/composition-api.uvue b/pages/tab-bar/composition-api.uvue
index 7ab9bae..06954a2 100644
--- a/pages/tab-bar/composition-api.uvue
+++ b/pages/tab-bar/composition-api.uvue
@@ -191,7 +191,7 @@
{
name: 'toRaw',
url: 'to-raw',
- enable: false,
+ enable: true,
},
{
name: 'markRaw',
--
GitLab