refactor: using ᐱ instead of Δ in tests (#30338)
This is in preparation to move instructions back to using `Δ` prefix PR Close #30338
This commit is contained in:
parent
509352fc36
commit
eccc41c5cf
@ -26,22 +26,22 @@ describe('definitions', () => {
|
|||||||
|
|
||||||
it('should be able to find field in an interpolation', () => {
|
it('should be able to find field in an interpolation', () => {
|
||||||
localReference(
|
localReference(
|
||||||
` @Component({template: '{{«name»}}'}) export class MyComponent { «ΔnameΔ: string;» }`);
|
` @Component({template: '{{«name»}}'}) export class MyComponent { «ᐱnameᐱ: string;» }`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be able to find a field in a attribute reference', () => {
|
it('should be able to find a field in a attribute reference', () => {
|
||||||
localReference(
|
localReference(
|
||||||
` @Component({template: '<input [(ngModel)]="«name»">'}) export class MyComponent { «ΔnameΔ: string;» }`);
|
` @Component({template: '<input [(ngModel)]="«name»">'}) export class MyComponent { «ᐱnameᐱ: string;» }`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be able to find a method from a call', () => {
|
it('should be able to find a method from a call', () => {
|
||||||
localReference(
|
localReference(
|
||||||
` @Component({template: '<div (click)="«myClick»();"></div>'}) export class MyComponent { «ΔmyClickΔ() { }»}`);
|
` @Component({template: '<div (click)="«myClick»();"></div>'}) export class MyComponent { «ᐱmyClickᐱ() { }»}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be able to find a field reference in an *ngIf', () => {
|
it('should be able to find a field reference in an *ngIf', () => {
|
||||||
localReference(
|
localReference(
|
||||||
` @Component({template: '<div *ngIf="«include»"></div>'}) export class MyComponent { «ΔincludeΔ = true;»}`);
|
` @Component({template: '<div *ngIf="«include»"></div>'}) export class MyComponent { «ᐱincludeᐱ = true;»}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be able to find a reference to a component', () => {
|
it('should be able to find a reference to a component', () => {
|
||||||
@ -165,4 +165,4 @@ function stringifySpan(span: Span) {
|
|||||||
|
|
||||||
function stringifySpans(spans: Span[]) {
|
function stringifySpans(spans: Span[]) {
|
||||||
return spans ? `[${spans.map(stringifySpan).join(', ')}]` : '<empty>';
|
return spans ? `[${spans.map(stringifySpan).join(', ')}]` : '<empty>';
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ describe('hover', () => {
|
|||||||
|
|
||||||
it('should be able to find a method from a call', () => {
|
it('should be able to find a method from a call', () => {
|
||||||
hover(
|
hover(
|
||||||
` @Component({template: '<div (click)="«ΔmyClickΔ()»;"></div>'}) export class MyComponent { myClick() { }}`,
|
` @Component({template: '<div (click)="«ᐱmyClickᐱ()»;"></div>'}) export class MyComponent { myClick() { }}`,
|
||||||
'method myClick of MyComponent');
|
'method myClick of MyComponent');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -52,19 +52,19 @@ describe('hover', () => {
|
|||||||
|
|
||||||
it('should be able to find a reference to a component', () => {
|
it('should be able to find a reference to a component', () => {
|
||||||
hover(
|
hover(
|
||||||
` @Component({template: '«<ΔtestΔ-comp></test-comp>»'}) export class MyComponent { }`,
|
` @Component({template: '«<ᐱtestᐱ-comp></test-comp>»'}) export class MyComponent { }`,
|
||||||
'component TestComponent');
|
'component TestComponent');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be able to find an event provider', () => {
|
it('should be able to find an event provider', () => {
|
||||||
hover(
|
hover(
|
||||||
` @Component({template: '<test-comp «(ΔtestΔ)="myHandler()"»></div>'}) export class MyComponent { myHandler() {} }`,
|
` @Component({template: '<test-comp «(ᐱtestᐱ)="myHandler()"»></div>'}) export class MyComponent { myHandler() {} }`,
|
||||||
'event testEvent of TestComponent');
|
'event testEvent of TestComponent');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be able to find an input provider', () => {
|
it('should be able to find an input provider', () => {
|
||||||
hover(
|
hover(
|
||||||
` @Component({template: '<test-comp «[ΔtcNameΔ]="name"»></div>'}) export class MyComponent { name = 'my name'; }`,
|
` @Component({template: '<test-comp «[ᐱtcNameᐱ]="name"»></div>'}) export class MyComponent { name = 'my name'; }`,
|
||||||
'property name of TestComponent');
|
'property name of TestComponent');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -111,4 +111,4 @@ describe('hover', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function toText(hover: Hover): string { return hover.text.map(h => h.text).join(''); }
|
function toText(hover: Hover): string { return hover.text.map(h => h.text).join(''); }
|
||||||
});
|
});
|
||||||
|
@ -143,8 +143,8 @@ export class References {}
|
|||||||
|
|
||||||
@Component({selector: 'test-comp', template: '<div>Testing: {{name}}</div>'})
|
@Component({selector: 'test-comp', template: '<div>Testing: {{name}}</div>'})
|
||||||
export class TestComponent {
|
export class TestComponent {
|
||||||
«@Input('ΔtcNameΔ') name = 'test';»
|
«@Input('ᐱtcNameᐱ') name = 'test';»
|
||||||
«@Output('ΔtestΔ') testEvent = new EventEmitter();»
|
«@Output('ᐱtestᐱ') testEvent = new EventEmitter();»
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({templateUrl: 'test.ng'})
|
@Component({templateUrl: 'test.ng'})
|
||||||
|
@ -278,7 +278,7 @@ function getLocationMarkers(value: string): {[name: string]: number} {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
const referenceMarker = /«(((\w|\-)+)|([^Δ]*Δ(\w+)Δ.[^»]*))»/g;
|
const referenceMarker = /«(((\w|\-)+)|([^ᐱ]*ᐱ(\w+)ᐱ.[^»]*))»/g;
|
||||||
const definitionMarkerGroup = 1;
|
const definitionMarkerGroup = 1;
|
||||||
const nameMarkerGroup = 2;
|
const nameMarkerGroup = 2;
|
||||||
|
|
||||||
@ -300,7 +300,7 @@ function getReferenceMarkers(value: string): ReferenceResult {
|
|||||||
const text = value.replace(
|
const text = value.replace(
|
||||||
referenceMarker, (match: string, text: string, reference: string, _: string,
|
referenceMarker, (match: string, text: string, reference: string, _: string,
|
||||||
definition: string, definitionName: string, index: number): string => {
|
definition: string, definitionName: string, index: number): string => {
|
||||||
const result = reference ? text : text.replace(/Δ/g, '');
|
const result = reference ? text : text.replace(/ᐱ/g, '');
|
||||||
const span: Span = {start: index - adjustment, end: index - adjustment + result.length};
|
const span: Span = {start: index - adjustment, end: index - adjustment + result.length};
|
||||||
const markers = reference ? references : definitions;
|
const markers = reference ? references : definitions;
|
||||||
const name = reference || definitionName;
|
const name = reference || definitionName;
|
||||||
@ -313,7 +313,7 @@ function getReferenceMarkers(value: string): ReferenceResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function removeReferenceMarkers(value: string): string {
|
function removeReferenceMarkers(value: string): string {
|
||||||
return value.replace(referenceMarker, (match, text) => text.replace(/Δ/g, ''));
|
return value.replace(referenceMarker, (match, text) => text.replace(/ᐱ/g, ''));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function noDiagnostics(diagnostics: Diagnostics) {
|
export function noDiagnostics(diagnostics: Diagnostics) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user