Skip to content

Commit 0559e1e

Browse files
101577: Added changes parameter to the ThumbnailComponent's ngOnChanges
1 parent 30cbcbb commit 0559e1e

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/app/thumbnail/thumbnail.component.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe('ThumbnailComponent', () => {
4949
comp.src = 'http://bit.stream';
5050
comp.defaultImage = 'http://default.img';
5151
comp.errorHandler();
52-
comp.ngOnChanges();
52+
comp.ngOnChanges({});
5353
fixture.detectChanges();
5454
const image: HTMLElement = de.query(By.css('img')).nativeElement;
5555
expect(image.getAttribute('alt')).toBe('TRANSLATED ' + comp.alt);
@@ -61,7 +61,7 @@ describe('ThumbnailComponent', () => {
6161
comp.errorHandler();
6262
expect(comp.src).toBe(null);
6363

64-
comp.ngOnChanges();
64+
comp.ngOnChanges({});
6565
fixture.detectChanges();
6666
const placeholder = fixture.debugElement.query(By.css('div.thumbnail-placeholder')).nativeElement;
6767
expect(placeholder.innerHTML).toBe('TRANSLATED ' + comp.placeholder);
@@ -84,15 +84,15 @@ describe('ThumbnailComponent', () => {
8484

8585
it('should display an image', () => {
8686
comp.thumbnail = thumbnail;
87-
comp.ngOnChanges();
87+
comp.ngOnChanges({});
8888
fixture.detectChanges();
8989
const image: HTMLElement = de.query(By.css('img')).nativeElement;
9090
expect(image.getAttribute('src')).toBe(comp.thumbnail._links.content.href);
9191
});
9292

9393
it('should include the alt text', () => {
9494
comp.thumbnail = thumbnail;
95-
comp.ngOnChanges();
95+
comp.ngOnChanges({});
9696
fixture.detectChanges();
9797
const image: HTMLElement = de.query(By.css('img')).nativeElement;
9898
expect(image.getAttribute('alt')).toBe('TRANSLATED ' + comp.alt);
@@ -113,7 +113,7 @@ describe('ThumbnailComponent', () => {
113113

114114
it('should show a loading animation', () => {
115115
comp.thumbnail = thumbnail;
116-
comp.ngOnChanges();
116+
comp.ngOnChanges({});
117117
fixture.detectChanges();
118118
expect(de.query(By.css('ds-loading'))).toBeTruthy();
119119
});
@@ -134,15 +134,15 @@ describe('ThumbnailComponent', () => {
134134

135135
it('should display an image', () => {
136136
comp.thumbnail = thumbnail;
137-
comp.ngOnChanges();
137+
comp.ngOnChanges({});
138138
fixture.detectChanges();
139139
const image: HTMLElement = de.query(By.css('img')).nativeElement;
140140
expect(image.getAttribute('src')).toBe(comp.thumbnail.payload._links.content.href);
141141
});
142142

143143
it('should display the alt text', () => {
144144
comp.thumbnail = thumbnail;
145-
comp.ngOnChanges();
145+
comp.ngOnChanges({});
146146
fixture.detectChanges();
147147
const image: HTMLElement = de.query(By.css('img')).nativeElement;
148148
expect(image.getAttribute('alt')).toBe('TRANSLATED ' + comp.alt);

src/app/thumbnail/thumbnail.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, Input, OnChanges } from '@angular/core';
1+
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
22
import { Bitstream } from '../core/shared/bitstream.model';
33
import { hasValue } from '../shared/empty.util';
44
import { RemoteData } from '../core/data/remote-data';
@@ -51,7 +51,7 @@ export class ThumbnailComponent implements OnChanges {
5151
* Resolve the thumbnail.
5252
* Use a default image if no actual image is available.
5353
*/
54-
ngOnChanges(): void {
54+
ngOnChanges(changes: SimpleChanges): void {
5555
if (this.thumbnail === undefined || this.thumbnail === null) {
5656
return;
5757
}

0 commit comments

Comments
 (0)