Language service uses a canonical "Tour of Heroes" project to test various features, but the files are all contained in test_data.ts which is hard to read and often contains errors that are difficult to catch without proper IDE syntax highlighting. The directory structure is also not clear from first glance. This PR refactors the test project into standalone files in the proper format. Next up: [ ] Update the interface of MockTypeScript to only accept scriptNames. [ ] Remove test_data.ts PR Close #32653
35 lines
855 B
TypeScript
35 lines
855 B
TypeScript
/**
|
|
* @license
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/
|
|
|
|
import {Component} from '@angular/core';
|
|
|
|
export class Hero {
|
|
id: number;
|
|
name: string;
|
|
}
|
|
|
|
@Component({
|
|
selector: 'my-app',
|
|
template: `~{empty}
|
|
<~{start-tag}h~{start-tag-after-h}1~{start-tag-h1} ~{h1-after-space}>
|
|
~{h1-content} {{~{sub-start}title~{sub-end}}}
|
|
</h1>
|
|
~{after-h1}<h2>{{~{h2-hero}hero.~{h2-name}name}} details!</h2>
|
|
<div><label>id: </label>{{~{label-hero}hero.~{label-id}id}}</div>
|
|
<div ~{div-attributes}>
|
|
<label>name: </label>
|
|
</div>
|
|
&~{entity-amp}amp;
|
|
`
|
|
})
|
|
export class AppComponent {
|
|
title = 'Tour of Heroes';
|
|
hero: Hero = {id: 1, name: 'Windstorm'};
|
|
private internal: string;
|
|
}
|