mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
88507 Improved test
- Refactored the test for the download button - This way we're checking the actual href on the button, not the component's property
This commit is contained in:
@@ -20,7 +20,8 @@
|
|||||||
<div class="btn-group relationship-action-buttons">
|
<div class="btn-group relationship-action-buttons">
|
||||||
<a *ngIf="bitstreamDownloadUrl != null" [href]="bitstreamDownloadUrl"
|
<a *ngIf="bitstreamDownloadUrl != null" [href]="bitstreamDownloadUrl"
|
||||||
class="btn btn-outline-primary btn-sm"
|
class="btn btn-outline-primary btn-sm"
|
||||||
title="{{'item.edit.bitstreams.edit.buttons.download' | translate}}">
|
title="{{'item.edit.bitstreams.edit.buttons.download' | translate}}"
|
||||||
|
data-test="download-button">
|
||||||
<i class="fas fa-download fa-fw"></i>
|
<i class="fas fa-download fa-fw"></i>
|
||||||
</a>
|
</a>
|
||||||
<button [routerLink]="['/bitstreams/', bitstream.id, 'edit']" class="btn btn-outline-primary btn-sm"
|
<button [routerLink]="['/bitstreams/', bitstream.id, 'edit']" class="btn btn-outline-primary btn-sm"
|
||||||
|
@@ -11,6 +11,7 @@ import { ResponsiveTableSizes } from '../../../../shared/responsive-table-sizes/
|
|||||||
import { ResponsiveColumnSizes } from '../../../../shared/responsive-table-sizes/responsive-column-sizes';
|
import { ResponsiveColumnSizes } from '../../../../shared/responsive-table-sizes/responsive-column-sizes';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-data.utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-data.utils';
|
||||||
import { getBitstreamDownloadRoute } from '../../../../app-routing-paths';
|
import { getBitstreamDownloadRoute } from '../../../../app-routing-paths';
|
||||||
|
import { By } from '@angular/platform-browser';
|
||||||
|
|
||||||
let comp: ItemEditBitstreamComponent;
|
let comp: ItemEditBitstreamComponent;
|
||||||
let fixture: ComponentFixture<ItemEditBitstreamComponent>;
|
let fixture: ComponentFixture<ItemEditBitstreamComponent>;
|
||||||
@@ -119,8 +120,10 @@ describe('ItemEditBitstreamComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('when the component loads', () => {
|
describe('when the component loads', () => {
|
||||||
it('should contain bitstreamDownloadUrl with the correct url to the bitstream\'s download page', () => {
|
it('the download button should contain the link to the bitstreams download page', () => {
|
||||||
expect(comp.bitstreamDownloadUrl).toEqual(getBitstreamDownloadRoute(bitstream));
|
fixture.detectChanges();
|
||||||
|
const downloadBtnHref = fixture.debugElement.query(By.css('[data-test="download-button"]')).nativeElement.getAttribute('href');
|
||||||
|
expect(downloadBtnHref).toEqual(comp.bitstreamDownloadUrl);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user