diff --git a/pages.json b/pages.json index ad00c773e2f4fd50e3aaa18a4f31a17a339f897e..f54adc80cd7ea3057bad3b36e44cdcf9bf89d4d8 100644 --- a/pages.json +++ b/pages.json @@ -227,6 +227,20 @@ } }, // #endif + // #ifdef WEB + { + "path": "pages/directive/v-text/v-text-options", + "style": { + "navigationBarTitleText": "v-text 选项式 API" + } + }, + { + "path": "pages/directive/v-text/v-text-composition", + "style": { + "navigationBarTitleText": "v-text 组合式 API" + } + }, + // #endif { diff --git a/pages/directive/v-text/v-text-composition.uvue b/pages/directive/v-text/v-text-composition.uvue new file mode 100644 index 0000000000000000000000000000000000000000..d5ff22fb54c519299acae6ecc15191a390807fb7 --- /dev/null +++ b/pages/directive/v-text/v-text-composition.uvue @@ -0,0 +1,17 @@ + + + diff --git a/pages/directive/v-text/v-text-options.uvue b/pages/directive/v-text/v-text-options.uvue new file mode 100644 index 0000000000000000000000000000000000000000..b575c662486ea0e4db65dc20191cc5212ad8fad8 --- /dev/null +++ b/pages/directive/v-text/v-text-options.uvue @@ -0,0 +1,23 @@ + + + diff --git a/pages/directive/v-text/v-text.test.js b/pages/directive/v-text/v-text.test.js new file mode 100644 index 0000000000000000000000000000000000000000..548a35c0e61bcac51ba5922422f8ac0462593c1b --- /dev/null +++ b/pages/directive/v-text/v-text.test.js @@ -0,0 +1,32 @@ +const OPTIONS_PAGE_PATH = '/pages/directive/v-text/v-text-options' +const COMPOSITION_PAGE_PATH = '/pages/directive/v-text/v-text-composition' + +describe('v-text', () => { + if (!process.env.uniTestPlatformInfo.startsWith('web')) { + // TODO: 仅 web 支持 + it('web', async () => { + expect(1).toBe(1) + }) + return + } + let page + + const test = async (pagePath) => { + page = await program.reLaunch(pagePath) + await page.waitFor('view') + + const vTextText = await page.$('#v-text-text') + expect(await vTextText.text()).toBe('v-text for text') + + const vTextView = await page.$('#v-text-view') + expect(await vTextView.text()).toBe('v-text for view') + } + + it('v-text options API', async () => { + await test(OPTIONS_PAGE_PATH) + }) + + it('v-text composition API', async () => { + await test(COMPOSITION_PAGE_PATH) + }) +}) diff --git a/pages/index/index.uvue b/pages/index/index.uvue index c9b297702a5b391c0ed1f00849bf469792845b7c..d981a72da4b2463797f2424d41f2abf4d673d015 100644 --- a/pages/index/index.uvue +++ b/pages/index/index.uvue @@ -768,6 +768,28 @@ export default { }, ] }, + { + id: 'v-text', + name: 'v-text', + children: [ + { + id: 'v-text-options', + name: 'v-text 选项式 API', + url: 'v-text-options', + // #ifdef APP + enable: false + // #endif + }, + { + id: 'v-text-composition', + name: 'v-text 组合式 API', + url: 'v-text-composition', + // #ifdef APP + enable: false + // #endif + }, + ] + }, ] }, { diff --git a/refactor_options-API-composition-API-correspondence.md b/refactor_options-API-composition-API-correspondence.md index cdd88db85f90c5e8b8fa3fad3af92a4acdd889f8..0ea2527229a5e2073b8fff004f0b08338f25fe5b 100644 --- a/refactor_options-API-composition-API-correspondence.md +++ b/refactor_options-API-composition-API-correspondence.md @@ -164,7 +164,7 @@ function transform(fileInfo, api) { - [x] v-pre - [x] v-once - [x] v-memo -- [ ] v-text 暂不支持 +- [x] v-text - [ ] v-cloak 暂不支持 ## lifecycle