WIP: prepare tests for failing scenarios discovered during collab

* Local refs needs more testing
* Basic variable read failed
* We do not have any tests for listeners? there was some restore view
  issue: https://github.com/angular/angular/commit/3acfdf4861d5eeed5b2ad42978547da929cc3567
This commit is contained in:
Paul Gschwendtner
2023-06-23 11:55:44 +00:00
parent faf5b21275
commit 6310ccc221
2 changed files with 53 additions and 0 deletions
@@ -198,6 +198,44 @@ describe('Signal component inputs', () => {
expect(dir2Instance.testInput()).toEqual(['foo', 'bar']);
expect(dir1Instance.testInput()).toBe(dir2Instance.testInput());
});
/*
Error: AssertionError: unresolved LexicalRead of i
cannot bind to lexical read, implicit receiver read without function
call expression.
*/
xit('should be able to bind to local refs in expressions', () => {
@Component({
standalone: true,
signals: true,
template: '{{elementBinding() !== undefined}}',
selector: 'whatever',
})
class Whatever {
@Input() elementBinding = input<HTMLElement>({required: true});
}
@Component({
template: `
<whatever [elementBinding]="varx">
`,
signals: true,
standalone: true,
imports: [Whatever],
})
class App {
varx = () => (true);
}
const fixture = TestBed.createComponent(App);
fixture.detectChanges();
expect(fixture.nativeElement.textContent).toBe('true');
});
});
// TODO:
@@ -0,0 +1,15 @@
/**
* @license
* Copyright Google LLC 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
*/
describe('listeners', () => {
it('should be able to invoke a listener',
() => {
// todo: listener restore view was missing.
// in template pipeline
});
});