test(language-service): Add external template ()

This is in preparation for more rigorous testing of external templates, since it'll work differently under the new tsserver plugin model.

PR Close 
This commit is contained in:
Keen Yee Liau 2019-04-25 10:50:19 -07:00 committed by Andrew Kushnir
parent f4916730b5
commit 05eabb19d6
6 changed files with 44 additions and 2 deletions

@ -0,0 +1,22 @@
{
"seq": 0,
"type": "response",
"command": "quickinfo",
"request_seq": 4,
"success": true,
"body": {
"kind": "const",
"kindModifiers": "declare",
"start": {
"line": 1,
"offset": 17
},
"end": {
"line": 1,
"offset": 21
},
"displayString": "const name: never",
"documentation": "",
"tags": []
}
}

@ -2,6 +2,6 @@ import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: `<h1>Hello {{name}}</h1>`,
template: `<h1>Hello {{name}}</h1><my-widget></my-widget>`,
})
export class AppComponent { name = 'Angular'; }

@ -2,10 +2,11 @@ import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import { WidgetComponent } from './widget.component';
@NgModule({
imports: [ BrowserModule ],
declarations: [ AppComponent ],
declarations: [ AppComponent, WidgetComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }

@ -0,0 +1 @@
<h1>This is a {{name}} widget!</h1>

@ -0,0 +1,7 @@
import { Component } from '@angular/core';
@Component({
selector: 'my-widget',
templateUrl: './widget.component.html',
})
export class WidgetComponent { name = 'Angular'; }

@ -118,6 +118,17 @@ describe('Angular Language Service', () => {
offset: 28,
});
expect(resp2).toMatchGolden('quickinfo.json');
client.sendRequest('open', {
file: `${PWD}/project/app/widget.component.html`,
});
const resp3 = await client.sendRequest('quickinfo', {
file: `${PWD}/project/app/widget.component.html`,
line: 1,
offset: 19,
});
expect(resp3).toMatchGolden('quickinfo_externalTemplate.json');
});
it('should perform definition', async () => {