mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
97732 ContextHelpToggleComponent tests
This commit is contained in:
@@ -1,14 +1,25 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { ContextHelpToggleComponent } from './context-help-toggle.component';
|
import { ContextHelpToggleComponent } from './context-help-toggle.component';
|
||||||
|
import { TranslateService, TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { ContextHelpService } from '../../shared/context-help.service';
|
||||||
|
import { of as observableOf } from 'rxjs';
|
||||||
|
import { By } from '@angular/platform-browser';
|
||||||
|
|
||||||
describe('ContextHelpToggleComponent', () => {
|
describe('ContextHelpToggleComponent', () => {
|
||||||
let component: ContextHelpToggleComponent;
|
let component: ContextHelpToggleComponent;
|
||||||
let fixture: ComponentFixture<ContextHelpToggleComponent>;
|
let fixture: ComponentFixture<ContextHelpToggleComponent>;
|
||||||
|
let contextHelpService;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
contextHelpService = jasmine.createSpyObj('contextHelpService',
|
||||||
|
['toggleIcons']);
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
declarations: [ ContextHelpToggleComponent ]
|
declarations: [ ContextHelpToggleComponent ],
|
||||||
|
providers: [
|
||||||
|
{ provide: ContextHelpService, useValue: contextHelpService },
|
||||||
|
],
|
||||||
|
imports: [ TranslateModule.forRoot() ]
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
});
|
});
|
||||||
@@ -22,4 +33,9 @@ describe('ContextHelpToggleComponent', () => {
|
|||||||
it('should create', () => {
|
it('should create', () => {
|
||||||
expect(component).toBeTruthy();
|
expect(component).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('clicking the button should toggle context help icon visibility', () => {
|
||||||
|
fixture.debugElement.query(By.css('a')).nativeElement.click();
|
||||||
|
expect(contextHelpService.toggleIcons).toHaveBeenCalled();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user