Skip to content

Commit

Permalink
change!: rename imageClick to itemClick
Browse files Browse the repository at this point in the history
Since it never was limited to just images, the image in the name doesn't
make sense. Item is better.
  • Loading branch information
daelmaak committed Sep 4, 2023
1 parent 3dfcda6 commit 8aa1545
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
[arrowTemplate]="arrowTemplate"
[aria]="aria"
[isRtl]="isRtl"
(imageClick)="imageClick.emit($event)"
(itemClick)="itemClick.emit($event)"
(descriptionClick)="descriptionClick.emit($event)"
(selection)="_selectInternal($event); _thumbsRef?.select($event)"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ describe('GalleryComponent', () => {
}));

it('should emit event when viewer image clicked', () => {
const imageClickSpy = spyOn(component.imageClick, 'emit');
const itemClickSpy = spyOn(component.itemClick, 'emit');
const secondItem = de.queryAll(By.css('viewer ul li'))[1];

const mockedClick = { name: 'mocked-event' } as any;
secondItem.triggerEventHandler('click', mockedClick);

expect(imageClickSpy).toHaveBeenCalled();
expect(imageClickSpy).toHaveBeenCalledWith({
expect(itemClickSpy).toHaveBeenCalled();
expect(itemClickSpy).toHaveBeenCalledWith({
item: component.items[1],
index: 1,
event: mockedClick,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class GalleryComponent {
@Input() thumbsArrowTemplate: TemplateRef<never>;
@Input() thumbErrorTemplate: TemplateRef<never>;

@Output() imageClick = new EventEmitter<GalleryItemEvent>();
@Output() itemClick = new EventEmitter<GalleryItemEvent>();
@Output() thumbClick = new EventEmitter<GalleryItemEvent>();
@Output() thumbHover = new EventEmitter<GalleryItemEvent>();
@Output() descriptionClick = new EventEmitter<Event>();
Expand Down
4 changes: 2 additions & 2 deletions libs/gallery/src/lib/components/viewer/viewer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export class ViewerComponent implements OnChanges, OnInit, AfterViewInit {
@Input()
isRtl: boolean;

@Output() imageClick = new EventEmitter<GalleryItemEvent>();
@Output() itemClick = new EventEmitter<GalleryItemEvent>();
@Output() descriptionClick = new EventEmitter<Event>();
@Output() selection = new EventEmitter<number>();

Expand Down Expand Up @@ -209,7 +209,7 @@ export class ViewerComponent implements OnChanges, OnInit, AfterViewInit {
}

onImageClick(item: GalleryItemInternal, event: Event) {
this.imageClick.emit({
this.itemClick.emit({
event,
item,
index: this.items.indexOf(item),
Expand Down

0 comments on commit 8aa1545

Please sign in to comment.