mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
97732 Fix flaky test for ContextHelpToggleComponent
This commit is contained in:
@@ -13,8 +13,9 @@ describe('ContextHelpToggleComponent', () => {
|
|||||||
const contextHelpEmpty$ = new BehaviorSubject(true);
|
const contextHelpEmpty$ = new BehaviorSubject(true);
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
contextHelpService = jasmine.createSpyObj('contextHelpService',
|
contextHelpService = jasmine.createSpyObj('contextHelpService', [
|
||||||
['toggleIcons', 'contextHelpEmpty$']);
|
'contextHelpEmpty$', 'toggleIcons'
|
||||||
|
]);
|
||||||
contextHelpService.contextHelpEmpty$.and.returnValue(contextHelpEmpty$);
|
contextHelpService.contextHelpEmpty$.and.returnValue(contextHelpEmpty$);
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
declarations: [ ContextHelpToggleComponent ],
|
declarations: [ ContextHelpToggleComponent ],
|
||||||
@@ -44,6 +45,7 @@ describe('ContextHelpToggleComponent', () => {
|
|||||||
|
|
||||||
it('clicking the button should toggle context help icon visibility', () => {
|
it('clicking the button should toggle context help icon visibility', () => {
|
||||||
fixture.whenStable().then((done) => {
|
fixture.whenStable().then((done) => {
|
||||||
|
spyOn(contextHelpService, 'toggleIcons');
|
||||||
fixture.debugElement.query(By.css('a')).nativeElement.click();
|
fixture.debugElement.query(By.css('a')).nativeElement.click();
|
||||||
expect(contextHelpService.toggleIcons).toHaveBeenCalled();
|
expect(contextHelpService.toggleIcons).toHaveBeenCalled();
|
||||||
done();
|
done();
|
||||||
@@ -54,6 +56,7 @@ describe('ContextHelpToggleComponent', () => {
|
|||||||
describe('if there are no elements on the page with a tooltip', () => {
|
describe('if there are no elements on the page with a tooltip', () => {
|
||||||
it('clicking the button does not toggle context help icon visibility', () => {
|
it('clicking the button does not toggle context help icon visibility', () => {
|
||||||
fixture.whenStable().then((done) => {
|
fixture.whenStable().then((done) => {
|
||||||
|
spyOn(contextHelpService, 'toggleIcons');
|
||||||
fixture.debugElement.query(By.css('a')).nativeElement.click();
|
fixture.debugElement.query(By.css('a')).nativeElement.click();
|
||||||
expect(contextHelpService.toggleIcons).toHaveBeenCalledTimes(0);
|
expect(contextHelpService.toggleIcons).toHaveBeenCalledTimes(0);
|
||||||
done();
|
done();
|
||||||
|
Reference in New Issue
Block a user