@@ -976,16 +976,18 @@ describe('defineCustomElement', () => {
976
976
`<span>default</span>text` + `<!---->` + `<div>fallback</div>` ,
977
977
)
978
978
} )
979
- test ( 'should render slots with nested customElement' , async ( ) => {
980
- const Son = defineCustomElement (
979
+
980
+ test ( 'render nested customElement w/ shadowRoot false' , async ( ) => {
981
+ const Child = defineCustomElement (
981
982
{
982
983
render ( ) {
983
984
return renderSlot ( this . $slots , 'default' )
984
985
} ,
985
986
} ,
986
987
{ shadowRoot : false } ,
987
988
)
988
- customElements . define ( 'my-son' , Son )
989
+ customElements . define ( 'my-child' , Child )
990
+
989
991
const Parent = defineCustomElement (
990
992
{
991
993
render ( ) {
@@ -1000,7 +1002,7 @@ describe('defineCustomElement', () => {
1000
1002
render ( ) {
1001
1003
return h ( 'my-parent' , null , {
1002
1004
default : ( ) => [
1003
- h ( 'my-son ' , null , {
1005
+ h ( 'my-child ' , null , {
1004
1006
default : ( ) => [ h ( 'span' , null , 'default' ) ] ,
1005
1007
} ) ,
1006
1008
] ,
@@ -1009,17 +1011,17 @@ describe('defineCustomElement', () => {
1009
1011
}
1010
1012
const app = createApp ( App )
1011
1013
app . mount ( container )
1012
- await new Promise ( r => setTimeout ( r ) )
1014
+ await nextTick ( )
1013
1015
const e = container . childNodes [ 0 ] as VueElement
1014
1016
expect ( e . innerHTML ) . toBe (
1015
- `<my-son data-v-app=""><span>default</span></my-son >` ,
1017
+ `<my-child data-v-app=""><span>default</span></my-child >` ,
1016
1018
)
1017
1019
app . unmount ( )
1018
1020
} )
1019
1021
1020
- test ( 'should work with Teleport' , async ( ) => {
1022
+ test ( 'render nested Teleport w/ shadowRoot false ' , async ( ) => {
1021
1023
const target = document . createElement ( 'div' )
1022
- const Y = defineCustomElement (
1024
+ const Child = defineCustomElement (
1023
1025
{
1024
1026
render ( ) {
1025
1027
return h (
@@ -1033,22 +1035,22 @@ describe('defineCustomElement', () => {
1033
1035
} ,
1034
1036
{ shadowRoot : false } ,
1035
1037
)
1036
- customElements . define ( 'my-y ' , Y )
1037
- const P = defineCustomElement (
1038
+ customElements . define ( 'my-el-teleport-child ' , Child )
1039
+ const Parent = defineCustomElement (
1038
1040
{
1039
1041
render ( ) {
1040
1042
return renderSlot ( this . $slots , 'default' )
1041
1043
} ,
1042
1044
} ,
1043
1045
{ shadowRoot : false } ,
1044
1046
)
1045
- customElements . define ( 'my-p ' , P )
1047
+ customElements . define ( 'my-el-teleport-parent ' , Parent )
1046
1048
1047
1049
const App = {
1048
1050
render ( ) {
1049
- return h ( 'my-p ' , null , {
1051
+ return h ( 'my-el-teleport-parent ' , null , {
1050
1052
default : ( ) => [
1051
- h ( 'my-y ' , null , {
1053
+ h ( 'my-el-teleport-child ' , null , {
1052
1054
default : ( ) => [ h ( 'span' , null , 'default' ) ] ,
1053
1055
} ) ,
1054
1056
] ,
@@ -1057,7 +1059,7 @@ describe('defineCustomElement', () => {
1057
1059
}
1058
1060
const app = createApp ( App )
1059
1061
app . mount ( container )
1060
- await new Promise ( r => setTimeout ( r ) )
1062
+ await nextTick ( )
1061
1063
expect ( target . innerHTML ) . toBe ( `<span>default</span>` )
1062
1064
app . unmount ( )
1063
1065
} )
0 commit comments