mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +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">
|
||||
<a *ngIf="bitstreamDownloadUrl != null" [href]="bitstreamDownloadUrl"
|
||||
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>
|
||||
</a>
|
||||
<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 { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-data.utils';
|
||||
import { getBitstreamDownloadRoute } from '../../../../app-routing-paths';
|
||||
import { By } from '@angular/platform-browser';
|
||||
|
||||
let comp: ItemEditBitstreamComponent;
|
||||
let fixture: ComponentFixture<ItemEditBitstreamComponent>;
|
||||
@@ -119,8 +120,10 @@ describe('ItemEditBitstreamComponent', () => {
|
||||
});
|
||||
|
||||
describe('when the component loads', () => {
|
||||
it('should contain bitstreamDownloadUrl with the correct url to the bitstream\'s download page', () => {
|
||||
expect(comp.bitstreamDownloadUrl).toEqual(getBitstreamDownloadRoute(bitstream));
|
||||
it('the download button should contain the link to the bitstreams download page', () => {
|
||||
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