Fixes tests

parent 874a5de7
Pipeline #18348 passed with stages
in 9 minutes and 38 seconds
......@@ -102,7 +102,8 @@
"tslib": "^1.7.1",
"tslint": "~5.10.0",
"typescript": "^2.7",
"webpack-cli": "^2.1.4"
"webpack-cli": "^2.1.4",
"webpack-node-externals": "^1.7.2"
},
"keywords": [
"arsnova",
......
......@@ -3,7 +3,7 @@ import { enableProdMode } from '@angular/core';
import { ngExpressEngine } from '@nguniversal/express-engine';
// Import module map for lazy loading
import { provideModuleMap } from '@nguniversal/module-map-ngfactory-loader';
import { COMMUNICATION_PROTOCOL } from 'arsnova-click-v2-types/src/communication_protocol';
import { COMMUNICATION_PROTOCOL } from 'arsnova-click-v2-types/dist/communication_protocol';
import * as bodyParser from 'body-parser';
import * as child_process from 'child_process';
import * as compress from 'compression';
......
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
import { ActivatedRoute } from '@angular/router';
import { IQuestionChoice } from 'arsnova-click-v2-types/src/questions/interfaces';
import { IQuestionChoice } from 'arsnova-click-v2-types/dist/questions/interfaces';
import { Subscription } from 'rxjs';
import { DEVICE_TYPES, LIVE_PREVIEW_ENVIRONMENT } from '../../../environments/environment';
import { ActiveQuestionGroupService } from '../../service/active-question-group/active-question-group.service';
......@@ -24,8 +24,7 @@ export class LivePreviewComponent implements OnInit, OnDestroy {
return this._targetEnvironment;
}
@Input()
set targetEnvironment(value: LIVE_PREVIEW_ENVIRONMENT) {
@Input() set targetEnvironment(value: LIVE_PREVIEW_ENVIRONMENT) {
this._targetEnvironment = value;
}
......@@ -35,8 +34,7 @@ export class LivePreviewComponent implements OnInit, OnDestroy {
return this._targetDevice;
}
@Input()
set targetDevice(value: DEVICE_TYPES) {
@Input() set targetDevice(value: DEVICE_TYPES) {
this._targetDevice = value;
}
......@@ -104,11 +102,9 @@ export class LivePreviewComponent implements OnInit, OnDestroy {
}
public ngOnInit(): void {
this._subscription = this.questionTextService.eventEmitter.subscribe(
value => {
this.dataSource = value;
},
);
this._subscription = this.questionTextService.eventEmitter.subscribe(value => {
this.dataSource = value;
});
switch (this.targetEnvironment) {
case this.ENVIRONMENT_TYPE.ANSWEROPTIONS:
this._routerSubscription = this.route.params.subscribe(params => {
......
import { Component, Inject, PLATFORM_ID } from '@angular/core';
import { Router } from '@angular/router';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { COMMUNICATION_PROTOCOL } from 'arsnova-click-v2-types/src/communication_protocol';
import { IModal } from 'arsnova-click-v2-types/src/modals/interfaces';
import { IQuestionGroup } from 'arsnova-click-v2-types/src/questions/interfaces';
import { questionGroupReflection } from 'arsnova-click-v2-types/src/questions/questionGroup_reflection';
import { COMMUNICATION_PROTOCOL } from 'arsnova-click-v2-types/dist/communication_protocol';
import { IModal } from 'arsnova-click-v2-types/dist/modals/interfaces';
import { IQuestionGroup } from 'arsnova-click-v2-types/dist/questions/interfaces';
import { questionGroupReflection } from 'arsnova-click-v2-types/dist/questions/questionGroup_reflection';
import { ActiveQuestionGroupService } from '../../service/active-question-group/active-question-group.service';
import { LobbyApiService } from '../../service/api/lobby/lobby-api.service';
import { QuizApiService } from '../../service/api/quiz/quiz-api.service';
......
import { Component, Inject, OnInit, PLATFORM_ID } from '@angular/core';
import { Router } from '@angular/router';
import { IMessage } from 'arsnova-click-v2-types/src/common';
import { COMMUNICATION_PROTOCOL } from 'arsnova-click-v2-types/src/communication_protocol';
import { IMessage } from 'arsnova-click-v2-types/dist/common';
import { COMMUNICATION_PROTOCOL } from 'arsnova-click-v2-types/dist/communication_protocol';
import { Subscription } from 'rxjs/index';
import { MemberApiService } from '../../../service/api/member/member-api.service';
import { AttendeeService } from '../../../service/attendee/attendee.service';
......
import { Component, OnInit, SecurityContext } from '@angular/core';
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
import { ActivatedRoute, Router } from '@angular/router';
import { ILeaderBoardItem, IMessage } from 'arsnova-click-v2-types/src/common';
import { COMMUNICATION_PROTOCOL } from 'arsnova-click-v2-types/src/communication_protocol';
import { ILeaderBoardItem, IMessage } from 'arsnova-click-v2-types/dist/common';
import { COMMUNICATION_PROTOCOL } from 'arsnova-click-v2-types/dist/communication_protocol';
import { Subscription } from 'rxjs';
import { parseGithubFlavoredMarkdown } from '../../../../lib/markdown/markdown';
import { LeaderboardApiService } from '../../../service/api/leaderboard/leaderboard-api.service';
......
......@@ -3,9 +3,9 @@ import { Component, Inject, OnDestroy, PLATFORM_ID, SecurityContext } from '@ang
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
import { Router } from '@angular/router';
import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { IMessage, INickname } from 'arsnova-click-v2-types/src/common';
import { COMMUNICATION_PROTOCOL } from 'arsnova-click-v2-types/src/communication_protocol';
import { questionGroupReflection } from 'arsnova-click-v2-types/src/questions/questionGroup_reflection';
import { IMessage, INickname } from 'arsnova-click-v2-types/dist/common';
import { COMMUNICATION_PROTOCOL } from 'arsnova-click-v2-types/dist/communication_protocol';
import { questionGroupReflection } from 'arsnova-click-v2-types/dist/questions/questionGroup_reflection';
import { parseGithubFlavoredMarkdown } from '../../../../lib/markdown/markdown';
import { ActiveQuestionGroupService } from '../../../service/active-question-group/active-question-group.service';
import { MemberApiService } from '../../../service/api/member/member-api.service';
......
......@@ -4,7 +4,7 @@ import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'
import { RouterTestingModule } from '@angular/router/testing';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { TranslateCompiler, TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { IQuestionChoice } from 'arsnova-click-v2-types/src/questions/interfaces';
import { IQuestionChoice } from 'arsnova-click-v2-types/dist/questions/interfaces';
import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler';
import { Attendee } from '../../../../../lib/attendee/attendee';
import { createTranslateLoader } from '../../../../../lib/translation.factory';
......
import { Component, Input } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { IFreetextAnswerOption } from 'arsnova-click-v2-types/src/answeroptions/interfaces';
import { IQuestion } from 'arsnova-click-v2-types/src/questions/interfaces';
import { FreeTextQuestion } from 'arsnova-click-v2-types/src/questions/question_freetext';
import { RangedQuestion } from 'arsnova-click-v2-types/src/questions/question_ranged';
import { IFreetextAnswerOption } from 'arsnova-click-v2-types/dist/answeroptions/interfaces';
import { IQuestion } from 'arsnova-click-v2-types/dist/questions/interfaces';
import { FreeTextQuestion } from 'arsnova-click-v2-types/dist/questions/question_freetext';
import { RangedQuestion } from 'arsnova-click-v2-types/dist/questions/question_ranged';
import { AttendeeService } from '../../../../service/attendee/attendee.service';
import { CurrentQuizService } from '../../../../service/current-quiz/current-quiz.service';
import { I18nService } from '../../../../service/i18n/i18n.service';
......
import { Component, OnInit } from '@angular/core';
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
import { ActivatedRoute, Router } from '@angular/router';
import { IMessage, INickname } from 'arsnova-click-v2-types/src/common';
import { COMMUNICATION_PROTOCOL } from 'arsnova-click-v2-types/src/communication_protocol';
import { IQuestion } from 'arsnova-click-v2-types/src/questions/interfaces';
import { IMessage, INickname } from 'arsnova-click-v2-types/dist/common';
import { COMMUNICATION_PROTOCOL } from 'arsnova-click-v2-types/dist/communication_protocol';
import { IQuestion } from 'arsnova-click-v2-types/dist/questions/interfaces';
import { AttendeeService } from '../../../../service/attendee/attendee.service';
import { ConnectionService } from '../../../../service/connection/connection.service';
import { CurrentQuizService } from '../../../../service/current-quiz/current-quiz.service';
......
......@@ -3,7 +3,7 @@ import { HttpClientTestingModule } from '@angular/common/http/testing';
import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { TranslateCompiler, TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core';
import { SurveyQuestion } from 'arsnova-click-v2-types/src/questions/question_survey';
import { SurveyQuestion } from 'arsnova-click-v2-types/dist/questions/question_survey';
import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler';
import { Attendee } from '../../../../lib/attendee/attendee';
import { Countdown } from '../../../../lib/countdown/countdown';
......@@ -112,42 +112,45 @@ describe('QuizResultsComponent', () => {
expect(component.showLeaderBoardButton(currentQuizService.questionIndex)).toBeTruthy();
}));
it(`#showStopQuizButton`, inject([CurrentQuizService, AttendeeService], (currentQuizService: CurrentQuizService, attendeeService: AttendeeService) => {
currentQuizService['_isOwner'] = true;
currentQuizService.currentQuestion().timer = 0;
attendeeService.addMember(new Attendee({
id: 0,
name: 'testNickname',
groupName: 'Default',
colorCode: '#00000',
responses: [],
it(`#showStopQuizButton`,
inject([CurrentQuizService, AttendeeService], (currentQuizService: CurrentQuizService, attendeeService: AttendeeService) => {
currentQuizService['_isOwner'] = true;
currentQuizService.currentQuestion().timer = 0;
attendeeService.addMember(new Attendee({
id: 0,
name: 'testNickname',
groupName: 'Default',
colorCode: '#00000',
responses: [],
}));
expect(component.showStopQuizButton()).toBeTruthy();
}));
expect(component.showStopQuizButton()).toBeTruthy();
}));
it(`#showStopCountdownButton`,
inject([CurrentQuizService, AttendeeService], (currentQuizService: CurrentQuizService, attendeeService: AttendeeService) => {
currentQuizService.currentQuestion().timer = 10;
currentQuizService['_isOwner'] = true;
attendeeService.addMember(new Attendee({
id: 0,
name: 'testNickname',
groupName: 'Default',
colorCode: '#00000',
responses: [],
}));
component.countdown = new Countdown(currentQuizService.currentQuestion(), new Date().getTime());
it(`#showStopCountdownButton`, inject([CurrentQuizService, AttendeeService], (currentQuizService: CurrentQuizService, attendeeService: AttendeeService) => {
currentQuizService.currentQuestion().timer = 10;
currentQuizService['_isOwner'] = true;
attendeeService.addMember(new Attendee({
id: 0,
name: 'testNickname',
groupName: 'Default',
colorCode: '#00000',
responses: [],
expect(component.countdown.isRunning).toBeTruthy();
expect(component.showStopCountdownButton()).toBeTruthy();
}));
component.countdown = new Countdown(currentQuizService.currentQuestion(), new Date().getTime());
expect(component.countdown.isRunning).toBeTruthy();
expect(component.showStopCountdownButton()).toBeTruthy();
}));
it(`#showStartQuizButton`,
inject([CurrentQuizService, AttendeeService], (currentQuizService: CurrentQuizService, attendeeService: AttendeeService) => {
currentQuizService['_isOwner'] = true;
currentQuizService.readingConfirmationRequested = true;
it(`#showStartQuizButton`, inject([CurrentQuizService, AttendeeService], (currentQuizService: CurrentQuizService, attendeeService: AttendeeService) => {
currentQuizService['_isOwner'] = true;
currentQuizService.readingConfirmationRequested = true;
expect(component.showStartQuizButton()).toBeTruthy();
}));
expect(component.showStartQuizButton()).toBeTruthy();
}));
it(`#hideProgressbarCssStyle`, inject([CurrentQuizService], (currentQuizService: CurrentQuizService) => {
currentQuizService.readingConfirmationRequested = false;
......@@ -155,25 +158,26 @@ describe('QuizResultsComponent', () => {
expect(component.hideProgressbarCssStyle()).toBeTruthy();
}));
it(`#showConfidenceRate`, inject([CurrentQuizService, AttendeeService], (currentQuizService: CurrentQuizService, attendeeService: AttendeeService) => {
attendeeService.addMember(new Attendee({
id: 0,
name: 'testNickname',
groupName: 'Default',
colorCode: '#00000',
responses: [
{
value: 0,
confidence: 20,
readingConfirmation: true,
responseTime: 10,
},
],
}));
currentQuizService.quiz.sessionConfig.confidenceSliderEnabled = true;
it(`#showConfidenceRate`,
inject([CurrentQuizService, AttendeeService], (currentQuizService: CurrentQuizService, attendeeService: AttendeeService) => {
attendeeService.addMember(new Attendee({
id: 0,
name: 'testNickname',
groupName: 'Default',
colorCode: '#00000',
responses: [
{
value: 0,
confidence: 20,
readingConfirmation: true,
responseTime: 10,
},
],
}));
currentQuizService.quiz.sessionConfig.confidenceSliderEnabled = true;
expect(component.showConfidenceRate(component.selectedQuestionIndex)).toBeTruthy();
}));
expect(component.showConfidenceRate(component.selectedQuestionIndex)).toBeTruthy();
}));
it(`#modifyVisibleQuestion`, inject([QuestionTextService], async (questionTextService: QuestionTextService) => {
spyOn(questionTextService, 'changeMultiple').and.callFake(() => {});
......@@ -210,25 +214,26 @@ describe('QuizResultsComponent', () => {
}
}));
it(`#showReadingConfirmation`, inject([CurrentQuizService, AttendeeService], (currentQuizService: CurrentQuizService, attendeeService: AttendeeService) => {
attendeeService.addMember(new Attendee({
id: 0,
name: 'testNickname',
groupName: 'Default',
colorCode: '#00000',
responses: [
{
value: 0,
confidence: 20,
readingConfirmation: true,
responseTime: 10,
},
],
}));
currentQuizService.quiz.sessionConfig.readingConfirmationEnabled = true;
it(`#showReadingConfirmation`,
inject([CurrentQuizService, AttendeeService], (currentQuizService: CurrentQuizService, attendeeService: AttendeeService) => {
attendeeService.addMember(new Attendee({
id: 0,
name: 'testNickname',
groupName: 'Default',
colorCode: '#00000',
responses: [
{
value: 0,
confidence: 20,
readingConfirmation: true,
responseTime: 10,
},
],
}));
currentQuizService.quiz.sessionConfig.readingConfirmationEnabled = true;
expect(component.showReadingConfirmation(component.selectedQuestionIndex)).toBeTruthy();
}));
expect(component.showReadingConfirmation(component.selectedQuestionIndex)).toBeTruthy();
}));
it(`#showResponseProgress`, inject([CurrentQuizService], (currentQuizService: CurrentQuizService) => {
......
import { Component, OnDestroy, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { IMessage, INickname } from 'arsnova-click-v2-types/src/common';
import { COMMUNICATION_PROTOCOL } from 'arsnova-click-v2-types/src/communication_protocol';
import { IQuestion } from 'arsnova-click-v2-types/src/questions/interfaces';
import { FreeTextQuestion } from 'arsnova-click-v2-types/src/questions/question_freetext';
import { RangedQuestion } from 'arsnova-click-v2-types/src/questions/question_ranged';
import { SurveyQuestion } from 'arsnova-click-v2-types/src/questions/question_survey';
import { IMessage, INickname } from 'arsnova-click-v2-types/dist/common';
import { COMMUNICATION_PROTOCOL } from 'arsnova-click-v2-types/dist/communication_protocol';
import { IQuestion } from 'arsnova-click-v2-types/dist/questions/interfaces';
import { FreeTextQuestion } from 'arsnova-click-v2-types/dist/questions/question_freetext';
import { RangedQuestion } from 'arsnova-click-v2-types/dist/questions/question_ranged';
import { SurveyQuestion } from 'arsnova-click-v2-types/dist/questions/question_survey';
import { Countdown } from '../../../../lib/countdown/countdown';
import { QuizApiService } from '../../../service/api/quiz/quiz-api.service';
import { AttendeeService } from '../../../service/attendee/attendee.service';
......
import { Component, Inject, OnInit, PLATFORM_ID } from '@angular/core';
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
import { Router } from '@angular/router';
import { IMessage } from 'arsnova-click-v2-types/src/common';
import { COMMUNICATION_PROTOCOL } from 'arsnova-click-v2-types/src/communication_protocol';
import { IMessage } from 'arsnova-click-v2-types/dist/common';
import { COMMUNICATION_PROTOCOL } from 'arsnova-click-v2-types/dist/communication_protocol';
import { MemberApiService } from '../../../service/api/member/member-api.service';
import { AttendeeService } from '../../../service/attendee/attendee.service';
import { ConnectionService } from '../../../service/connection/connection.service';
......
import { Component, OnDestroy, OnInit } from '@angular/core';
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
import { Router } from '@angular/router';
import { IMessage } from 'arsnova-click-v2-types/src/common';
import { COMMUNICATION_PROTOCOL } from 'arsnova-click-v2-types/src/communication_protocol';
import { MultipleChoiceQuestion } from 'arsnova-click-v2-types/src/questions/question_choice_multiple';
import { SingleChoiceQuestion } from 'arsnova-click-v2-types/src/questions/question_choice_single';
import { FreeTextQuestion } from 'arsnova-click-v2-types/src/questions/question_freetext';
import { RangedQuestion } from 'arsnova-click-v2-types/src/questions/question_ranged';
import { SurveyQuestion } from 'arsnova-click-v2-types/src/questions/question_survey';
import { IMessage } from 'arsnova-click-v2-types/dist/common';
import { COMMUNICATION_PROTOCOL } from 'arsnova-click-v2-types/dist/communication_protocol';
import { MultipleChoiceQuestion } from 'arsnova-click-v2-types/dist/questions/question_choice_multiple';
import { SingleChoiceQuestion } from 'arsnova-click-v2-types/dist/questions/question_choice_single';
import { FreeTextQuestion } from 'arsnova-click-v2-types/dist/questions/question_freetext';
import { RangedQuestion } from 'arsnova-click-v2-types/dist/questions/question_ranged';
import { SurveyQuestion } from 'arsnova-click-v2-types/dist/questions/question_survey';
import { Countdown } from '../../../../lib/countdown/countdown';
import { MemberApiService } from '../../../service/api/member/member-api.service';
import { QuizApiService } from '../../../service/api/quiz/quiz-api.service';
......
......@@ -5,7 +5,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { JWT_OPTIONS, JwtModule } from '@auth0/angular-jwt';
import { TranslateCompiler, TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { COMMUNICATION_PROTOCOL } from 'arsnova-click-v2-types/src/communication_protocol';
import { COMMUNICATION_PROTOCOL } from 'arsnova-click-v2-types/dist/communication_protocol';
import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler';
import { of } from 'rxjs/index';
import { jwtOptionsFactory } from '../../../lib/jwt.factory';
......
import { Component, Inject, OnInit, PLATFORM_ID } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { COMMUNICATION_PROTOCOL } from 'arsnova-click-v2-types/src/communication_protocol';
import { questionGroupReflection } from 'arsnova-click-v2-types/src/questions/questionGroup_reflection';
import { COMMUNICATION_PROTOCOL } from 'arsnova-click-v2-types/dist/communication_protocol';
import { questionGroupReflection } from 'arsnova-click-v2-types/dist/questions/questionGroup_reflection';
import { Subscription } from 'rxjs';
import { LobbyApiService } from '../../service/api/lobby/lobby-api.service';
import { QuizApiService } from '../../service/api/quiz/quiz-api.service';
......
import { Component, OnDestroy, OnInit } from '@angular/core';
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
import { IAvailableNicks } from 'arsnova-click-v2-types/src/common';
import { IAvailableNicks } from 'arsnova-click-v2-types/dist/common';
import { parseGithubFlavoredMarkdown } from '../../../../lib/markdown/markdown';
import { ActiveQuestionGroupService } from '../../../service/active-question-group/active-question-group.service';
import { NickApiService } from '../../../service/api/nick/nick-api.service';
......@@ -46,14 +46,14 @@ export class NicknameManagerComponent implements OnInit, OnDestroy {
this.footerBarService.TYPE_REFERENCE = NicknameManagerComponent.TYPE;
this.footerBarService.replaceFooterElements([
this.footerBarService.footerElemBack,
this.footerBarService.footerElemBlockRudeNicknames,
this.footerBarService.footerElemEnableCasLogin,
this.footerBarService.footerElemBack, this.footerBarService.footerElemBlockRudeNicknames, this.footerBarService.footerElemEnableCasLogin,
]);
}
public filterForKeyword(event: Event): void {
const searchValue = (<HTMLInputElement>event.target).value.toString().toLowerCase();
const searchValue = (
<HTMLInputElement>event.target
).value.toString().toLowerCase();
if (searchValue.length < this._previousSearchValue.length) {
this._availableNicks = Object.assign({}, this._availableNicksBackup);
......@@ -164,14 +164,11 @@ export class NicknameManagerComponent implements OnInit, OnDestroy {
}
public ngOnInit(): void {
this.nickApiService.getPredefinedNicks().subscribe(
data => {
this.availableNicks = data;
},
error => {
console.log(error);
},
);
this.nickApiService.getPredefinedNicks().subscribe(data => {
this.availableNicks = data;
}, error => {
console.log(error);
});
}
public ngOnDestroy(): void {
......
......@@ -5,8 +5,8 @@ import { ActivatedRoute } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { NgbModalModule } from '@ng-bootstrap/ng-bootstrap';
import { TranslateCompiler, TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { DefaultAnswerOption } from 'arsnova-click-v2-types/src/answeroptions/answeroption_default';
import { IQuestionSurvey } from 'arsnova-click-v2-types/src/questions/interfaces';
import { DefaultAnswerOption } from 'arsnova-click-v2-types/dist/answeroptions/answeroption_default';
import { IQuestionSurvey } from 'arsnova-click-v2-types/dist/questions/interfaces';
import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler';
import { createTranslateLoader } from '../../../../../../lib/translation.factory';
import { HeaderComponent } from '../../../../../header/header/header.component';
......
import { Component, HostListener, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { IQuestionChoice, IQuestionSurvey } from 'arsnova-click-v2-types/src/questions/interfaces';
import { IQuestionChoice, IQuestionSurvey } from 'arsnova-click-v2-types/dist/questions/interfaces';
import { DEVICE_TYPES, LIVE_PREVIEW_ENVIRONMENT } from '../../../../../../environments/environment';
import { ActiveQuestionGroupService } from '../../../../../service/active-question-group/active-question-group.service';
import { HeaderLabelService } from '../../../../../service/header-label/header-label.service';
......@@ -44,12 +44,18 @@ export class AnsweroptionsDefaultComponent implements OnInit, OnDestroy {
}
public updateAnswerValue(event: Event, index: number): void {
this._question.answerOptionList[index].answerText = (<HTMLInputElement>event.target).value;
this._question.answerOptionList[index].answerText = (
<HTMLInputElement>event.target
).value;
this.questionTextService.changeMultiple(this._question.answerOptionList.map(answer => answer.answerText));
}
public toggleMultipleSelectionSurvey(): void {
(<IQuestionSurvey>this._question).multipleSelectionEnabled = !(<IQuestionSurvey>this._question).multipleSelectionEnabled;
(
<IQuestionSurvey>this._question
).multipleSelectionEnabled = !(
<IQuestionSurvey>this._question
).multipleSelectionEnabled;
}
public toggleShowOneAnswerPerRow(): void {
......
......@@ -4,7 +4,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ActivatedRoute } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { TranslateCompiler, TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { IFreetextAnswerOption } from 'arsnova-click-v2-types/src/answeroptions/interfaces';
import { IFreetextAnswerOption } from 'arsnova-click-v2-types/dist/answeroptions/interfaces';
import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler';
import { createTranslateLoader } from '../../../../../../lib/translation.factory';
import { ActiveQuestionGroupMockService } from '../../../../../service/active-question-group/active-question-group.mock.service';
......
import { Component, HostListener, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { FreeTextAnswerOption } from 'arsnova-click-v2-types/src/answeroptions/answeroption_freetext';
import { IFreetextAnswerOption } from 'arsnova-click-v2-types/src/answeroptions/interfaces';
import { IQuestion } from 'arsnova-click-v2-types/src/questions/interfaces';
import { FreeTextAnswerOption } from 'arsnova-click-v2-types/dist/answeroptions/answeroption_freetext';
import { IFreetextAnswerOption } from 'arsnova-click-v2-types/dist/answeroptions/interfaces';
import { IQuestion } from 'arsnova-click-v2-types/dist/questions/interfaces';
import { Subscription } from 'rxjs';
import { ActiveQuestionGroupService } from '../../../../../service/active-question-group/active-question-group.service';
import { HeaderLabelService } from '../../../../../service/header-label/header-label.service';
......@@ -42,21 +42,24 @@ export class AnsweroptionsFreetextComponent implements OnInit, OnDestroy {
private _questionIndex: number;
private _routerSubscription: Subscription;
constructor(
private headerLabelService: HeaderLabelService,
private activeQuestionGroupService: ActiveQuestionGroupService,
private route: ActivatedRoute,
constructor(private headerLabelService: HeaderLabelService,
private activeQuestionGroupService: ActiveQuestionGroupService,
private route: ActivatedRoute,
) {
headerLabelService.headerLabel = 'component.quiz_manager.title';
}
public setTestInput(event: Event): void {
this._testInput = (<HTMLTextAreaElement>event.target).value;
this._testInput = (
<HTMLTextAreaElement>event.target
).value;
}
public setMatchText(event: Event): void {
this._question.answerOptionList[0].answerText = (<HTMLTextAreaElement>event.target).value;
this._question.answerOptionList[0].answerText = (
<HTMLTextAreaElement>event.target
).value;
}
public hasTestInput(): boolean {
......@@ -64,11 +67,15 @@ export class AnsweroptionsFreetextComponent implements OnInit, OnDestroy {
}
public isTestInputCorrect(): boolean {
return (<FreeTextAnswerOption>this._question.answerOptionList[0]).isCorrectInput(this._testInput);
return (
<FreeTextAnswerOption>this._question.answerOptionList[0]
).isCorrectInput(this._testInput);
}
public setConfig(configIdentifier: string, configValue: boolean): void {
(<FreeTextAnswerOption>this._question.answerOptionList[0]).setConfig(configIdentifier, configValue);
(
<FreeTextAnswerOption>this._question.answerOptionList[0]
).setConfig(configIdentifier, configValue);
}
public ngOnInit(): void {
......
import { Component, HostListener, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { IQuestionRanged } from 'arsnova-click-v2-types/src/questions/interfaces';
import { IQuestionRanged } from 'arsnova-click-v2-types/dist/questions/interfaces';
import { Subscription } from 'rxjs';
import { ActiveQuestionGroupService } from '../../../../../service/active-question-group/active-question-group.service';
import { HeaderLabelService } from '../../../../../service/header-label/header-label.service';
......@@ -40,24 +40,29 @@ export class AnsweroptionsRangedComponent implements OnInit, OnDestroy {
private _questionIndex: number;
private _routerSubscription: Subscription;
constructor(
private headerLabelService: HeaderLabelService,
private activeQuestionGroupService: ActiveQuestionGroupService,
private route: ActivatedRoute,
constructor(private headerLabelService: HeaderLabelService,
private activeQuestionGroupService: ActiveQuestionGroupService,
private route: ActivatedRoute,
) {
headerLabelService.headerLabel = 'component.quiz_manager.title';
}
public updateMinRange(event: Event): void {
this._minRange = parseInt((<HTMLInputElement>event.target).value, 10);
this._minRange = parseInt((
<HTMLInputElement>event.target
).value, 10);
}
public updateMaxRange(event: Event): void {
this._maxRange = parseInt((<HTMLInputElement>event.target).value, 10);
this._maxRange = parseInt((
<HTMLInputElement>event.target
).value, 10);
}
public updateCorrectValue(event: Event): void {
this._correctValue = parseInt((<HTMLInputElement>event.target).value, 10);
this._correctValue = parseInt((
<HTMLInputElement>event.target
).value, 10);
}
public ngOnInit(): void {
......
import { Component, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { IQuestion } from 'arsnova-click-v2-types/src/questions/interfaces';
import { IQuestion } from 'arsnova-click-v2-types/dist/questions/interfaces';
import { Subscription } from 'rxjs';
import { ActiveQuestionGroupService } from '../../../../service/active-question-group/active-question-group.service';
import { FooterBarService } from '../../../../service/footer-bar/footer-bar.service';
......@@ -28,14 +28,13 @@ export class AnsweroptionsComponent implements OnInit, OnDestroy {
private headerLabelService: HeaderLabelService,
private activeQuestionGroupService: ActiveQuestionGroupService,
private route: ActivatedRoute,
private footerBarService: FooterBarService) {
private footerBarService: FooterBarService,
) {