Commit 25e2bb57 authored by Konstantin Schulz's avatar Konstantin Schulz

added test for KWIC display

parent 940e425a
Pipeline #11838 passed with stages
in 2 minutes and 35 seconds
......@@ -100,7 +100,7 @@
</ion-row>
<ion-row>
<ion-col>
<ion-button (click)="getExerciseList()"
<ion-button (click)="getExerciseList(true)"
disabled="{{!hasVocChanged}}">{{ 'APPLY' | translate }}
</ion-button>
</ion-col>
......
......@@ -54,11 +54,11 @@ describe('ExerciseParametersPage', () => {
it('should generate an exercise', (done) => {
exerciseParametersPage.corpusService.annisResponse = {solutions: []};
exerciseParametersPage.corpusService.initCurrentCorpus().then(() => {
exerciseParametersPage.corpusService.initCurrentCorpus().then(async () => {
exerciseParametersPage.corpusService.currentTextRange = new ReplaySubject<TextRange>(1);
exerciseParametersPage.corpusService.currentTextRange.next(new TextRange({start: [], end: []}));
const h5pSpy: Spy = spyOn(exerciseParametersPage, 'getH5Pexercise').and.returnValue(Promise.resolve());
exerciseParametersPage.generateExercise().then(() => {
await exerciseParametersPage.generateExercise();
expect(exerciseParametersPage.corpusService.annisResponse.solutions).toBeFalsy();
expect(h5pSpy).toHaveBeenCalledTimes(1);
configMC.maxTextLength = 1;
......@@ -78,7 +78,6 @@ describe('ExerciseParametersPage', () => {
});
});
});
});
it('should get a display value', () => {
const pmc: PhenomenonMapContent = exerciseParametersPage.corpusService.phenomenonMap[Phenomenon.Lemma];
......
......@@ -9,7 +9,7 @@ import {TranslateTestingModule} from '../translate-testing/translate-testing.mod
import {APP_BASE_HREF} from '@angular/common';
describe('KwicPage', () => {
let component: KwicPage;
let kwicPage: KwicPage;
let fixture: ComponentFixture<KwicPage>;
beforeEach(async(() => {
......@@ -31,11 +31,16 @@ describe('KwicPage', () => {
beforeEach(() => {
fixture = TestBed.createComponent(KwicPage);
component = fixture.componentInstance;
kwicPage = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
expect(kwicPage).toBeTruthy();
const svgElement: SVGElement = document.querySelector(kwicPage.svgElementSelector);
expect(svgElement.innerHTML).toBeFalsy();
kwicPage.exerciseService.kwicGraphs = '<svg></svg>';
kwicPage.initVisualization();
expect(svgElement.innerHTML).toBeTruthy();
});
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment