File tree 2 files changed +18
-23
lines changed
packages/server-renderer/__tests__
2 files changed +18
-23
lines changed Original file line number Diff line number Diff line change @@ -5,16 +5,11 @@ import {
5
5
withScopeId ,
6
6
resolveComponent ,
7
7
ComponentOptions ,
8
- Portal ,
9
8
ref ,
10
9
defineComponent
11
10
} from 'vue'
12
11
import { escapeHtml , mockWarn } from '@vue/shared'
13
- import {
14
- renderToString ,
15
- renderComponent ,
16
- SSRContext
17
- } from '../src/renderToString'
12
+ import { renderToString , renderComponent } from '../src/renderToString'
18
13
import { ssrRenderSlot } from '../src/helpers/ssrRenderSlot'
19
14
20
15
mockWarn ( )
@@ -511,21 +506,6 @@ describe('ssr: renderToString', () => {
511
506
} )
512
507
} )
513
508
514
- test ( 'portal' , async ( ) => {
515
- const ctx : SSRContext = { }
516
- await renderToString (
517
- h (
518
- Portal ,
519
- {
520
- target : `#target`
521
- } ,
522
- h ( 'span' , 'hello' )
523
- ) ,
524
- ctx
525
- )
526
- expect ( ctx . portals ! [ '#target' ] ) . toBe ( '<span>hello</span>' )
527
- } )
528
-
529
509
describe ( 'scopeId' , ( ) => {
530
510
// note: here we are only testing scopeId handling for vdom serialization.
531
511
// compiled srr render functions will include scopeId directly in strings.
Original file line number Diff line number Diff line change 1
- import { createApp } from 'vue'
1
+ import { createApp , h , Portal } from 'vue'
2
2
import { renderToString , SSRContext } from '../src/renderToString'
3
3
import { ssrRenderPortal } from '../src/helpers/ssrRenderPortal'
4
4
5
5
describe ( 'ssrRenderPortal' , ( ) => {
6
- test ( 'portal rendering' , async ( ) => {
6
+ test ( 'portal rendering (compiled) ' , async ( ) => {
7
7
const ctx = {
8
8
portals : { }
9
9
} as SSRContext
@@ -26,4 +26,19 @@ describe('ssrRenderPortal', () => {
26
26
)
27
27
expect ( ctx . portals ! [ '#target' ] ) . toBe ( `<div>content</div>` )
28
28
} )
29
+
30
+ test ( 'portal rendering (vnode)' , async ( ) => {
31
+ const ctx : SSRContext = { }
32
+ await renderToString (
33
+ h (
34
+ Portal ,
35
+ {
36
+ target : `#target`
37
+ } ,
38
+ h ( 'span' , 'hello' )
39
+ ) ,
40
+ ctx
41
+ )
42
+ expect ( ctx . portals ! [ '#target' ] ) . toBe ( '<span>hello</span>' )
43
+ } )
29
44
} )
You can’t perform that action at this time.
0 commit comments