mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Fix ItemVersionsComponent no expectation tests
- The buttons are now not disabled anymore but hidden when you don't have the correct authorization - Wrong css class was used for the edit buttons
This commit is contained in:
@@ -4,7 +4,7 @@ import {
|
|||||||
} from '@angular/core/testing';
|
} from '@angular/core/testing';
|
||||||
import { VarDirective } from '../../shared/utils/var.directive';
|
import { VarDirective } from '../../shared/utils/var.directive';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { Item } from '../../core/shared/item.model';
|
import { Item } from '../../core/shared/item.model';
|
||||||
import { Version } from '../../core/shared/version.model';
|
import { Version } from '../../core/shared/version.model';
|
||||||
import { VersionHistory } from '../../core/shared/version-history.model';
|
import { VersionHistory } from '../../core/shared/version-history.model';
|
||||||
@@ -220,20 +220,21 @@ describe('ItemVersionsComponent', () => {
|
|||||||
authorizationServiceSpy.isAuthorized.and.callFake(canDelete);
|
authorizationServiceSpy.isAuthorized.and.callFake(canDelete);
|
||||||
}));
|
}));
|
||||||
it('should not disable the delete button', () => {
|
it('should not disable the delete button', () => {
|
||||||
const deleteButtons = fixture.debugElement.queryAll(By.css(`.version-row-element-delete`));
|
const deleteButtons: DebugElement[] = fixture.debugElement.queryAll(By.css('.version-row-element-delete'));
|
||||||
deleteButtons.forEach((btn) => {
|
expect(deleteButtons.length).not.toBe(0);
|
||||||
|
deleteButtons.forEach((btn: DebugElement) => {
|
||||||
expect(btn.nativeElement.disabled).toBe(false);
|
expect(btn.nativeElement.disabled).toBe(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('should disable other buttons', () => {
|
|
||||||
const createButtons = fixture.debugElement.queryAll(By.css(`.version-row-element-create`));
|
it('should hide the create buttons', () => {
|
||||||
createButtons.forEach((btn) => {
|
const createButtons: DebugElement[] = fixture.debugElement.queryAll(By.css('.version-row-element-create'));
|
||||||
expect(btn.nativeElement.disabled).toBe(true);
|
expect(createButtons.length).toBe(0);
|
||||||
});
|
});
|
||||||
const editButtons = fixture.debugElement.queryAll(By.css(`.version-row-element-create`));
|
|
||||||
editButtons.forEach((btn) => {
|
it('should hide the edit buttons', () => {
|
||||||
expect(btn.nativeElement.disabled).toBe(true);
|
const editButtons: DebugElement[] = fixture.debugElement.queryAll(By.css('.version-row-element-edit'));
|
||||||
});
|
expect(editButtons.length).toBe(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user