Skip to content

Commit

Permalink
fix: click on image of image-text-button triggers change
Browse files Browse the repository at this point in the history
  • Loading branch information
dhhyi committed Aug 26, 2020
1 parent 2a60f9d commit d7da542
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="d-flex flex-wrap align-items-end pb-2">
<div *ngFor="let opt of parameter.domain?.elements" class="mr-3">
<div class="border" [ngClass]="{ 'border-primary': opt.selected }">
<img [src]="getImageUrl(opt.properties.tc_component_picture) | async" />
<img [src]="getImageUrl(opt.properties.tc_component_picture) | async" (click)="change(opt.name)" />
</div>
<label>
<input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,19 @@ describe('Tacton Image Text Buttons Component', () => {
fixture.detectChanges();

const input = fixture.debugElement.query(By.css('input')).nativeElement;
input.value = '3';
input.value = component.parameter.domain.elements[1].name;
input.dispatchEvent(new Event('change'));

verify(tactonFacade.commitValue(anything(), anything())).once();
expect(capture(tactonFacade.commitValue).last()[1]).toMatchInlineSnapshot(`"3"`);
expect(capture(tactonFacade.commitValue).last()[1]).toMatchInlineSnapshot(`"i2"`);
});

it('should trigger value commit if clicked on image', () => {
fixture.detectChanges();

fixture.debugElement.queryAll(By.css('img'))[1].triggerEventHandler('click', undefined);

verify(tactonFacade.commitValue(anything(), anything())).once();
expect(capture(tactonFacade.commitValue).last()[1]).toMatchInlineSnapshot(`"i2"`);
});
});

1 comment on commit d7da542

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Azure Demo Servers are available:

Please sign in to comment.