mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
#601 support for fallback thumbnails
This commit is contained in:
@@ -320,4 +320,29 @@ describe('DataTable', () => {
|
||||
expect(dataTable.isColumnSorted(<DataColumn> {key: 'column_1'}, 'asc')).toBeTruthy();
|
||||
expect(dataTable.isColumnSorted(<DataColumn> {key: 'column_2'}, 'desc')).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should replace image source with fallback thumbnail on error', () => {
|
||||
let event = <any> {
|
||||
srcElement: {
|
||||
src: 'missing-image'
|
||||
}
|
||||
};
|
||||
|
||||
dataTable.fallbackThumbnail = '<fallback>';
|
||||
dataTable.onImageLoadingError(event);
|
||||
expect(event.srcElement.src).toBe(dataTable.fallbackThumbnail);
|
||||
});
|
||||
|
||||
it('should replace image source only when fallback available', () => {
|
||||
const originalSrc = 'missing-image';
|
||||
let event = <any> {
|
||||
srcElement: {
|
||||
src: originalSrc
|
||||
}
|
||||
};
|
||||
|
||||
dataTable.fallbackThumbnail = null;
|
||||
dataTable.onImageLoadingError(event);
|
||||
expect(event.srcElement.src).toBe(originalSrc);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user