test(language-service): Create proper test project (#32653)

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
This commit is contained in:
Keen Yee Liau
2019-09-12 15:20:54 -07:00
committed by Andrew Kushnir
parent 2846505dbd
commit 9d8dc793da
14 changed files with 562 additions and 139 deletions

View File

@ -0,0 +1,48 @@
/**
* @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 interface Person {
name: string;
age: number;
}
@Component({
template: '{{~{foo}foo~{foo-end}}}',
})
export class WrongFieldReference {
bar = 'bar';
}
@Component({
template: '{{~{nam}person.nam~{nam-end}}}',
})
export class WrongSubFieldReference {
person: Person = {name: 'Bob', age: 23};
}
@Component({
template: '{{~{myField}myField~{myField-end}}}',
})
export class PrivateReference {
private myField = 'My Field';
}
@Component({
template: '{{~{mod}"a" ~{mod-end}% 2}}',
})
export class ExpectNumericType {
}
@Component({
template: '{{ (name | lowercase).~{string-pipe}substring }}',
})
export class LowercasePipe {
name: string;
}