test(compiler-cli): add source-map compliance tests for inline-templates (#39939)

This test migrates source-mapping tests to the new compliance test framework.
The original tests are found in the file at:
`packages/compiler-cli/test/ngtsc/template_mapping_spec.ts`.

These new tests also check the mappings resulting from partial compilation
followed by linking, after flattening the pair of source-maps that each
process generates.

Note that there are some differences between the mappings for full compile
and linked compile modes, due to how TypeScript and Babel use source-span
information on AST nodes.  To accommodate this, there are two expectation
files for most of these source files.

PR Close #39939
This commit is contained in:
Pete Bacon Darwin 2020-12-02 21:42:58 +00:00 committed by Misko Hevery
parent 9066ca9e92
commit b8714c384f
84 changed files with 3217 additions and 31 deletions

View File

@ -0,0 +1,923 @@
{
"$schema": "../../test_case_schema.json",
"cases": [
{
"description": "should map simple element with content (full compile)",
"inputFiles": [
"simple_element.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map simple element with content (partial compile)",
"inputFiles": [
"simple_element.ts"
],
"expectations": [
{
"files": [
{
"generated": "simple_element.js",
"expected": "simple_element_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map void element (full compile)",
"inputFiles": [
"void_element.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map void element (partial compile)",
"inputFiles": [
"void_element.ts"
],
"expectations": [
{
"files": [
{
"generated": "void_element.js",
"expected": "void_element_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map a mix of interpolated and static content (full compile)",
"inputFiles": [
"interpolation_basic.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map a mix of interpolated and static content (partial compile)",
"inputFiles": [
"interpolation_basic.ts"
],
"expectations": [
{
"files": [
{
"generated": "interpolation_basic.js",
"expected": "interpolation_basic_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map a complex interpolated expression (full compile)",
"inputFiles": [
"interpolation_complex.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map a complex interpolated expression (partial compile)",
"inputFiles": [
"interpolation_complex.ts"
],
"expectations": [
{
"files": [
{
"generated": "interpolation_complex.js",
"expected": "interpolation_complex_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map interpolated properties (full compile)",
"inputFiles": [
"interpolation_properties.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map interpolated properties (partial compile)",
"inputFiles": [
"interpolation_properties.ts"
],
"expectations": [
{
"files": [
{
"generated": "interpolation_properties.js",
"expected": "interpolation_properties_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map interpolation with pipe (full compile)",
"inputFiles": [
"interpolation_with_pipe.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map interpolation with pipe (partial compile)",
"inputFiles": [
"interpolation_with_pipe.ts"
],
"expectations": [
{
"files": [
{
"generated": "interpolation_with_pipe.js",
"expected": "interpolation_with_pipe_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map a simple input binding expression (full compile)",
"inputFiles": [
"input_binding_simple.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map a simple input binding expression (partial compile)",
"inputFiles": [
"input_binding_simple.ts"
],
"expectations": [
{
"files": [
{
"generated": "input_binding_simple.js",
"expected": "input_binding_simple_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map a complex input binding expression (full compile)",
"inputFiles": [
"input_binding_complex.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map a complex input binding expression (partial compile)",
"inputFiles": [
"input_binding_complex.ts"
],
"expectations": [
{
"files": [
{
"generated": "input_binding_complex.js",
"expected": "input_binding_complex_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map a longhand input binding expression (full compile)",
"inputFiles": [
"input_binding_longhand.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map a longhand input binding expression (partial compile)",
"inputFiles": [
"input_binding_longhand.ts"
],
"expectations": [
{
"files": [
{
"generated": "input_binding_longhand.js",
"expected": "input_binding_longhand_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map a simple output binding expression (full compile)",
"inputFiles": [
"output_binding_simple.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map a simple output binding expression (partial compile)",
"inputFiles": [
"output_binding_simple.ts"
],
"expectations": [
{
"files": [
{
"generated": "output_binding_simple.js",
"expected": "output_binding_simple_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map a complex output binding expression (full compile)",
"inputFiles": [
"output_binding_complex.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map a complex output binding expression (partial compile)",
"inputFiles": [
"output_binding_complex.ts"
],
"expectations": [
{
"files": [
{
"generated": "output_binding_complex.js",
"expected": "output_binding_complex_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map a longhand output binding expression (full compile)",
"inputFiles": [
"output_binding_longhand.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map a longhand output binding expression (partial compile)",
"inputFiles": [
"output_binding_longhand.ts"
],
"expectations": [
{
"files": [
{
"generated": "output_binding_longhand.js",
"expected": "output_binding_longhand_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map a two-way binding expression (full compile)",
"inputFiles": [
"two_way_binding_simple.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map a two-way binding expression (partial compile)",
"inputFiles": [
"two_way_binding_simple.ts"
],
"expectations": [
{
"files": [
{
"generated": "two_way_binding_simple.js",
"expected": "two_way_binding_simple_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map a longhand two-way binding expression (full compile)",
"inputFiles": [
"two_way_binding_longhand.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map a longhand two-way binding expression (partial compile)",
"inputFiles": [
"two_way_binding_longhand.ts"
],
"expectations": [
{
"files": [
{
"generated": "two_way_binding_longhand.js",
"expected": "two_way_binding_longhand_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map a class input binding (full compile)",
"inputFiles": [
"input_binding_class.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map a class input binding (partial compile)",
"inputFiles": [
"input_binding_class.ts"
],
"expectations": [
{
"files": [
{
"generated": "input_binding_class.js",
"expected": "input_binding_class_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map *ngIf scenario (full compile)",
"inputFiles": [
"ng_if_simple.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map *ngIf scenario (partial compile)",
"inputFiles": [
"ng_if_simple.ts"
],
"expectations": [
{
"files": [
{
"generated": "ng_if_simple.js",
"expected": "ng_if_simple_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map ng-template [ngIf] scenario (full compile)",
"inputFiles": [
"ng_if_templated.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map ng-template [ngIf] scenario (partial compile)",
"inputFiles": [
"ng_if_templated.ts"
],
"expectations": [
{
"files": [
{
"generated": "ng_if_templated.js",
"expected": "ng_if_templated_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map *ngFor scenario (full compile)",
"inputFiles": [
"ng_for_simple.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map *ngFor scenario (partial compile)",
"inputFiles": [
"ng_for_simple.ts"
],
"expectations": [
{
"files": [
{
"generated": "ng_for_simple.js",
"expected": "ng_for_simple_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map ng-template [ngFor] scenario (full compile)",
"inputFiles": [
"ng_for_templated.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map ng-template [ngFor] scenario (partial compile)",
"inputFiles": [
"ng_for_templated.ts"
],
"expectations": [
{
"files": [
{
"generated": "ng_for_templated.js",
"expected": "ng_for_templated_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map default and selected projection (full compile)",
"inputFiles": [
"projection.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should map default and selected projection (partial compile)",
"inputFiles": [
"projection.ts"
],
"expectations": [
{
"files": [
{
"generated": "projection.js",
"expected": "projection_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should create simple i18n message source-mapping (full compile)",
"inputFiles": [
"i18n_message_simple.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should create simple i18n message source-mapping (partial compile)",
"inputFiles": [
"i18n_message_simple.ts"
],
"expectations": [
{
"files": [
{
"generated": "i18n_message_simple.js",
"expected": "i18n_message_simple_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should create placeholder i18n message source-mappings (full compile)",
"inputFiles": [
"i18n_message_placeholder.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should create placeholder i18n message source-mappings (partial compile)",
"inputFiles": [
"i18n_message_placeholder.ts"
],
"expectations": [
{
"files": [
{
"generated": "i18n_message_placeholder.js",
"expected": "i18n_message_placeholder_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should correctly handle collapsed whitespace in interpolation placeholder i18n message source-mappings (full compile)",
"inputFiles": [
"i18n_message_interpolation_whitespace.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should correctly handle collapsed whitespace in interpolation placeholder i18n message source-mappings (partial compile)",
"inputFiles": [
"i18n_message_interpolation_whitespace.ts"
],
"expectations": [
{
"files": [
{
"generated": "i18n_message_interpolation_whitespace.js",
"expected": "i18n_message_interpolation_whitespace_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should correctly handle collapsed whitespace in element placeholder i18n message source-mappings (full compile)",
"inputFiles": [
"i18n_message_element_whitespace.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should correctly handle collapsed whitespace in element placeholder i18n message source-mappings (partial compile)",
"inputFiles": [
"i18n_message_element_whitespace.ts"
],
"expectations": [
{
"files": [
{
"generated": "i18n_message_element_whitespace.js",
"expected": "i18n_message_element_whitespace_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should create tag (container) placeholder i18n message source-mappings (full compile)",
"inputFiles": [
"i18n_message_container_tag.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should create tag (container) placeholder i18n message source-mappings (partial compile)",
"inputFiles": [
"i18n_message_container_tag.ts"
],
"expectations": [
{
"files": [
{
"generated": "i18n_message_container_tag.js",
"expected": "i18n_message_container_tag_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should create (simple string) inline template source-mapping (full compile)",
"inputFiles": [
"update_mode.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should create (simple string) inline template source-mapping (partial compile)",
"inputFiles": [
"update_mode.ts"
],
"expectations": [
{
"files": [
{
"generated": "update_mode.js",
"expected": "update_mode_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should create correct inline template source-mapping when the source contains escape sequences (full compile)",
"inputFiles": [
"escape_sequences.ts"
],
"compilationModeFilter": [
"full compile"
],
"compilerOptions": {
"sourceMap": true
}
},
{
"description": "should create correct inline template source-mapping when the source contains escape sequences (partial compile)",
"inputFiles": [
"escape_sequences.ts"
],
"expectations": [
{
"files": [
{
"generated": "escape_sequences.js",
"expected": "escape_sequences_partial.js"
}
]
}
],
"compilationModeFilter": [
"linked compile"
],
"compilerOptions": {
"sourceMap": true
}
}
]
}

View File

@ -0,0 +1,3 @@
consts: [[1, "some-class"]]
i0.ɵɵelementStart(0, "div", 0) // SOURCE: "/escape_sequences.ts" <div class=\"some-class\">

View File

@ -0,0 +1,8 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: '<div class=\"some-class\">this is a test</div>',
})
export class TestCmp {
}

View File

@ -0,0 +1,3 @@
consts: [[1, "some-class"]]
.ɵɵelementStart(0, "div", 0) // SOURCE: "/escape_sequences.ts" <div class=\"some-class\">

View File

@ -0,0 +1,13 @@
`Hello, ${ // SOURCE: "/i18n_message_container_tag.ts" Hello,
"\uFFFD#2\uFFFD" // SOURCE: "/i18n_message_container_tag.ts" <b>
}:START_BOLD_TEXT:World${ // SOURCE: "/i18n_message_container_tag.ts" World
"\uFFFD/#2\uFFFD" // SOURCE: "/i18n_message_container_tag.ts" </b>
}:CLOSE_BOLD_TEXT:!` // SOURCE: "/i18n_message_container_tag.ts" !
i0.ɵɵelementStart(0, "div") // SOURCE: "/i18n_message_container_tag.ts" <div i18n>
i0.ɵɵelementEnd() // SOURCE: "/i18n_message_container_tag.ts" </div>

View File

@ -0,0 +1,8 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: '<div i18n>Hello, <b>World</b>!</div>',
})
export class TestCmp {
}

View File

@ -0,0 +1,14 @@
$localize`Hello, ${ // SOURCE: "/i18n_message_container_tag.ts" Hello,
"\uFFFD#2\uFFFD" // SOURCE: "/i18n_message_container_tag.ts" <b>
}:START_BOLD_TEXT:World${ // SOURCE: "/i18n_message_container_tag.ts" World
"\uFFFD/#2\uFFFD" // SOURCE: "/i18n_message_container_tag.ts" </b>
}:CLOSE_BOLD_TEXT:!` // SOURCE: "/i18n_message_container_tag.ts" !
.ɵɵelementStart(0, "div") // SOURCE: "/i18n_message_container_tag.ts" <div i18n>
// TODO: Work out how to fix the broken segment for the last item in a template
.ɵɵelem // SOURCE: "/i18n_message_container_tag.ts" </div>'

View File

@ -0,0 +1,20 @@
` pre-p ${ // SOURCE: "/i18n_message_element_whitespace.ts" pre-p\\n
"\uFFFD#2\uFFFD" // SOURCE: "/i18n_message_element_whitespace.ts" <p>\\n
}:START_PARAGRAPH: in-p ${ // SOURCE: "/i18n_message_element_whitespace.ts" in-p\\n
"\uFFFD/#2\uFFFD" // SOURCE: "/i18n_message_element_whitespace.ts" </p>
}:CLOSE_PARAGRAPH: post-p\n` // SOURCE: "/i18n_message_element_whitespace.ts" post-p\\n
i0.ɵɵelementStart(0, "div") // SOURCE: "/i18n_message_element_whitespace.ts" <div i18n>\\n
i0.ɵɵi18nStart(1, 0) // SOURCE: "/i18n_message_element_whitespace.ts" <div i18n>\\n
i0.ɵɵelement(2, "p") // SOURCE: "/i18n_message_element_whitespace.ts" <p>\\n
i0.ɵɵi18nEnd() // SOURCE: "/i18n_message_element_whitespace.ts" </div>
i0.ɵɵelementEnd() // SOURCE: "/i18n_message_element_whitespace.ts" </div>

View File

@ -0,0 +1,8 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: '<div i18n>\n pre-p\n <p>\n in-p\n </p>\n post-p\n</div>',
})
export class TestCmp {
}

View File

@ -0,0 +1,21 @@
$localize` pre-p ${ // SOURCE: "/i18n_message_element_whitespace.ts" pre-p\\n
"\uFFFD#2\uFFFD" // SOURCE: "/i18n_message_element_whitespace.ts" <p>\\n
}:START_PARAGRAPH: in-p ${ // SOURCE: "/i18n_message_element_whitespace.ts" in-p\\n
"\uFFFD/#2\uFFFD" // SOURCE: "/i18n_message_element_whitespace.ts" </p>\\n
}:CLOSE_PARAGRAPH: post-p\n` // SOURCE: "/i18n_message_element_whitespace.ts" post-p\\n
.ɵɵelementStart(0, "div") // SOURCE: "/i18n_message_element_whitespace.ts" <div i18n>\\n
.ɵɵi18nStart(1, 0) // SOURCE: "/i18n_message_element_whitespace.ts" <div i18n>\\n
.ɵɵelement(2, "p") // SOURCE: "/i18n_message_element_whitespace.ts" <p>\\n
.ɵɵi18nEnd() // SOURCE: "/i18n_message_element_whitespace.ts" </div>'
// TODO: Work out how to fix the broken segment for the last item in a template
.ɵɵelem // SOURCE: "/i18n_message_element_whitespace.ts" </div>'

View File

@ -0,0 +1,11 @@
$localize ` pre-title ${
"\uFFFD0\uFFFD" // SOURCE: "/i18n_message_interpolation_whitespace.ts" {{title_value}}
}:INTERPOLATION: post-title` // SOURCE: "/i18n_message_interpolation_whitespace.ts" post-title
$localize ` pre-body ${
"\uFFFD0\uFFFD" // SOURCE: "/i18n_message_interpolation_whitespace.ts" {{body_value}}
}:INTERPOLATION: post-body` // SOURCE: "/i18n_message_interpolation_whitespace.ts" post-body
i0.ɵɵelementStart(0, "div", 0) // SOURCE: "/i18n_message_interpolation_whitespace.ts" <div i18n title="
i0.ɵɵelementEnd() // SOURCE: "/i18n_message_interpolation_whitespace.ts" </div>

View File

@ -0,0 +1,9 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template:
'<div i18n title=" pre-title {{title_value}} post-title" i18n-title> pre-body {{body_value}} post-body</div>',
})
export class TestCmp {
}

View File

@ -0,0 +1,12 @@
$localize ` pre-title ${
"\uFFFD0\uFFFD" // SOURCE: "/i18n_message_interpolation_whitespace.ts" {{title_value}}
}:INTERPOLATION: post-title` // SOURCE: "/i18n_message_interpolation_whitespace.ts" post-title" i18n-title>
$localize ` pre-body ${
"\uFFFD0\uFFFD" // SOURCE: "/i18n_message_interpolation_whitespace.ts" {{body_value}}
}:INTERPOLATION: post-body` // SOURCE: "/i18n_message_interpolation_whitespace.ts" post-body
.ɵɵelementStart(0, "div", 0) // SOURCE: "/i18n_message_interpolation_whitespace.ts" <div i18n title="
// TODO: Work out how to fix the broken segment for the last item in a template
.ɵɵelementEnd() // SOURCE: "/i18n_message_interpolation_whitespace.ts" </div>'

View File

@ -0,0 +1,9 @@
`Hello, ${ // SOURCE: "/i18n_message_placeholder.ts" Hello,
"\uFFFD0\uFFFD" // SOURCE: "/i18n_message_placeholder.ts" {{name}}
}:INTERPOLATION:!` // SOURCE: "/i18n_message_placeholder.ts" !
i0.ɵɵelementStart(0, "div") // SOURCE: "/i18n_message_placeholder.ts" <div i18n>
i0.ɵɵelementEnd() // SOURCE: "/i18n_message_placeholder.ts" </div>

View File

@ -0,0 +1,8 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: '<div i18n>Hello, {{name}}!</div>',
})
export class TestCmp {
}

View File

@ -0,0 +1,9 @@
$localize`Hello, ${ // SOURCE: "/i18n_message_placeholder.ts" Hello,
"\uFFFD0\uFFFD" // SOURCE: "/i18n_message_placeholder.ts" {{name}}
}:INTERPOLATION:!` // SOURCE: "/i18n_message_placeholder.ts" !
.ɵɵelementStart(0, "div") // SOURCE: "/i18n_message_placeholder.ts" <div i18n>
.ɵɵelementEnd() // SOURCE: "/i18n_message_placeholder.ts" </div>'

View File

@ -0,0 +1,3 @@
`Hello, World!` // SOURCE: "/i18n_message_simple.ts" Hello, World!
i0.ɵɵelementStart(0, "div") // SOURCE: "/i18n_message_simple.ts" <div i18n>

View File

@ -0,0 +1,8 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: '<div i18n>Hello, World!</div>',
})
export class TestCmp {
}

View File

@ -0,0 +1,3 @@
$localize`Hello, World!` // SOURCE: "/i18n_message_simple.ts" Hello, World!
.ɵɵelementStart(0, "div") // SOURCE: "/i18n_message_simple.ts" <div i18n>

View File

@ -0,0 +1,7 @@
i0.ɵɵelementStart(0, "div") // SOURCE: "/input_binding_class.ts" <div
i0.ɵɵtext(1, "Message") // SOURCE: "/input_binding_class.ts" Message
i0.ɵɵelementEnd() // SOURCE: "/input_binding_class.ts" </div>
i0.ɵɵclassProp("initial", ctx.isInitial) // SOURCE: "/input_binding_class.ts" [class.initial]="isInitial"

View File

@ -0,0 +1,8 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: '<div [class.initial]="isInitial">Message</div>',
})
export class TestCmp {
}

View File

@ -0,0 +1,7 @@
.ɵɵelementStart(0, "div") // SOURCE: "/input_binding_class.ts" <div
.ɵɵtext(1, "Message") // SOURCE: "/input_binding_class.ts" Message
.ɵɵelem // SOURCE: "/input_binding_class.ts" </div>'
.ɵɵclassProp("initial", ctx.isInitial) // SOURCE: "/input_binding_class.ts" [class.initial]="isInitial">

View File

@ -0,0 +1,3 @@
i0.ɵɵelement(0, "div", 0) // SOURCE: "/input_binding_complex.ts" <div
i0.ɵɵproperty("attr", ctx.greeting + ctx.name) // SOURCE: "/input_binding_complex.ts" [attr]="greeting + name"

View File

@ -0,0 +1,8 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: '<div [attr]="greeting + name"></div>',
})
export class TestCmp {
}

View File

@ -0,0 +1,4 @@
.ɵɵelement(0, "div", 0) // SOURCE: "/input_binding_complex.ts" <div
// TODO: Work out how to fix the broken segment for the last item in a template
.ɵɵproperty("attr", ctx.greeting // SOURCE: "/input_binding_complex.ts" [attr]="greeting + name"></div>'

View File

@ -0,0 +1,3 @@
i0.ɵɵelement(0, "div", 0) // SOURCE: "/input_binding_longhand.ts" <div
i0.ɵɵproperty("attr", ctx.name) // SOURCE: "/input_binding_longhand.ts" bind-attr="name"

View File

@ -0,0 +1,8 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: '<div bind-attr="name"></div>',
})
export class TestCmp {
}

View File

@ -0,0 +1,4 @@
.ɵɵelement(0, "div", 0) // SOURCE: "/input_binding_longhand.ts" <div
// TODO: Work out how to fix the broken segment for the last item in a template
.ɵɵproperty("attr", ctx. // SOURCE: "/input_binding_longhand.ts" bind-attr="name"></div>'

View File

@ -0,0 +1,3 @@
i0.ɵɵelement(0, "div", 0) // SOURCE: "/input_binding_simple.ts" <div
i0.ɵɵproperty("attr", ctx.name) // SOURCE: "/input_binding_simple.ts" [attr]="name"

View File

@ -0,0 +1,8 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: '<div [attr]="name"></div>',
})
export class TestCmp {
}

View File

@ -0,0 +1,4 @@
.ɵɵelement(0, "div", 0) // SOURCE: "/input_binding_simple.ts" <div
// TODO: Work out how to fix the broken segment for the last item in a template
.ɵɵproperty("attr", c // SOURCE: "/input_binding_simple.ts" [attr]="name"></div>'

View File

@ -0,0 +1,5 @@
i0.ɵɵelementStart(0, "h3") // SOURCE: "/interpolation_basic.ts" <h3>
i0.ɵɵelementEnd() // SOURCE: "/interpolation_basic.ts" </h3>
i0.ɵɵtextInterpolate1("Hello ", ctx.name, "") // SOURCE: "/interpolation_basic.ts" Hello {{ name }}

View File

@ -0,0 +1,8 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: '<h3>Hello {{ name }}</h3>',
})
export class TestCmp {
}

View File

@ -0,0 +1,6 @@
.ɵɵelementStart(0, "h3") // SOURCE: "/interpolation_basic.ts" <h3>
// TODO: Work out how to fix the broken segment for the last item in a template
.ɵɵele // SOURCE: "/interpolation_basic.ts" </h3>'
.ɵɵtextInterpolate1("Hello ", ctx.name, "") // SOURCE: "/interpolation_basic.ts" Hello {{ name }}

View File

@ -0,0 +1,5 @@
i0.ɵɵelementStart(0, "h2") // SOURCE: "/interpolation_complex.ts" <h2>
i0.ɵɵelementEnd() // SOURCE: "/interpolation_complex.ts" </h2>
i0.ɵɵtextInterpolate(ctx.greeting + " " + ctx.name) // SOURCE: "/interpolation_complex.ts" {{ greeting + " " + name }}

View File

@ -0,0 +1,8 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: '<h2>{{ greeting + " " + name }}</h2>',
})
export class TestCmp {
}

View File

@ -0,0 +1,6 @@
.ɵɵelementStart(0, "h2") // SOURCE: "/interpolation_complex.ts" <h2>
// TODO: Work out how to fix the broken segment for the last item in a template
.ɵɵele // SOURCE: "/interpolation_complex.ts" </h2>'
.ɵɵtextInterpolate(ctx.greeting + " " + ctx.name) // SOURCE: "/interpolation_complex.ts" {{ greeting + " " + name }}

View File

@ -0,0 +1,3 @@
i0.ɵɵelement(0, "div", 0) // SOURCE: "/interpolation_properties.ts" <div
i0.ɵɵpropertyInterpolate("id", ctx.name) // SOURCE: "/interpolation_properties.ts" id="{{name}}"

View File

@ -0,0 +1,8 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: '<div id="{{name}}"></div>',
})
export class TestCmp {
}

View File

@ -0,0 +1,4 @@
.ɵɵelement(0, "div", 0) // SOURCE: "/interpolation_properties.ts" <div
// TODO: Work out how to fix the broken segment for the last item in a template
.ɵɵpropertyInterpolat // SOURCE: "/interpolation_properties.ts" id="{{name}}"></div>'

View File

@ -0,0 +1,5 @@
i0.ɵɵelementStart(0, "div") // SOURCE: "/interpolation_with_pipe.ts" <div>
i0.ɵɵelementEnd() // SOURCE: "/interpolation_with_pipe.ts" </div>
i0.ɵɵtextInterpolate(i0.ɵɵpipeBind2(2, 1, 200.3, 2)) // SOURCE: "/interpolation_with_pipe.ts" {{200.3 | percent : 2 }}

View File

@ -0,0 +1,8 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: '<div>{{200.3 | percent : 2 }}</div>',
})
export class TestCmp {
}

View File

@ -0,0 +1,6 @@
.ɵɵelementStart(0, "div") // SOURCE: "/interpolation_with_pipe.ts" <div>
// TODO: Work out how to fix the broken segment for the last item in a template
.ɵɵelem // SOURCE: "/interpolation_with_pipe.ts" </div>'
.ɵɵpipeBind2(2, 1, 200.3, 2)) // SOURCE: "/interpolation_with_pipe.ts" {{200.3 | percent : 2 }}

View File

@ -0,0 +1,15 @@
i0.ɵɵelementStart(0, "div") // SOURCE: "/ng_for_simple.ts" <div *ngFor="let item
i0.ɵɵtext(1) // SOURCE: "/ng_for_simple.ts" {{ item }}
i0.ɵɵelementEnd() // SOURCE: "/ng_for_simple.ts" </div>
i0.ɵɵadvance(1) // SOURCE: "/ng_for_simple.ts" {{ item }}
i0.ɵɵtextInterpolate(item_r1) // SOURCE: "/ng_for_simple.ts" {{ item }}
i0.ɵɵtemplate(0, TestCmp_div_0_Template, 2, 1, "div", 0) // SOURCE: "/ng_for_simple.ts" <div *ngFor="let item
i0.ɵɵproperty("ngForOf", ctx.items) // SOURCE: "/ng_for_simple.ts" of items;
("ngForTrackBy", ctx.trackByFn) // SOURCE: "/ng_for_simple.ts" index as i; trackBy: trackByFn">

View File

@ -0,0 +1,8 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: '<div *ngFor="let item of items; index as i; trackBy: trackByFn">{{ item }}</div>'
})
export class TestCmp {
}

View File

@ -0,0 +1,15 @@
.ɵɵelementStart(0, "div");\n // SOURCE: "/ng_for_simple.ts" <div *ngFor="let item
.ɵɵtext(1);\n // SOURCE: "/ng_for_simple.ts" {{ item }}
// TODO: Work out how to fix the broken segment for the last item in a template
.ɵɵelem // SOURCE: "/ng_for_simple.ts" </div>'
.ɵɵadvance(1);\n // SOURCE: "/ng_for_simple.ts" {{ item }}
.ɵɵtextInterpolate(item_r1);\n }\n}\n\n // SOURCE: "/ng_for_simple.ts" {{ item }}
.ɵɵtemplate(0, TestCmp_div_0_Template, 2, 1, "div", 0) // SOURCE: "/ng_for_simple.ts" <div *ngFor="let item
// TODO: Work out if we can split these two calls
.ɵɵproperty("ngForOf", ctx.items)("ngForTrackBy", ctx.trackByFn) // SOURCE: "/ng_for_simple.ts" of items; index as i; trackBy: trackByFn">

View File

@ -0,0 +1,4 @@
i0.ɵɵtext(0) // SOURCE: "/ng_for_templated.ts" {{ item }}
// TODO - map the bindings better
i0.ɵɵtextInterpolate(item_r1) // SOURCE: "/ng_for_templated.ts" {{ item }}

View File

@ -0,0 +1,8 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: `<ng-template ngFor [ngForOf]="items" let-item>{{ item }}</ng-template>`
})
export class TestCmp {
}

View File

@ -0,0 +1,5 @@
.ɵɵtext(0);\n }\n\n if (rf & 2) {\n const item_r1 = ctx.$implicit;\n // SOURCE: "/ng_for_templated.ts" {{ item }}</ng-template>`
// TODO - map the bindings better
// TODO: Work out how to fix the broken segment for the last item in a template
.ɵɵtextInterpolate(item_r // SOURCE: "/ng_for_templated.ts" {{ item }}</ng-template>`

View File

@ -0,0 +1,11 @@
i0.ɵɵelementStart(0, "div") // SOURCE: "/ng_if_simple.ts" <div *
i0.ɵɵtext(1) // SOURCE: "/ng_if_simple.ts" {{ name }}
i0.ɵɵelementEnd() // SOURCE: "/ng_if_simple.ts" </div>
i0.ɵɵtextInterpolate(ctx_r0.name) // SOURCE: "/ng_if_simple.ts" {{ name }}
i0.ɵɵtemplate(0, TestCmp_div_0_Template, 2, 1, "div", 0) // SOURCE: "/ng_if_simple.ts" <div *
i0.ɵɵproperty("ngIf", ctx.showMessage()) // SOURCE: "/ng_if_simple.ts" ngIf="showMessage()

View File

@ -0,0 +1,8 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: '<div *ngIf="showMessage()">{{ name }}</div>',
})
export class TestCmp {
}

View File

@ -0,0 +1,12 @@
.ɵɵelementStart(0, "div");\n // SOURCE: "/ng_if_simple.ts" <div *
.ɵɵtext(1);\n // SOURCE: "/ng_if_simple.ts" {{ name }}
// TODO: Work out how to fix the broken segment for the last item in a template
.ɵɵelem // SOURCE: "/ng_if_simple.ts" </div>'
.ɵɵtextInterpolate(ctx_r0.name);\n }\n}\n\n // SOURCE: "/ng_if_simple.ts" {{ name }}
.ɵɵtemplate(0, TestCmp_div_0_Template, 2, 1, "div", 0) // SOURCE: "/ng_if_simple.ts" <div *
.ɵɵproperty("ngIf", ctx.showMessage()) // SOURCE: "/ng_if_simple.ts" ngIf="showMessage()">

View File

@ -0,0 +1,7 @@
i0.ɵɵelementStart(0, "div") // SOURCE: "/ng_if_templated.ts" <div>
// TODO - map the bindings better
i0.ɵɵelementEnd() // SOURCE: "/ng_if_templated.ts" </div>
// TODO: the `ctx_r...` appears to be dependent upon previous tests!!!
// TODO: expectMapping(mappings, { source: '{{ name }}', generated: 'i0.ɵɵtextInterpolate(ctx_r0.name)', sourceUrl: '../ng_if_templated.ts'});

View File

@ -0,0 +1,12 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: `
<ng-template [ngIf]="showMessage()">
<div>{{ name }}</div>
<hr>
</ng-template>`
})
export class TestCmp {
}

View File

@ -0,0 +1,8 @@
.ɵɵelementStart(0, "div");\n // SOURCE: "/ng_if_templated.ts" <div>
// TODO - map the bindings better
// TODO: Work out how to fix the broken segment for the last item in a template
.ɵɵelementEnd();\n // SOURCE: "/ng_if_templated.ts" </div>\n
// TODO: the `ctx_r...` appears to be dependent upon previous tests!!!
// TODO: expectMapping(mappings, { source: '{{ name }}', generated: 'i0.ɵɵtextInterpolate(ctx_r0.name)', sourceUrl: '../ng_if_templated.ts'});

View File

@ -0,0 +1,11 @@
i0.ɵɵelementStart(0, "button", 0) // SOURCE: "/output_binding_complex.ts" <button
ctx.items.push( // SOURCE: "/output_binding_complex.ts" items.push(
"item" // SOURCE: "/output_binding_complex.ts" 'item'
+ ctx.items.length) // SOURCE: "/output_binding_complex.ts" + items.length)
i0.ɵɵtext(1, "Add Item") // SOURCE: "/output_binding_complex.ts" Add Item
i0.ɵɵelementEnd() // SOURCE: "/output_binding_complex.ts" </button>

View File

@ -0,0 +1,8 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: `<button (click)="items.push('item' + items.length)">Add Item</button>`,
})
export class TestCmp {
}

View File

@ -0,0 +1,13 @@
.ɵɵelementStart(0, "button", 0) // SOURCE: "/output_binding_complex.ts" <button
.ɵɵlistener("click", function TestCmp_Template_button_click_0_listener() {\n // SOURCE: "/output_binding_complex.ts" (click)="
ctx.items.push( // SOURCE: "/output_binding_complex.ts" items.push(
// TODO: fix the mappings here
"item" // SOURCE: "/output_binding_complex.ts" 'item' + items.length)">
.ɵɵtext(1, "Add Item") // SOURCE: "/output_binding_complex.ts" Add Item
// TODO: Work out how to fix the broken segment for the last item in a template
.ɵɵelement // SOURCE: "/output_binding_complex.ts" </button>`

View File

@ -0,0 +1,8 @@
i0.ɵɵelementStart(0, "button", 0) // SOURCE: "/output_binding_longhand.ts" <button
ctx.doSomething() // SOURCE: "/output_binding_longhand.ts" doSomething()
i0.ɵɵtext(1, "Do it") // SOURCE: "/output_binding_longhand.ts" Do it
i0.ɵɵelementEnd() // SOURCE: "/output_binding_longhand.ts" </button>

View File

@ -0,0 +1,8 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: '<button on-click="doSomething()">Do it</button>',
})
export class TestCmp {
}

View File

@ -0,0 +1,9 @@
.ɵɵelementStart(0, "button", 0) // SOURCE: "/output_binding_longhand.ts" <button
ctx.doSomething() // SOURCE: "/output_binding_longhand.ts" doSomething()">
.ɵɵtext(1, "Do it") // SOURCE: "/output_binding_longhand.ts" Do it
// TODO: Work out how to fix the broken segment for the last item in a template
.ɵɵelement // SOURCE: "/output_binding_longhand.ts" </button>'

View File

@ -0,0 +1,9 @@
i0.ɵɵelementStart(0, "button", 0) // SOURCE: "/output_binding_simple.ts" <button
i0.ɵɵlistener("click", function TestCmp_Template_button_click_0_listener() { return // SOURCE: "/output_binding_simple.ts" (click)="
ctx.doSomething() // SOURCE: "/output_binding_simple.ts" doSomething()
i0.ɵɵtext(1, "Do it") // SOURCE: "/output_binding_simple.ts" Do it
i0.ɵɵelementEnd() // SOURCE: "/output_binding_simple.ts" </button>

View File

@ -0,0 +1,8 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: '<button (click)="doSomething()">Do it</button>',
})
export class TestCmp {
}

View File

@ -0,0 +1,10 @@
.ɵɵelementStart(0, "button", 0) // SOURCE: "/output_binding_simple.ts" <button
.ɵɵlistener("click", function TestCmp_Template_button_click_0_listener() {\n // SOURCE: "/output_binding_simple.ts" (click)="
ctx.doSomething() // SOURCE: "/output_binding_simple.ts" doSomething()">
.ɵɵtext(1, "Do it") // SOURCE: "/output_binding_simple.ts" Do it
// TODO: Work out how to fix the broken segment for the last item in a template
.ɵɵelement // SOURCE: "/output_binding_simple.ts" </button>'

View File

@ -0,0 +1,11 @@
i0.ɵɵelementStart(0, "h3") // SOURCE: "/projection.ts" <h3>
i0.ɵɵprojection(1) // SOURCE: "/projection.ts" <ng-content select="title"></ng-content>
i0.ɵɵelementEnd() // SOURCE: "/projection.ts" </h3>
i0.ɵɵelementStart(2, "div") // SOURCE: "/projection.ts" <div>
i0.ɵɵprojection(3, 1) // SOURCE: "/projection.ts" <ng-content></ng-content>
i0.ɵɵelementEnd() // SOURCE: "/projection.ts" </div>

View File

@ -0,0 +1,10 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: `
<h3><ng-content select="title"></ng-content></h3>
<div><ng-content></ng-content></div>`
})
export class TestCmp {
}

View File

@ -0,0 +1,11 @@
.ɵɵelementStart(0, "h3") // SOURCE: "/projection.ts" <h3>
.ɵɵprojection(1) // SOURCE: "/projection.ts" <ng-content select="title"></ng-content>
.ɵɵelementEnd() // SOURCE: "/projection.ts" </h3>\n
.ɵɵelementStart(2, "div") // SOURCE: "/projection.ts" <div>
.ɵɵprojection(3, 1) // SOURCE: "/projection.ts" <ng-content></ng-content>
.ɵɵelem // SOURCE: "/projection.ts" </div>`

View File

@ -0,0 +1,5 @@
i0.ɵɵelementStart(0, "h1") // SOURCE: "/simple_element.ts" <h1>
i0.ɵɵtext(1, "Heading 1") // SOURCE: "/simple_element.ts" Heading 1
i0.ɵɵelementEnd() // SOURCE: "/simple_element.ts" </h1>

View File

@ -0,0 +1,8 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: '<h1>Heading 1</h1>',
})
export class TestCmp {
}

View File

@ -0,0 +1,6 @@
.ɵɵelementStart(0, "h1") // SOURCE: "/simple_element.ts" <h1>
.ɵɵtext(1, "Heading 1") // SOURCE: "/simple_element.ts" Heading 1
// TODO: Work out how to fix the broken segment for the last item in a template
.ɵɵele // SOURCE: "/simple_element.ts" </h1>'

View File

@ -0,0 +1,6 @@
i0.ɵɵelementStart(1, "input", 0) // SOURCE: "/two_way_binding_longhand.ts" <input
// TODO: improve mappings here
i0.ɵɵlistener("ngModelChange", function TestCmp_Template_input_ngModelChange_1_listener($event) { return ctx.name = $event; }) // SOURCE: "/two_way_binding_longhand.ts" bindon-ngModel="name"
i0.ɵɵelementEnd() // SOURCE: "/two_way_binding_longhand.ts" <input

View File

@ -0,0 +1,8 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: 'Name: <input bindon-ngModel="name">',
})
export class TestCmp {
}

View File

@ -0,0 +1,7 @@
.ɵɵelementStart(1, "input", 0) // SOURCE: "/two_way_binding_longhand.ts" <input
// TODO: improve mappings here
.ɵɵlistener("ngModelChange", function TestCmp_Template_input_ngModelChange_1_listener($event) {\n // SOURCE: "/two_way_binding_longhand.ts" bindon-ngModel="name">'
// TODO: Work out how to fix the broken segment for the last item in a template
.ɵɵelementEnd() // SOURCE: "/two_way_binding_longhand.ts" <input

View File

@ -0,0 +1,7 @@
i0.ɵɵelementStart(1, "input", 0) // SOURCE: "/two_way_binding_simple.ts" <input
// TODO: improve mappings here
i0.ɵɵlistener("ngModelChange", function TestCmp_Template_input_ngModelChange_1_listener($event) { return ctx.name = $event; }) // SOURCE: "/two_way_binding_simple.ts" [(ngModel)]="name"
i0.ɵɵelementEnd() // SOURCE: "/two_way_binding_simple.ts" <input

View File

@ -0,0 +1,8 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: 'Name: <input [(ngModel)]="name">',
})
export class TestCmp {
}

View File

@ -0,0 +1,7 @@
.ɵɵelementStart(1, "input", 0) // SOURCE: "/two_way_binding_simple.ts" <input
// TODO: improve mappings here
.ɵɵlistener("ngModelChange", function TestCmp_Template_input_ngModelChange_1_listener($event) {\n // SOURCE: "/two_way_binding_simple.ts" [(ngModel)]="name">'
.ɵɵelementEnd() // SOURCE: "/two_way_binding_simple.ts" <input

View File

@ -0,0 +1,15 @@
// NOTE: Creation mode
i0.ɵɵelementStart(0, "div") // SOURCE: "/update_mode.ts" <div>
i0.ɵɵtext(1, "this is a test") // SOURCE: "/update_mode.ts" this is a test
i0.ɵɵelementEnd() // SOURCE: "/update_mode.ts" </div>
i0.ɵɵelementStart(2, "div") // SOURCE: "/update_mode.ts" <div>
i0.ɵɵtext(3) // SOURCE: "/update_mode.ts" {{ 1 + 2 }}
i0.ɵɵelementEnd() // SOURCE: "/update_mode.ts" </div>
// NOTE: Update mode
i0.ɵɵtextInterpolate(1 + 2) // SOURCE: "/update_mode.ts" {{ 1 + 2 }}

View File

@ -0,0 +1,8 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: '<div>this is a test</div><div>{{ 1 + 2 }}</div>',
})
export class TestCmp {
}

View File

@ -0,0 +1,16 @@
// NOTE: Creation mode
.ɵɵelementStart(0, "div") // SOURCE: "/update_mode.ts" <div>
.ɵɵtext(1, "this is a test") // SOURCE: "/update_mode.ts" this is a test
.ɵɵelementEnd() // SOURCE: "/update_mode.ts" </div>
.ɵɵelementStart(2, "div") // SOURCE: "/update_mode.ts" <div>
.ɵɵtext(3) // SOURCE: "/update_mode.ts" {{ 1 + 2 }}
// TODO: Work out how to fix the broken segment for the last item in a template
.ɵɵelem // SOURCE: "/update_mode.ts" </div>'
// NOTE: Update mode
.ɵɵtextInterpolate(1 + 2) // SOURCE: "/update_mode.ts" {{ 1 + 2 }}

View File

@ -0,0 +1 @@
i0.ɵɵelement(0, "hr") // SOURCE: "/void_element.ts" <hr>

View File

@ -0,0 +1,8 @@
import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: '<hr>',
})
export class TestCmp {
}

View File

@ -0,0 +1,2 @@
// TODO: Work out how to fix the broken segment for the last item in a template
.ɵɵel // SOURCE: "/void_element.ts" <hr>'

View File

@ -586,37 +586,6 @@ runInEachFileSystem((os) => {
});
});
it('should create (simple backtick string) inline template source-mapping', () => {
const mappings = compileAndMap('<div>this is a test</div><div>{{ 1 + 2 }}</div>');
// Creation mode
expectMapping(
mappings,
{generated: 'i0.ɵɵelementStart(0, "div")', source: '<div>', sourceUrl: '../test.ts'});
expectMapping(mappings, {
generated: 'i0.ɵɵtext(1, "this is a test")',
source: 'this is a test',
sourceUrl: '../test.ts'
});
expectMapping(
mappings, {generated: 'i0.ɵɵelementEnd()', source: '</div>', sourceUrl: '../test.ts'});
expectMapping(
mappings,
{generated: 'i0.ɵɵelementStart(2, "div")', source: '<div>', sourceUrl: '../test.ts'});
expectMapping(
mappings, {generated: 'i0.ɵɵtext(3)', source: '{{ 1 + 2 }}', sourceUrl: '../test.ts'});
expectMapping(
mappings, {generated: 'i0.ɵɵelementEnd()', source: '</div>', sourceUrl: '../test.ts'});
// TODO(benlesh): We need to circle back and prevent the extra parens from being generated.
// Update mode
expectMapping(mappings, {
generated: 'i0.ɵɵtextInterpolate(1 + 2)',
source: '{{ 1 + 2 }}',
sourceUrl: '../test.ts'
});
});
it('should create correct inline template source-mapping when the source contains escape sequences',
() => {
// Note that the escaped double quotes, which need un-escaping to be parsed correctly.