diff --git a/pages/composition-api/reactivity/to-ref/to-ref.test.js b/pages/composition-api/reactivity/to-ref/to-ref.test.js index 49ff1a26001826b22a072354d1f195ebcddc9576..8ef2bf53172ac1274ee86bbb9251fd6f5dc63d57 100644 --- a/pages/composition-api/reactivity/to-ref/to-ref.test.js +++ b/pages/composition-api/reactivity/to-ref/to-ref.test.js @@ -9,26 +9,26 @@ describe('toRef', () => { }) it('basic', async () => { const count = await page.$('#count') - expect(await count.text()).toBe('count: 0') - const isRefCount = await page.$('#is-ref-count') - expect(await isRefCount.text()).toBe('isRef count: false') - const refCount = await page.$('#ref-count') - expect(await refCount.text()).toBe('ref count: 0') - const isRefRefCount = await page.$('#is-ref-ref-count') + expect(await count.text()).toBe('count: 0') + const isRefCount = await page.$('#is-ref-count') + expect(await isRefCount.text()).toBe('isRef count: false') + const refCount = await page.$('#ref-count') + expect(await refCount.text()).toBe('ref count: 0') + const isRefRefCount = await page.$('#is-ref-ref-count') expect(await isRefRefCount.text()).toBe('isRef ref count: true') - - const objNum = await page.$('#obj-num') - expect(await objNum.text()).toBe('obj.num: 0') - const toRefObjNum = await page.$('#to-ref-obj-num') - expect(await toRefObjNum.text()).toBe('toRef(obj, "num"): 0') - const toRefFnObjNum = await page.$('#to-ref-fn-obj-num') - expect(await toRefFnObjNum.text()).toBe('toRef(() => obj.num): 0') - - const incrementBtn = await page.$('#increment-btn') - await incrementBtn.tap() - - expect(await objNum.text()).toBe('obj.num: 2') - expect(await toRefObjNum.text()).toBe('toRef(obj, "num"): 2') + + const objNum = await page.$('#obj-num') + expect(await objNum.text()).toBe('obj.num: 0') + const toRefObjNum = await page.$('#to-ref-obj-num') + expect(await toRefObjNum.text()).toBe('toRef(obj, "num"): 0') + const toRefFnObjNum = await page.$('#to-ref-fn-obj-num') + expect(await toRefFnObjNum.text()).toBe('toRef(() => obj.num): 0') + + const incrementBtn = await page.$('#increment-btn') + await incrementBtn.tap() + + expect(await objNum.text()).toBe('obj.num: 2') + expect(await toRefObjNum.text()).toBe('toRef(obj, "num"): 2') expect(await toRefFnObjNum.text()).toBe('toRef(() => obj.num): 2') }) } else { diff --git a/pages/composition-api/reactivity/to-refs/to-refs.test.js b/pages/composition-api/reactivity/to-refs/to-refs.test.js new file mode 100644 index 0000000000000000000000000000000000000000..f4d53eec6dbb8327e5766b401ce5db07c29fef8b --- /dev/null +++ b/pages/composition-api/reactivity/to-refs/to-refs.test.js @@ -0,0 +1,33 @@ +const PAGE_PATH = '/pages/composition-api/reactivity/to-refs/to-refs' + +describe('toRefs', () => { + 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 stateNum = await page.$('#state-num') + expect(await stateNum.text()).toBe('state.num: 0') + const stateStr = await page.$('#state-str') + expect(await stateStr.text()).toBe('state.str: str-0') + const stateAsRefsNum = await page.$('#state-as-refs-num') + expect(await stateAsRefsNum.text()).toBe('stateAsRefs.num: 0') + const stateAsRefsStr = await page.$('#state-as-refs-str') + expect(await stateAsRefsStr.text()).toBe('stateAsRefs.str: str-0') + + const updateStateBtn = await page.$('#update-state-btn') + await updateStateBtn.tap() + + expect(await stateNum.text()).toBe('state.num: 1') + expect(await stateStr.text()).toBe('state.str: str-1') + expect(await stateAsRefsNum.text()).toBe('stateAsRefs.num: 1') + expect(await stateAsRefsStr.text()).toBe('stateAsRefs.str: str-1') + }) + } else { + it('other platform', () => { + expect(1).toBe(1) + }) + } +}) \ No newline at end of file diff --git a/pages/composition-api/reactivity/to-refs/to-refs.uvue b/pages/composition-api/reactivity/to-refs/to-refs.uvue index ada9eb66f705c6a8292e271f74936694c32fd1ce..9f46c03981197021e938bee1eb1172cfc97d02bd 100644 --- a/pages/composition-api/reactivity/to-refs/to-refs.uvue +++ b/pages/composition-api/reactivity/to-refs/to-refs.uvue @@ -1 +1,26 @@ - \ 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 1fdf26d54498e954e48d6d68f6e8e272c341d970..8db84d9b5941ef551f3769cdc2d5fe7d5b940008 100644 --- a/pages/tab-bar/composition-api.uvue +++ b/pages/tab-bar/composition-api.uvue @@ -146,7 +146,7 @@ { name: 'toRefs', url: 'to-refs', - enable: false, + enable: true, }, { name: 'isProxy',