diff --git a/pages/component-instance/props/props-composition.uvue b/pages/component-instance/props/props-composition.uvue index 5b8c276ce8a640aed2ebf44d07d1e31eab2d8da4..236ba8d68cc72981f6da21d4cbfbcfc57040907d 100644 --- a/pages/component-instance/props/props-composition.uvue +++ b/pages/component-instance/props/props-composition.uvue @@ -1,21 +1,28 @@ - - - + + + \ No newline at end of file diff --git a/pages/component-instance/props/props-options.uvue b/pages/component-instance/props/props-options.uvue index a559b767b4ac337015b69295a7ac73f06ffeb796..1aa0e8e5afbd457e403ba8380659cf6b7b964614 100644 --- a/pages/component-instance/props/props-options.uvue +++ b/pages/component-instance/props/props-options.uvue @@ -1,33 +1,41 @@ - - - + + + \ No newline at end of file diff --git a/pages/component-instance/props/props.test.js b/pages/component-instance/props/props.test.js index 7e453ecc8315ffe008194d8efe5f22c3a7e488de..ff659873d35a4197bf0d140b83bb28c8789f15c3 100644 --- a/pages/component-instance/props/props.test.js +++ b/pages/component-instance/props/props.test.js @@ -1,39 +1,42 @@ const OPTIONS_PAGE_PATH = '/pages/component-instance/props/props-options' const COMPOSITION_PAGE_PATH = '/pages/component-instance/props/props-composition' +const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase() +const isAndroid = platformInfo.includes('android') + describe('props', () => { let page const test = async (page) => { const arrayLiteralStr = await page.$('#array-literal-str') expect(await arrayLiteralStr.text()).toBe('str') - + const arrayLiteralNum = await page.$('#array-literal-num') expect(await arrayLiteralNum.text()).toBe('10') - + const arrayLiteralBool = await page.$('#array-literal-bool') expect(await arrayLiteralBool.text()).toBe('true') - + const arrayLiteralObj = await page.$('#array-literal-obj') expect(await arrayLiteralObj.text()).toBe('{"age":18}') - + const arrayLiteralArr = await page.$('#array-literal-arr') expect(await arrayLiteralArr.text()).toBe('["a","b","c"]') - + const objectTypeStr = await page.$('#object-type-str') expect(await objectTypeStr.text()).toBe('str') - + const objectTypeNum = await page.$('#object-type-num') expect(await objectTypeNum.text()).toBe('10') - + const objectTypeBool = await page.$('#object-type-bool') expect(await objectTypeBool.text()).toBe('true') - + const objectTypeObj = await page.$('#object-type-obj') expect(await objectTypeObj.text()).toBe('{"age":18}') - + const objectTypeArr = await page.$('#object-type-arr') expect(await objectTypeArr.text()).toBe('["a","b","c"]') - + const sameNamePropDefaultValueArr = await page.$('#same-name-prop-default-value-arr') expect(await sameNamePropDefaultValueArr.text()).toBe('[1,2,3]') @@ -41,19 +44,22 @@ describe('props', () => { expect(await propMsg.text()).toBe('hello') const propLabels = await page.$('#prop-labels') expect(await propLabels.text()).toBe('["a","b"]') + + const referenceTypeList = await page.$('#reference-type-list') + expect(await referenceTypeList.text()).toBe(isAndroid ? '[1,2,3]' : '["a","b","c"]') } it('props 选项式 API', async () => { page = await program.reLaunch(OPTIONS_PAGE_PATH) await page.waitFor('view') - + await test(page) }); it('props 组合式 API', async () => { page = await program.reLaunch(COMPOSITION_PAGE_PATH) await page.waitFor('view') - + await test(page) }) }) \ No newline at end of file diff --git a/pages/component-instance/props/reference-types-composition.uvue b/pages/component-instance/props/reference-types-composition.uvue new file mode 100644 index 0000000000000000000000000000000000000000..0232c794e65f1575a82625e21caee342670a8e42 --- /dev/null +++ b/pages/component-instance/props/reference-types-composition.uvue @@ -0,0 +1,19 @@ + + \ No newline at end of file diff --git a/pages/component-instance/props/reference-types-options.uvue b/pages/component-instance/props/reference-types-options.uvue new file mode 100644 index 0000000000000000000000000000000000000000..af166c3bd3909e7a8d0766d16ea72e7abd0568d9 --- /dev/null +++ b/pages/component-instance/props/reference-types-options.uvue @@ -0,0 +1,25 @@ + + \ No newline at end of file diff --git a/pages/component-instance/props/types.uts b/pages/component-instance/props/types.uts new file mode 100644 index 0000000000000000000000000000000000000000..e43f2c90dfd8ab7d8950a0d62f61505d13eb84ca --- /dev/null +++ b/pages/component-instance/props/types.uts @@ -0,0 +1,8 @@ +export type ReferenceTypesProps = { + // #ifdef APP-ANDROID + list: number[] + // #endif + // #ifndef APP-ANDROID + list: string[] + // #endif +}