'Testing Angular's dblclick in Jasmine
I have a (dblclick)="edit(item)" event on my page and I want to test its behavior.
<tbody>
<tr *ngFor="let item of items$ | async" (dblclick)="edit(item)">
<!-- ... -->
</tr>
</tbody>
it('Given row double-clicked, then navigate to details', (done) => {
const items = [
{ id: 1, name: 'Someone' }
] as User[];
store.dispatch(searchSuccess({ items }));
fixture.detectChanges();
page.querySelector('tbody>tr').dblclick();
fixture.detectChanges();
setTimeout(() => {
expect(location.path()).toContain('/1');
done();
}, 100);
});
The issue being, that my test is failing because it says that dblclick() is not a function.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
