|
@@ -5,7 +5,7 @@ import {
|
|
|
type IfIRNode,
|
|
type IfIRNode,
|
|
|
transformChildren,
|
|
transformChildren,
|
|
|
transformElement,
|
|
transformElement,
|
|
|
- transformRef,
|
|
|
|
|
|
|
+ transformTemplateRef,
|
|
|
transformVFor,
|
|
transformVFor,
|
|
|
transformVIf,
|
|
transformVIf,
|
|
|
} from '../../src'
|
|
} from '../../src'
|
|
@@ -15,7 +15,7 @@ const compileWithTransformRef = makeCompile({
|
|
|
nodeTransforms: [
|
|
nodeTransforms: [
|
|
|
transformVIf,
|
|
transformVIf,
|
|
|
transformVFor,
|
|
transformVFor,
|
|
|
- transformRef,
|
|
|
|
|
|
|
+ transformTemplateRef,
|
|
|
transformElement,
|
|
transformElement,
|
|
|
transformChildren,
|
|
transformChildren,
|
|
|
],
|
|
],
|
|
@@ -32,7 +32,7 @@ describe('compiler: template ref transform', () => {
|
|
|
expect(ir.template).toEqual(['<div></div>'])
|
|
expect(ir.template).toEqual(['<div></div>'])
|
|
|
expect(ir.block.operation).lengthOf(1)
|
|
expect(ir.block.operation).lengthOf(1)
|
|
|
expect(ir.block.operation[0]).toMatchObject({
|
|
expect(ir.block.operation[0]).toMatchObject({
|
|
|
- type: IRNodeTypes.SET_REF,
|
|
|
|
|
|
|
+ type: IRNodeTypes.SET_TEMPLATE_REF,
|
|
|
element: 0,
|
|
element: 0,
|
|
|
value: {
|
|
value: {
|
|
|
content: 'foo',
|
|
content: 'foo',
|
|
@@ -58,7 +58,7 @@ describe('compiler: template ref transform', () => {
|
|
|
expect(ir.template).toEqual(['<div></div>'])
|
|
expect(ir.template).toEqual(['<div></div>'])
|
|
|
expect(ir.block.operation).lengthOf(1)
|
|
expect(ir.block.operation).lengthOf(1)
|
|
|
expect(ir.block.operation[0]).toMatchObject({
|
|
expect(ir.block.operation[0]).toMatchObject({
|
|
|
- type: IRNodeTypes.SET_REF,
|
|
|
|
|
|
|
+ type: IRNodeTypes.SET_TEMPLATE_REF,
|
|
|
element: 0,
|
|
element: 0,
|
|
|
value: {
|
|
value: {
|
|
|
content: 'foo',
|
|
content: 'foo',
|
|
@@ -85,7 +85,7 @@ describe('compiler: template ref transform', () => {
|
|
|
|
|
|
|
|
expect(positive.operation).lengthOf(1)
|
|
expect(positive.operation).lengthOf(1)
|
|
|
expect(positive.operation[0]).toMatchObject({
|
|
expect(positive.operation[0]).toMatchObject({
|
|
|
- type: IRNodeTypes.SET_REF,
|
|
|
|
|
|
|
+ type: IRNodeTypes.SET_TEMPLATE_REF,
|
|
|
element: 2,
|
|
element: 2,
|
|
|
value: {
|
|
value: {
|
|
|
content: 'foo',
|
|
content: 'foo',
|
|
@@ -109,7 +109,7 @@ describe('compiler: template ref transform', () => {
|
|
|
const { render } = ir.block.operation[0] as ForIRNode
|
|
const { render } = ir.block.operation[0] as ForIRNode
|
|
|
expect(render.operation).lengthOf(1)
|
|
expect(render.operation).lengthOf(1)
|
|
|
expect(render.operation[0]).toMatchObject({
|
|
expect(render.operation[0]).toMatchObject({
|
|
|
- type: IRNodeTypes.SET_REF,
|
|
|
|
|
|
|
+ type: IRNodeTypes.SET_TEMPLATE_REF,
|
|
|
element: 2,
|
|
element: 2,
|
|
|
value: {
|
|
value: {
|
|
|
content: 'foo',
|
|
content: 'foo',
|