|
|
@@ -5,12 +5,15 @@ import {
|
|
|
getCurrentInstance,
|
|
|
h,
|
|
|
inject,
|
|
|
+ nextTick,
|
|
|
nodeOps,
|
|
|
+ onMounted,
|
|
|
provide,
|
|
|
ref,
|
|
|
resolveComponent,
|
|
|
resolveDirective,
|
|
|
serializeInner,
|
|
|
+ watch,
|
|
|
withDirectives,
|
|
|
} from '@vue/runtime-test'
|
|
|
|
|
|
@@ -551,6 +554,35 @@ describe('api: createApp', () => {
|
|
|
).not.toHaveBeenWarned()
|
|
|
})
|
|
|
|
|
|
+ // #10005
|
|
|
+ test('flush order edge case on nested createApp', async () => {
|
|
|
+ const order: string[] = []
|
|
|
+ const App = defineComponent({
|
|
|
+ setup(props) {
|
|
|
+ const message = ref('m1')
|
|
|
+ watch(
|
|
|
+ message,
|
|
|
+ () => {
|
|
|
+ order.push('post watcher')
|
|
|
+ },
|
|
|
+ { flush: 'post' },
|
|
|
+ )
|
|
|
+ onMounted(() => {
|
|
|
+ message.value = 'm2'
|
|
|
+ createApp(() => '').mount(nodeOps.createElement('div'))
|
|
|
+ })
|
|
|
+ return () => {
|
|
|
+ order.push('render')
|
|
|
+ return h('div', [message.value])
|
|
|
+ }
|
|
|
+ },
|
|
|
+ })
|
|
|
+
|
|
|
+ createApp(App).mount(nodeOps.createElement('div'))
|
|
|
+ await nextTick()
|
|
|
+ expect(order).toMatchObject(['render', 'render', 'post watcher'])
|
|
|
+ })
|
|
|
+
|
|
|
// config.compilerOptions is tested in packages/vue since it is only
|
|
|
// supported in the full build.
|
|
|
})
|