mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
97732 ContextHelpToggleComponent tests
This commit is contained in:
@@ -1,14 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
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', () => {
|
||||
let component: ContextHelpToggleComponent;
|
||||
let fixture: ComponentFixture<ContextHelpToggleComponent>;
|
||||
let contextHelpService;
|
||||
|
||||
beforeEach(async () => {
|
||||
contextHelpService = jasmine.createSpyObj('contextHelpService',
|
||||
['toggleIcons']);
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ContextHelpToggleComponent ]
|
||||
declarations: [ ContextHelpToggleComponent ],
|
||||
providers: [
|
||||
{ provide: ContextHelpService, useValue: contextHelpService },
|
||||
],
|
||||
imports: [ TranslateModule.forRoot() ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
@@ -22,4 +33,9 @@ describe('ContextHelpToggleComponent', () => {
|
||||
it('should create', () => {
|
||||
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