From 7463132315bf5139f813261ce34bec93202ee2a3 Mon Sep 17 00:00:00 2001 From: fxy060608 <153647646@qq.com> Date: Tue, 24 Sep 2024 16:16:06 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E8=B0=83=E6=95=B4=20reactive=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../reactivity/core/reactive/reactive.test.js | 28 +++++++++---------- pages/reactivity/core/reactive/reactive.uvue | 4 +-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/pages/reactivity/core/reactive/reactive.test.js b/pages/reactivity/core/reactive/reactive.test.js index f3eb461..6addb75 100644 --- a/pages/reactivity/core/reactive/reactive.test.js +++ b/pages/reactivity/core/reactive/reactive.test.js @@ -17,9 +17,9 @@ describe('reactive', () => { expect(await objNum.text()).toBe('0') const objArr = await page.$('#obj-arr') - expect(await objArr.text()).toBe('["a","b","c"]') - - const arr1 = await page.$('#arr1') + expect(await objArr.text()).toBe('["a","b","c"]') + + const arr1 = await page.$('#arr1') expect(await arr1.text()).toBe('[]') const updateCountBtn = await page.$('#update-count-btn') @@ -40,18 +40,18 @@ describe('reactive', () => { expect(await objArr.text()).toBe('["a","b","c","d"]') const count1 = await page.$('#count1') - expect(await count1.text()).toBe('1') - + expect(await count1.text()).toBe('1') + const updateObj_A_B_C_Btn = await page.$('#update-obj1-a-b-c-btn') await updateObj_A_B_C_Btn.tap() - expect(await count1.text()).toBe('2') - - const updateArr1Btn = await page.$('#update-arr1-btn') - await updateArr1Btn.tap() - expect(await arr1.text()).toBe('[1,2,3]') - - const updateArr1ReactiveBtn = await page.$('#update-arr1-reactive-btn') - await updateArr1ReactiveBtn.tap() - expect(await arr1.text()).toBe('[4,5,6]') + expect(await count1.text()).toBe('2') + + const updateArr1Btn = await page.$('#update-arr1-btn') + await updateArr1Btn.tap() + expect(await arr1.text()).toBe(JSON.stringify([1, 2, 3])) + + const updateArr1ReactiveBtn = await page.$('#update-arr1-reactive-btn') + await updateArr1ReactiveBtn.tap() + expect(await arr1.text()).toBe(JSON.stringify([4, 5, 6])) }) }) \ No newline at end of file diff --git a/pages/reactivity/core/reactive/reactive.uvue b/pages/reactivity/core/reactive/reactive.uvue index f7f6a5a..b6a7abe 100644 --- a/pages/reactivity/core/reactive/reactive.uvue +++ b/pages/reactivity/core/reactive/reactive.uvue @@ -26,7 +26,7 @@ arr1(spread): - {{ arr1 }} + {{ JSON.stringify(arr1) }} @@ -66,7 +66,7 @@ const obj1 = reactive({ a: { b: { c: 'c' } } - }) + } as UTSJSONObject) const count1 = ref(0) watchEffect(() => { -- GitLab