From dce25de47bc05ca58cda93a9eb3a5871f48fed42 Mon Sep 17 00:00:00 2001 From: wangyaqi Date: Mon, 22 Jan 2024 14:41:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=BC=80=E6=94=BE=E9=83=A8=E5=88=86web?= =?UTF-8?q?=E7=AB=AF=E6=B5=8B=E8=AF=95=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.uts | 4 - pages/app-instance/index/index.test.js | 40 +- pages/app-instance/index/index.uvue | 8 +- .../force-update/force-update.test.js | 33 +- pages/component-instance/parent/child.uvue | 4 - .../basic/define-expose/define-expose.test.js | 38 +- .../basic/define-model/define-model.test.js | 48 +- .../basic/use-slots/use-slots.test.js | 52 +- .../reactivity/custom-ref/custom-ref.test.js | 40 +- .../effect-scope/effect-scope.test.js | 70 +- .../get-current-scope.test.js | 34 +- .../reactivity/is-proxy/is-proxy.test.js | 54 +- .../is-reactive/is-reactive.test.js | 44 +- .../is-readonly/is-readonly.test.js | 44 +- .../on-scope-dispose/on-scope-dispose.test.js | 36 +- .../reactivity/reactive/reactive.test.js | 48 +- .../reactivity/readonly/readonly.test.js | 76 +- .../shallow-readonly/shallow-readonly.test.js | 56 +- .../reactivity/to-raw/to-raw.test.js | 40 +- .../reactivity/to-ref/to-ref.test.js | 58 +- .../reactivity/to-refs/to-refs.test.js | 48 +- .../reactivity/to-value/to-value.test.js | 56 +- .../trigger-ref/trigger-ref.test.js | 36 +- .../watch-post-effect.test.js | 210 +++-- .../watch-sync-effect.test.js | 210 +++-- pages/composition/mixins/mixins-page2.test.js | 165 ++-- pages/composition/mixins/mixins.test.js | 833 +++++++++--------- .../composition/provide/provide-page2.test.js | 141 ++- pages/composition/provide/provide.test.js | 197 ++--- pages/composition/setup/setup.test.js | 169 ++-- pages/directive/v-memo/v-memo.test.js | 77 +- pages/directive/v-once/v-once.test.js | 39 +- pages/rendering/render/render.test.js | 53 +- pages/tab-bar/composition-api.uvue | 110 --- pages/tab-bar/options-api.uvue | 30 - 35 files changed, 1443 insertions(+), 1758 deletions(-) diff --git a/main.uts b/main.uts index 0ee20ce..194fccd 100644 --- a/main.uts +++ b/main.uts @@ -9,13 +9,11 @@ import GlobalChildMixinComp2 from '@/pages/composition/mixins/components/GlobalC import MixinCompForGlobalMixin from '@/pages/composition/mixins/components/MixinCompForGlobalMixin.uvue' import MixinCompForGlobalChildMixin from '@/pages/composition/mixins/components/MixinCompForGlobalChildMixin.uvue' -// #ifdef APP-ANDROID import plugin1 from '@/plugins/plugin1.uts' import plugin2 from '@/plugins/plugin2.uts' import plugin3 from '@/plugins/plugin3.uts' import plugin4 from '@/plugins/plugin4.uts' import CompForPlugin from '@/components/CompForPlugin.uvue' -// #endif export function createApp() { const app = createSSRApp(App) @@ -266,7 +264,6 @@ export function createApp() { app.mixin(globalMixin) // #endif - // #ifdef APP-ANDROID app.use(plugin1) app.use(plugin2) app.use(plugin3) @@ -274,7 +271,6 @@ export function createApp() { app.use(function (app: VueApp, componentName: string, componentInstance: CreateVueComponent) { app.component(componentName, componentInstance) }, 'CompForPlugin', CompForPlugin) - // #endif app.config.globalProperties.globalPropertiesStr = 'default string' app.config.globalProperties.globalPropertiesNum = 0 diff --git a/pages/app-instance/index/index.test.js b/pages/app-instance/index/index.test.js index c915dd7..7755c85 100644 --- a/pages/app-instance/index/index.test.js +++ b/pages/app-instance/index/index.test.js @@ -12,30 +12,28 @@ describe('app-instance', () => { expect(CompForAppComponentText).toBe('component for app.component') }) it('app.use', async () => { - if (process.env.uniTestPlatformInfo.startsWith('android')) { - const plugin1El = await page.$('.plugin1') - const plugin1Text = await plugin1El.text() - expect(plugin1Text).toBe('plugin1: 通过字面量方式创建的 plugin') + const plugin1El = await page.$('.plugin1') + const plugin1Text = await plugin1El.text() + expect(plugin1Text).toBe('plugin1: 通过字面量方式创建的 plugin') - const plugin2El = await page.$('.plugin2') - const plugin2Text = await plugin2El.text() - expect(plugin2Text).toBe('plugin2: 通过函数方式创建的 plugin') + const plugin2El = await page.$('.plugin2') + const plugin2Text = await plugin2El.text() + expect(plugin2Text).toBe('plugin2: 通过函数方式创建的 plugin') - const plugin3El = await page.$('.plugin3') - const plugin3Text = await plugin3El.text() - expect(plugin3Text).toBe( - 'plugin3: 通过 definePlugin + 对象字面量方式创建的 plugin' - ) + const plugin3El = await page.$('.plugin3') + const plugin3Text = await plugin3El.text() + expect(plugin3Text).toBe( + 'plugin3: 通过 definePlugin + 对象字面量方式创建的 plugin' + ) - const plugin4El = await page.$('.plugin4') - const plugin4Text = await plugin4El.text() - expect(plugin4Text).toBe( - 'plugin4: 通过 definePlugin + 函数方式创建的 plugin' - ) + const plugin4El = await page.$('.plugin4') + const plugin4Text = await plugin4El.text() + expect(plugin4Text).toBe( + 'plugin4: 通过 definePlugin + 函数方式创建的 plugin' + ) - const compForPluginEl = await page.$('.component-for-plugin') - const compForPluginText = await compForPluginEl.text() - expect(compForPluginText).toBe('component for plugin') - } + const compForPluginEl = await page.$('.component-for-plugin') + const compForPluginText = await compForPluginEl.text() + expect(compForPluginText).toBe('component for plugin') }) }) diff --git a/pages/app-instance/index/index.uvue b/pages/app-instance/index/index.uvue index d5073d5..362babb 100644 --- a/pages/app-instance/index/index.uvue +++ b/pages/app-instance/index/index.uvue @@ -1,25 +1,19 @@ -