Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
callidus
Machina Callida
Commits
25e2bb57
Commit
25e2bb57
authored
Jun 02, 2020
by
Konstantin Schulz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added test for KWIC display
parent
940e425a
Pipeline
#11838
passed with stages
in 2 minutes and 35 seconds
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
17 deletions
+21
-17
mc_frontend/src/app/exercise-list/exercise-list.page.html
mc_frontend/src/app/exercise-list/exercise-list.page.html
+1
-1
mc_frontend/src/app/exercise-parameters/exercise-parameters.page.spec.ts
.../app/exercise-parameters/exercise-parameters.page.spec.ts
+12
-13
mc_frontend/src/app/kwic/kwic.page.spec.ts
mc_frontend/src/app/kwic/kwic.page.spec.ts
+8
-3
No files found.
mc_frontend/src/app/exercise-list/exercise-list.page.html
View file @
25e2bb57
...
...
@@ -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>
...
...
mc_frontend/src/app/exercise-parameters/exercise-parameters.page.spec.ts
View file @
25e2bb57
...
...
@@ -54,27 +54,26 @@ 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
());
await
exerciseParametersPage
.
generateExercise
();
expect
(
exerciseParametersPage
.
corpusService
.
annisResponse
.
solutions
).
toBeFalsy
();
expect
(
h5pSpy
).
toHaveBeenCalledTimes
(
1
);
configMC
.
maxTextLength
=
1
;
exerciseParametersPage
.
corpusService
.
currentText
=
'
text
'
;
exerciseParametersPage
.
generateExercise
().
then
(()
=>
{
expect
(
exerciseParametersPage
.
corpusService
.
annisResponse
.
solutions
).
toBeFalsy
();
},
()
=>
{
expect
(
h5pSpy
).
toHaveBeenCalledTimes
(
1
);
configMC
.
maxTextLength
=
1
;
exerciseParametersPage
.
corpusService
.
currentText
=
'
text
'
;
configMC
.
maxTextLength
=
0
;
exerciseParametersPage
.
corpusService
.
exercise
.
queryItems
[
0
].
phenomenon
=
Phenomenon
.
Lemma
;
exerciseParametersPage
.
corpusService
.
exercise
.
type
=
ExerciseType
.
matching
;
exerciseParametersPage
.
corpusService
.
exercise
.
queryItems
.
push
(
new
QueryMC
({
values
:
[]}));
exerciseParametersPage
.
generateExercise
().
then
(()
=>
{
},
()
=>
{
expect
(
h5pSpy
).
toHaveBeenCalledTimes
(
1
);
configMC
.
maxTextLength
=
0
;
exerciseParametersPage
.
corpusService
.
exercise
.
queryItems
[
0
].
phenomenon
=
Phenomenon
.
Lemma
;
exerciseParametersPage
.
corpusService
.
exercise
.
type
=
ExerciseType
.
matching
;
exerciseParametersPage
.
corpusService
.
exercise
.
queryItems
.
push
(
new
QueryMC
({
values
:
[]}));
exerciseParametersPage
.
generateExercise
().
then
(()
=>
{
},
()
=>
{
expect
(
h5pSpy
).
toHaveBeenCalledTimes
(
1
);
done
();
});
done
();
});
});
});
...
...
mc_frontend/src/app/kwic/kwic.page.spec.ts
View file @
25e2bb57
...
...
@@ -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
();
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment