mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
101577: Added changes parameter to the ThumbnailComponent's ngOnChanges
This commit is contained in:
@@ -49,7 +49,7 @@ describe('ThumbnailComponent', () => {
|
||||
comp.src = 'http://bit.stream';
|
||||
comp.defaultImage = 'http://default.img';
|
||||
comp.errorHandler();
|
||||
comp.ngOnChanges();
|
||||
comp.ngOnChanges({});
|
||||
fixture.detectChanges();
|
||||
const image: HTMLElement = de.query(By.css('img')).nativeElement;
|
||||
expect(image.getAttribute('alt')).toBe('TRANSLATED ' + comp.alt);
|
||||
@@ -61,7 +61,7 @@ describe('ThumbnailComponent', () => {
|
||||
comp.errorHandler();
|
||||
expect(comp.src).toBe(null);
|
||||
|
||||
comp.ngOnChanges();
|
||||
comp.ngOnChanges({});
|
||||
fixture.detectChanges();
|
||||
const placeholder = fixture.debugElement.query(By.css('div.thumbnail-placeholder')).nativeElement;
|
||||
expect(placeholder.innerHTML).toBe('TRANSLATED ' + comp.placeholder);
|
||||
@@ -84,7 +84,7 @@ describe('ThumbnailComponent', () => {
|
||||
|
||||
it('should display an image', () => {
|
||||
comp.thumbnail = thumbnail;
|
||||
comp.ngOnChanges();
|
||||
comp.ngOnChanges({});
|
||||
fixture.detectChanges();
|
||||
const image: HTMLElement = de.query(By.css('img')).nativeElement;
|
||||
expect(image.getAttribute('src')).toBe(comp.thumbnail._links.content.href);
|
||||
@@ -92,7 +92,7 @@ describe('ThumbnailComponent', () => {
|
||||
|
||||
it('should include the alt text', () => {
|
||||
comp.thumbnail = thumbnail;
|
||||
comp.ngOnChanges();
|
||||
comp.ngOnChanges({});
|
||||
fixture.detectChanges();
|
||||
const image: HTMLElement = de.query(By.css('img')).nativeElement;
|
||||
expect(image.getAttribute('alt')).toBe('TRANSLATED ' + comp.alt);
|
||||
@@ -113,7 +113,7 @@ describe('ThumbnailComponent', () => {
|
||||
|
||||
it('should show a loading animation', () => {
|
||||
comp.thumbnail = thumbnail;
|
||||
comp.ngOnChanges();
|
||||
comp.ngOnChanges({});
|
||||
fixture.detectChanges();
|
||||
expect(de.query(By.css('ds-loading'))).toBeTruthy();
|
||||
});
|
||||
@@ -134,7 +134,7 @@ describe('ThumbnailComponent', () => {
|
||||
|
||||
it('should display an image', () => {
|
||||
comp.thumbnail = thumbnail;
|
||||
comp.ngOnChanges();
|
||||
comp.ngOnChanges({});
|
||||
fixture.detectChanges();
|
||||
const image: HTMLElement = de.query(By.css('img')).nativeElement;
|
||||
expect(image.getAttribute('src')).toBe(comp.thumbnail.payload._links.content.href);
|
||||
@@ -142,7 +142,7 @@ describe('ThumbnailComponent', () => {
|
||||
|
||||
it('should display the alt text', () => {
|
||||
comp.thumbnail = thumbnail;
|
||||
comp.ngOnChanges();
|
||||
comp.ngOnChanges({});
|
||||
fixture.detectChanges();
|
||||
const image: HTMLElement = de.query(By.css('img')).nativeElement;
|
||||
expect(image.getAttribute('alt')).toBe('TRANSLATED ' + comp.alt);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { Component, Input, OnChanges } from '@angular/core';
|
||||
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
|
||||
import { Bitstream } from '../core/shared/bitstream.model';
|
||||
import { hasValue } from '../shared/empty.util';
|
||||
import { RemoteData } from '../core/data/remote-data';
|
||||
@@ -51,7 +51,7 @@ export class ThumbnailComponent implements OnChanges {
|
||||
* Resolve the thumbnail.
|
||||
* Use a default image if no actual image is available.
|
||||
*/
|
||||
ngOnChanges(): void {
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
if (this.thumbnail === undefined || this.thumbnail === null) {
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user