|
|
@@ -36,7 +36,7 @@ describe('compiler: transform <slot> outlets', () => {
|
|
|
expect((ast.children[0] as ElementNode).codegenNode).toMatchObject({
|
|
|
type: NodeTypes.JS_CALL_EXPRESSION,
|
|
|
callee: `_${RENDER_SLOT}`,
|
|
|
- arguments: [`$slots.default`]
|
|
|
+ arguments: [`$slots`, `"default"`]
|
|
|
})
|
|
|
})
|
|
|
|
|
|
@@ -45,16 +45,7 @@ describe('compiler: transform <slot> outlets', () => {
|
|
|
expect((ast.children[0] as ElementNode).codegenNode).toMatchObject({
|
|
|
type: NodeTypes.JS_CALL_EXPRESSION,
|
|
|
callee: `_${RENDER_SLOT}`,
|
|
|
- arguments: [`$slots.foo`]
|
|
|
- })
|
|
|
- })
|
|
|
-
|
|
|
- test('statically named slot outlet w/ name that needs quotes', () => {
|
|
|
- const ast = parseWithSlots(`<slot name="foo-bar" />`)
|
|
|
- expect((ast.children[0] as ElementNode).codegenNode).toMatchObject({
|
|
|
- type: NodeTypes.JS_CALL_EXPRESSION,
|
|
|
- callee: `_${RENDER_SLOT}`,
|
|
|
- arguments: [`$slots["foo-bar"]`]
|
|
|
+ arguments: [`$slots`, `"foo"`]
|
|
|
})
|
|
|
})
|
|
|
|
|
|
@@ -64,17 +55,11 @@ describe('compiler: transform <slot> outlets', () => {
|
|
|
type: NodeTypes.JS_CALL_EXPRESSION,
|
|
|
callee: `_${RENDER_SLOT}`,
|
|
|
arguments: [
|
|
|
+ `$slots`,
|
|
|
{
|
|
|
- type: NodeTypes.COMPOUND_EXPRESSION,
|
|
|
- children: [
|
|
|
- `$slots[`,
|
|
|
- {
|
|
|
- type: NodeTypes.SIMPLE_EXPRESSION,
|
|
|
- content: `foo`,
|
|
|
- isStatic: false
|
|
|
- },
|
|
|
- `]`
|
|
|
- ]
|
|
|
+ type: NodeTypes.SIMPLE_EXPRESSION,
|
|
|
+ content: `foo`,
|
|
|
+ isStatic: false
|
|
|
}
|
|
|
]
|
|
|
})
|
|
|
@@ -88,10 +73,10 @@ describe('compiler: transform <slot> outlets', () => {
|
|
|
type: NodeTypes.JS_CALL_EXPRESSION,
|
|
|
callee: RENDER_SLOT,
|
|
|
arguments: [
|
|
|
+ `_ctx.$slots`,
|
|
|
{
|
|
|
type: NodeTypes.COMPOUND_EXPRESSION,
|
|
|
children: [
|
|
|
- `_ctx.$slots[`,
|
|
|
{
|
|
|
type: NodeTypes.SIMPLE_EXPRESSION,
|
|
|
content: `_ctx.foo`,
|
|
|
@@ -102,8 +87,7 @@ describe('compiler: transform <slot> outlets', () => {
|
|
|
type: NodeTypes.SIMPLE_EXPRESSION,
|
|
|
content: `_ctx.bar`,
|
|
|
isStatic: false
|
|
|
- },
|
|
|
- `]`
|
|
|
+ }
|
|
|
]
|
|
|
}
|
|
|
]
|
|
|
@@ -116,7 +100,8 @@ describe('compiler: transform <slot> outlets', () => {
|
|
|
type: NodeTypes.JS_CALL_EXPRESSION,
|
|
|
callee: `_${RENDER_SLOT}`,
|
|
|
arguments: [
|
|
|
- `$slots.default`,
|
|
|
+ `$slots`,
|
|
|
+ `"default"`,
|
|
|
{
|
|
|
type: NodeTypes.JS_OBJECT_EXPRESSION,
|
|
|
properties: [
|
|
|
@@ -152,7 +137,8 @@ describe('compiler: transform <slot> outlets', () => {
|
|
|
type: NodeTypes.JS_CALL_EXPRESSION,
|
|
|
callee: `_${RENDER_SLOT}`,
|
|
|
arguments: [
|
|
|
- `$slots.foo`,
|
|
|
+ `$slots`,
|
|
|
+ `"foo"`,
|
|
|
{
|
|
|
type: NodeTypes.JS_OBJECT_EXPRESSION,
|
|
|
// props should not include name
|
|
|
@@ -189,10 +175,8 @@ describe('compiler: transform <slot> outlets', () => {
|
|
|
type: NodeTypes.JS_CALL_EXPRESSION,
|
|
|
callee: `_${RENDER_SLOT}`,
|
|
|
arguments: [
|
|
|
- {
|
|
|
- type: NodeTypes.COMPOUND_EXPRESSION,
|
|
|
- children: [`$slots[`, { content: `foo` }, `]`]
|
|
|
- },
|
|
|
+ `$slots`,
|
|
|
+ { content: `foo`, isStatic: false },
|
|
|
{
|
|
|
type: NodeTypes.JS_OBJECT_EXPRESSION,
|
|
|
// props should not include name
|
|
|
@@ -229,7 +213,8 @@ describe('compiler: transform <slot> outlets', () => {
|
|
|
type: NodeTypes.JS_CALL_EXPRESSION,
|
|
|
callee: `_${RENDER_SLOT}`,
|
|
|
arguments: [
|
|
|
- `$slots.default`,
|
|
|
+ `$slots`,
|
|
|
+ `"default"`,
|
|
|
`{}`,
|
|
|
[
|
|
|
{
|
|
|
@@ -247,7 +232,8 @@ describe('compiler: transform <slot> outlets', () => {
|
|
|
type: NodeTypes.JS_CALL_EXPRESSION,
|
|
|
callee: `_${RENDER_SLOT}`,
|
|
|
arguments: [
|
|
|
- `$slots.foo`,
|
|
|
+ `$slots`,
|
|
|
+ `"foo"`,
|
|
|
`{}`,
|
|
|
[
|
|
|
{
|
|
|
@@ -265,7 +251,8 @@ describe('compiler: transform <slot> outlets', () => {
|
|
|
type: NodeTypes.JS_CALL_EXPRESSION,
|
|
|
callee: `_${RENDER_SLOT}`,
|
|
|
arguments: [
|
|
|
- `$slots.default`,
|
|
|
+ `$slots`,
|
|
|
+ `"default"`,
|
|
|
{
|
|
|
type: NodeTypes.JS_OBJECT_EXPRESSION,
|
|
|
properties: [
|
|
|
@@ -297,7 +284,8 @@ describe('compiler: transform <slot> outlets', () => {
|
|
|
type: NodeTypes.JS_CALL_EXPRESSION,
|
|
|
callee: `_${RENDER_SLOT}`,
|
|
|
arguments: [
|
|
|
- `$slots.foo`,
|
|
|
+ `$slots`,
|
|
|
+ `"foo"`,
|
|
|
{
|
|
|
type: NodeTypes.JS_OBJECT_EXPRESSION,
|
|
|
properties: [
|