diff --git a/pages/composition-api/basic/define-model/Foo.uvue b/pages/composition-api/basic/define-model/Foo.uvue new file mode 100644 index 0000000000000000000000000000000000000000..d41a937cda23e3eb0bc705f3d45061d96e6a56e6 --- /dev/null +++ b/pages/composition-api/basic/define-model/Foo.uvue @@ -0,0 +1,20 @@ + + + \ No newline at end of file diff --git a/pages/composition-api/basic/define-model/define-model.test.js b/pages/composition-api/basic/define-model/define-model.test.js new file mode 100644 index 0000000000000000000000000000000000000000..cd1a1e97b8b6e50ba46cc329363aa4557599a3ee --- /dev/null +++ b/pages/composition-api/basic/define-model/define-model.test.js @@ -0,0 +1,37 @@ +const PAGE_PATH = '/pages/composition-api/basic/define-model/define-model' + +describe('defineModel', () => { + 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 modelValueText = await page.$('#model-value-text') + expect(await modelValueText.text()).toBe('modelValue in Foo: str') + + const modelValueInput = await page.$('#model-value-input') + expect(await modelValueInput.property('value')).toBe('str') + + const msgText = await page.$('#msg-text') + expect(await msgText.text()).toBe('msg in Foo: msg') + + const msgInput = await page.$('#msg-input') + expect(await msgInput.property('value')).toBe('msg') + + const updateValueBtn = await page.$('#update-value-btn') + await updateValueBtn.tap() + + expect(await modelValueText.text()).toBe('modelValue in Foo: str1') + expect(await modelValueInput.property('value')).toBe('str1') + + expect(await msgText.text()).toBe('msg in Foo: msg2') + expect(await msgInput.property('value')).toBe('msg2') + }) + } else { + it('other platform', () => { + expect(1).toBe(1) + }) + } +}) \ No newline at end of file diff --git a/pages/composition-api/basic/define-model/define-model.uvue b/pages/composition-api/basic/define-model/define-model.uvue index 80fc798a7894b2ed477b1b8c889fcb04bc437915..28df30b745b6724b1a9543815a7d71b4cec568a5 100644 --- a/pages/composition-api/basic/define-model/define-model.uvue +++ b/pages/composition-api/basic/define-model/define-model.uvue @@ -1,5 +1,31 @@ - + + + \ No newline at end of file diff --git a/pages/tab-bar/composition-api.uvue b/pages/tab-bar/composition-api.uvue index 3d146984311d3327df8b14b06add891fbc4edd63..a011d89f63afb0b4586ee16d7f07c16dea648772 100644 --- a/pages/tab-bar/composition-api.uvue +++ b/pages/tab-bar/composition-api.uvue @@ -67,6 +67,11 @@ url: 'define-slots', enable: true, }, +{ + name: 'defineModel', + url: 'define-model', + enable: true, + }, { name: 'useSlots', url: 'use-slots',