test(language-service): Add external template (#30128)
This is in preparation for more rigorous testing of external templates, since it'll work differently under the new tsserver plugin model. PR Close #30128
This commit is contained in:
parent
f4916730b5
commit
05eabb19d6
|
@ -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 () => {
|
||||
|
|
Loading…
Reference in New Issue