Upgrades to angular 9

parent b40c1ec8
This diff is collapsed.
#!/bin/sh
npm install
echo "Installing npm modules"
npm install --verbose
echo "Running tslint"
node_modules/tslint/bin/tslint -c tslint.json -p tsconfig.json
echo "Running unit tests"
npm test
echo "Installing angular-http-server"
npm install -g angular-http-server
echo "Building the app"
npm run build:"$1"
cd /usr/src/app/dist
echo "Starting the http server"
angular-http-server --path browser/ --silent -p 4711 &
cd /usr/src/app/dist/browser/assets/jobs
echo "Generating link images"
node GenerateMetaNodes.js --command=generateLinkImages --baseUrl="$2"
echo "Generating manifest"
node GenerateMetaNodes.js --command=generateManifest --baseUrl="$2"
echo "Generating preview screenshots"
node --experimental-modules GenerateImages.mjs --command=all --host=http://localhost:4711 --root=true
cd /usr/src/app
echo "Purifying css"
npm run purify
echo "Gzipping app files"
find dist/browser -name "*.*" -type f -print0 | xargs -0 gzip -9 -k
......@@ -44,60 +44,60 @@
},
"private": true,
"dependencies": {
"@angular-devkit/build-angular": "^0.803.25",
"@angular/animations": "^8.2.13",
"@angular/common": "^8.2.13",
"@angular/compiler": "^8.2.13",
"@angular/core": "^8.2.13",
"@angular/forms": "^8.2.13",
"@angular/platform-browser": "^8.2.13",
"@angular/platform-browser-dynamic": "^8.2.13",
"@angular/pwa": "^0.13.9",
"@angular/router": "^8.2.13",
"@angular/service-worker": "^8.2.13",
"@auth0/angular-jwt": "3.0.1",
"@angular-devkit/build-angular": "~0.900.1",
"@angular/animations": "^9.0.0",
"@angular/common": "^9.0.0",
"@angular/compiler": "^9.0.0",
"@angular/core": "^9.0.0",
"@angular/forms": "^9.0.0",
"@angular/localize": "^9.0.0",
"@angular/platform-browser": "^9.0.0",
"@angular/platform-browser-dynamic": "^9.0.0",
"@angular/router": "^9.0.0",
"@angular/service-worker": "^9.0.0",
"@auth0/angular-jwt": "4.0.0",
"@fortawesome/angular-fontawesome": "^0.5.0",
"@fortawesome/fontawesome-svg-core": "^1.2.25",
"@fortawesome/free-solid-svg-icons": "^5.11.2",
"@ng-bootstrap/ng-bootstrap": "^5.1.4",
"@fortawesome/fontawesome-svg-core": "^1.2.27",
"@fortawesome/free-solid-svg-icons": "^5.12.1",
"@ng-bootstrap/ng-bootstrap": "^5.2.1",
"@ng-bootstrap/schematics": "^2.0.0-alpha.1",
"@ngx-translate/core": "^11.0.1",
"@ngx-translate/core": "^12.0.0",
"@ngx-translate/http-loader": "~4.0.0",
"@sentry/browser": "^5.9.0",
"@sentry/browser": "^5.12.1",
"@stomp/ng2-stompjs": "^7.2.0",
"angular-svg-icon": "^8.0.0",
"angulartics2": "^8.1.0",
"angularx-qrcode": "^1.6.4",
"bootstrap": "^4.4.0",
"angulartics2": "^8.3.0",
"angularx-qrcode": "^2.1.0",
"bootstrap": "^4.4.1",
"cors": "^2.8.5",
"dexie": "^2.0.4",
"marked": "^0.7.0",
"marked": "^0.8.0",
"messageformat": "^2.3.0",
"ng2-simple-mq": "^8.2.1",
"ngx-infinite-scroll": "^8.0.1",
"ngx-markdown": "^8.2.1",
"ngx-toastr": "^11.2.1",
"ngx-markdown": "^8.2.2",
"ngx-toastr": "^12.0.0",
"ngx-translate-messageformat-compiler": "^4.5.0",
"node-sass": "^4.13.0",
"node-sass": "^4.13.1",
"prism-themes": "^1.3.0",
"rxjs": "~6.4.0",
"rxjs": "~6.5.4",
"ts-loader": "^6.2.1",
"tslib": "^1.10.0",
"web-animations-js": "^2.3.2",
"zone.js": "~0.9.1"
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular/cli": "^8.3.25",
"@angular/compiler-cli": "^8.2.13",
"@angular/language-service": "^8.2.13",
"@angular/cli": "^9.0.1",
"@angular/compiler-cli": "^9.0.0",
"@angular/language-service": "^9.0.0",
"@types/jasmine": "^3.3.16",
"@types/jasminewd2": "^2.0.8",
"@types/modernizr": "^3.5.3",
"@types/node": "~8.9.4",
"@types/node": "^12.11.1",
"@types/webpack": "^4.39.8",
"chrome-launcher": "^0.10.7",
"chrome-remote-interface": "^0.27.2",
"codelyzer": "^5.2.0",
"codelyzer": "^5.1.2",
"imagemin": "^7.0.0",
"imagemin-pngquant": "^8.0.0",
"jasmine-core": "~3.5.0",
......@@ -113,11 +113,11 @@
"protractor": "^5.4.2",
"puppeteer": "^2.0.0",
"purify-css": "~1.2.5",
"rimraf": "^3.0.0",
"rimraf": "^3.0.1",
"sharp": "^0.22.1",
"ts-node": "~7.0.0",
"tslint": "~5.20.1",
"typescript": "~3.5.3"
"typescript": "~3.7.5"
},
"keywords": [
"arsnova",
......
......@@ -40,8 +40,7 @@ describe('FooterBarComponent', () => {
}),
],
providers: [
RxStompService,
{
RxStompService, {
provide: StorageService,
useClass: StorageServiceMock,
}, FooterBarService, SharedService, {
......@@ -78,20 +77,26 @@ describe('FooterBarComponent', () => {
expect(FooterBarComponent.TYPE).toEqual('FooterBarComponent');
}));
it('#getLinkTarget', (inject([FooterBarService], (footerBarService: FooterBarService) => {
expect(component.getLinkTarget(footerBarService.footerElemAbout)).toEqual(jasmine.arrayContaining(['info', 'tos']));
})));
it('#getLinkTarget', (
inject([FooterBarService], (footerBarService: FooterBarService) => {
expect(component.getLinkTarget(footerBarService.footerElemAbout)).toEqual(jasmine.arrayContaining(['info', 'tos']));
})
));
it('#toggleSetting', (inject([FooterBarService, TrackingService], (footerBarService: FooterBarService, trackingService: TrackingService) => {
const elem = footerBarService.footerElemAbout;
spyOn(trackingService, 'trackClickEvent').and.callFake(() => {});
component.toggleSetting(elem);
expect(trackingService.trackClickEvent).toHaveBeenCalled();
})));
it('#toggleSetting', (
inject([FooterBarService, TrackingService], (footerBarService: FooterBarService, trackingService: TrackingService) => {
const elem = footerBarService.footerElemAbout;
spyOn(trackingService, 'trackClickEvent').and.callFake(() => {});
component.toggleSetting(elem);
expect(trackingService.trackClickEvent).toHaveBeenCalled();
})
));
it('#fileChange', (inject([FileUploadService], (fileUploadService: FileUploadService) => {
spyOn(fileUploadService, 'uploadFile').and.callFake(() => {});
component.fileChange({ target: { files: [new File([], 'testFile')] } });
expect(fileUploadService.uploadFile).toHaveBeenCalled();
})));
it('#fileChange', (
inject([FileUploadService], (fileUploadService: FileUploadService) => {
spyOn(fileUploadService, 'uploadFile').and.callFake(() => {});
component.fileChange({ target: { files: [new File([], 'testFile')] } });
expect(fileUploadService.uploadFile).toHaveBeenCalled();
})
));
});
......@@ -9,7 +9,7 @@ export abstract class AbstractAnswerEntity {
protected constructor(props) {
this.answerText = props.answerText ? props.answerText : this.answerText;
this.isCorrect = typeof props.isCorrect !== 'undefined' ? props.isCorrect : this.isCorrect;
this.isCorrect = props.isCorrect ?? this.isCorrect;
}
public getAnswerTextLengthWithoutMarkdownChars(): number {
......@@ -35,7 +35,9 @@ export abstract class AbstractAnswerEntity {
}
public getValidationStackTrace(): Array<IValidationStackTrace> {
return (this.answerText.length === 0) ? [
return (
this.answerText.length === 0
) ? [
{
occurredAt: { type: 'answerOption' },
reason: 'component.quiz_summary.validation_errors.reasons.answer_text_empty',
......
......@@ -14,10 +14,10 @@ export class FreeTextAnswerEntity extends AbstractAnswerEntity {
constructor(props) {
super(props);
this.configCaseSensitive = typeof props.configCaseSensitive !== 'undefined' ? props.configCaseSensitive : this.configCaseSensitive;
this.configTrimWhitespaces = typeof props.configTrimWhitespaces !== 'undefined' ? props.configTrimWhitespaces : this.configTrimWhitespaces;
this.configUseKeywords = typeof props.configUseKeywords !== 'undefined' ? props.configUseKeywords : this.configUseKeywords;
this.configUsePunctuation = typeof props.configUsePunctuation !== 'undefined' ? props.configUsePunctuation : this.configUsePunctuation;
this.configCaseSensitive = props.configCaseSensitive ?? this.configCaseSensitive;
this.configTrimWhitespaces = props.configTrimWhitespaces ?? this.configTrimWhitespaces;
this.configUseKeywords = props.configUseKeywords ?? this.configUseKeywords;
this.configUsePunctuation = props.configUsePunctuation ?? this.configUsePunctuation;
}
public isCorrectInput(ref: string): boolean {
......@@ -75,22 +75,30 @@ export class FreeTextAnswerEntity extends AbstractAnswerEntity {
return [
{
configTitle: 'component.answeroptions.free_text_question.config_case_sensitive',
configEnabledString: 'component.answeroptions.free_text_question.' + (this.configCaseSensitive ? 'onText' : 'offText'),
configEnabledString: 'component.answeroptions.free_text_question.' + (
this.configCaseSensitive ? 'onText' : 'offText'
),
enabled: this.configCaseSensitive,
id: 'config_case_sensitive_switch',
}, {
configTitle: 'component.answeroptions.free_text_question.config_trim_whitespaces',
configEnabledString: 'component.answeroptions.free_text_question.' + (this.configTrimWhitespaces ? 'onText' : 'offText'),
configEnabledString: 'component.answeroptions.free_text_question.' + (
this.configTrimWhitespaces ? 'onText' : 'offText'
),
enabled: this.configTrimWhitespaces,
id: 'config_trim_whitespaces_switch',
}, {
configTitle: 'component.answeroptions.free_text_question.config_use_keywords',
configEnabledString: 'component.answeroptions.free_text_question.' + (this.configUseKeywords ? 'onText' : 'offText'),
configEnabledString: 'component.answeroptions.free_text_question.' + (
this.configUseKeywords ? 'onText' : 'offText'
),
enabled: this.configUseKeywords,
id: 'config_use_keywords_switch',
}, {
configTitle: 'component.answeroptions.free_text_question.config_use_punctuation',
configEnabledString: 'component.answeroptions.free_text_question.' + (this.configUsePunctuation ? 'onText' : 'offText'),
configEnabledString: 'component.answeroptions.free_text_question.' + (
this.configUsePunctuation ? 'onText' : 'offText'
),
enabled: this.configUsePunctuation,
id: 'config_use_punctuation_switch',
},
......
......@@ -16,7 +16,7 @@ export abstract class AbstractQuestionEntity {
protected constructor(data) {
this.questionText = data.questionText ? data.questionText : this.questionText;
this.timer = typeof data.timer === 'number' ? data.timer : this.timer;
this.displayAnswerText = typeof data.displayAnswerText !== 'undefined' ? data.displayAnswerText : this.displayAnswerText;
this.displayAnswerText = data.displayAnswerText ?? this.displayAnswerText;
if (data.answerOptionList) {
if (data.TYPE === QuestionType.FreeTextQuestion) {
......
......@@ -34,7 +34,7 @@ describe('MarkdownBarComponent', () => {
}));
beforeEach(async(() => {
const library: FaIconLibrary = TestBed.get(FaIconLibrary);
const library: FaIconLibrary = TestBed.inject(FaIconLibrary);
library.addIcons(faBold);
library.addIcons(faHeading);
library.addIcons(faGlobe);
......
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateService } from '@ngx-translate/core';
import { TranslatePipeMock } from '../../../_mocks/_pipes/TranslatePipeMock';
import { TranslateServiceMock } from '../../../_mocks/_services/TranslateServiceMock';
import { HeaderLabelService } from '../../service/header-label/header-label.service';
import { I18nTestingModule } from '../../shared/testing/i18n-testing/i18n-testing.module';
import { ServerUnavailableModalComponent } from './server-unavailable-modal.component';
......@@ -12,12 +11,8 @@ describe('ServerUnavailableModalComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
providers: [
HeaderLabelService, {
provide: TranslateService,
useClass: TranslateServiceMock,
},
],
imports: [I18nTestingModule],
providers: [HeaderLabelService],
declarations: [ServerUnavailableModalComponent, TranslatePipeMock],
})
.compileComponents();
......
......@@ -63,7 +63,7 @@ describe('FilterKeysPipe', () => {
}));
beforeEach(async(() => {
pipe = new FilterKeysPipe(TestBed.get(LanguageLoaderService));
pipe = new FilterKeysPipe(TestBed.inject(LanguageLoaderService));
}));
it('create an instance', () => {
......
......@@ -34,7 +34,7 @@ export class QuizAdminFilterPipe implements PipeTransform {
if (isFiltered && args.filterQuizName && args.filterQuizName.length) {
const match = quiz.name.trim().toLowerCase().match(new RegExp(args.filterQuizName, 'i'));
isFiltered = match && match.length > 0;
isFiltered = match?.length > 0;
}
if (isFiltered && args.filterActiveQuiz) {
......
......@@ -17,12 +17,10 @@ describe('UnusedKeyFilterPipe', () => {
{
key: 'test1key',
value: 'test1value',
},
{
}, {
key: 'test2key',
value: 'test2value',
},
{
}, {
key: 'unused-key',
value: 'unused-value',
},
......@@ -60,7 +58,7 @@ describe('UnusedKeyFilterPipe', () => {
}));
beforeEach(async(() => {
pipe = new UnusedKeyFilterPipe(TestBed.get(LanguageLoaderService));
pipe = new UnusedKeyFilterPipe(TestBed.inject(LanguageLoaderService));
}));
it('create an instance', () => {
......
......@@ -3,11 +3,10 @@ import { PLATFORM_ID } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { JWT_OPTIONS, JwtModule } from '@auth0/angular-jwt';
import { TranslateService } from '@ngx-translate/core';
import { RxStompService } from '@stomp/ng2-stompjs';
import { MarkdownService, MarkedOptions } from 'ngx-markdown';
import { TranslateServiceMock } from '../../../_mocks/_services/TranslateServiceMock';
import { jwtOptionsFactory } from '../../lib/jwt.factory';
import { I18nTestingModule } from '../../shared/testing/i18n-testing/i18n-testing.module';
import { QuizDuplicateComponent } from './quiz-duplicate.component';
describe('QuizDuplicateComponent', () => {
......@@ -17,7 +16,7 @@ describe('QuizDuplicateComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule, HttpClientTestingModule, JwtModule.forRoot({
I18nTestingModule, RouterTestingModule, HttpClientTestingModule, JwtModule.forRoot({
jwtOptionsProvider: {
provide: JWT_OPTIONS,
useFactory: jwtOptionsFactory,
......@@ -29,10 +28,7 @@ describe('QuizDuplicateComponent', () => {
MarkdownService, {
provide: MarkedOptions,
useValue: {},
}, RxStompService, {
provide: TranslateService,
useClass: TranslateServiceMock,
},
}, RxStompService,
],
declarations: [QuizDuplicateComponent],
})
......
......@@ -80,7 +80,7 @@ describe('LeaderboardComponent', () => {
beforeEach(async(() => {
fixture = TestBed.createComponent(LeaderboardComponent);
component = fixture.componentInstance;
i18nService = TestBed.get(I18nService);
i18nService = TestBed.inject(I18nService);
i18nService.currentLanguage = Language.DE;
fixture.detectChanges();
}));
......
......@@ -26,7 +26,7 @@ describe('ProgressBarAnonymousComponent', () => {
}));
beforeEach(() => {
const library: FaIconLibrary = TestBed.get(FaIconLibrary);
const library: FaIconLibrary = TestBed.inject(FaIconLibrary);
library.addIcons(faSpinner);
fixture = TestBed.createComponent(ProgressBarAnonymousComponent);
component = fixture.componentInstance;
......
......@@ -29,7 +29,7 @@ describe('ProgressBarFreetextComponent', () => {
}));
beforeEach(async(() => {
const library: FaIconLibrary = TestBed.get(FaIconLibrary);
const library: FaIconLibrary = TestBed.inject(FaIconLibrary);
library.addIcons(faSpinner);
fixture = TestBed.createComponent(ProgressBarFreetextComponent);
component = fixture.componentInstance;
......
......@@ -29,7 +29,7 @@ describe('ProgressBarMultipleChoiceComponent', () => {
}));
beforeEach(async(() => {
const library: FaIconLibrary = TestBed.get(FaIconLibrary);
const library: FaIconLibrary = TestBed.inject(FaIconLibrary);
library.addIcons(faSpinner);
fixture = TestBed.createComponent(ProgressBarMultipleChoiceComponent);
component = fixture.componentInstance;
......
......@@ -29,7 +29,7 @@ describe('ProgressBarRangedComponent', () => {
}));
beforeEach(async(() => {
const library: FaIconLibrary = TestBed.get(FaIconLibrary);
const library: FaIconLibrary = TestBed.inject(FaIconLibrary);
library.addIcons(faSpinner);
fixture = TestBed.createComponent(ProgressBarRangedComponent);
component = fixture.componentInstance;
......
......@@ -29,7 +29,7 @@ describe('ProgressBarSingleChoiceComponent', () => {
}));
beforeEach(async(() => {
const library: FaIconLibrary = TestBed.get(FaIconLibrary);
const library: FaIconLibrary = TestBed.inject(FaIconLibrary);
library.addIcons(faSpinner);
fixture = TestBed.createComponent(ProgressBarSingleChoiceComponent);
component = fixture.componentInstance;
......
......@@ -29,7 +29,7 @@ describe('ProgressBarSurveyComponent', () => {
}));
beforeEach(async(() => {
const library: FaIconLibrary = TestBed.get(FaIconLibrary);
const library: FaIconLibrary = TestBed.inject(FaIconLibrary);
library.addIcons(faSpinner);
fixture = TestBed.createComponent(ProgressBarSurveyComponent);
component = fixture.componentInstance;
......
......@@ -74,7 +74,8 @@ describe('ProgressBarComponent', () => {
ProgressBarSurveyComponent,
ProgressBarRangedComponent,
ProgressBarFreetextComponent,
ProgressBarComponent, ProgressBarAnonymousComponent,
ProgressBarComponent,
ProgressBarAnonymousComponent,
],
}).compileComponents();
}));
......@@ -98,9 +99,9 @@ describe('ProgressBarComponent', () => {
));
it('#attendeeDataForAnswer', async(() => {
const quizService: QuizService = TestBed.get(QuizService);
const attendeeService: AttendeeService = TestBed.get(AttendeeService);
const questionTextService: QuestionTextService = TestBed.get(QuestionTextService);
const quizService: QuizService = TestBed.inject(QuizService);
const attendeeService: AttendeeService = TestBed.inject(AttendeeService);
const questionTextService: QuestionTextService = TestBed.inject(QuestionTextService);
component.questionIndex = 0;
component.hideProgressbarCssStyle = false;
......@@ -126,9 +127,9 @@ describe('ProgressBarComponent', () => {
}));
it('#attendeeDataForAnswer anonymous', async(() => {
const quizService: QuizService = TestBed.get(QuizService);
const attendeeService: AttendeeService = TestBed.get(AttendeeService);
const questionTextService: QuestionTextService = TestBed.get(QuestionTextService);
const quizService: QuizService = TestBed.inject(QuizService);
const attendeeService: AttendeeService = TestBed.inject(AttendeeService);
const questionTextService: QuestionTextService = TestBed.inject(QuestionTextService);
component.questionIndex = 0;
const question = <SingleChoiceQuestionEntity>quizService.quiz.questionList[component.questionIndex];
......@@ -153,9 +154,9 @@ describe('ProgressBarComponent', () => {
}));
it('#attendeeDataForAnswer - RangedQuestion', async(() => {
const quizService: QuizService = TestBed.get(QuizService);
const attendeeService: AttendeeService = TestBed.get(AttendeeService);
const questionTextService: QuestionTextService = TestBed.get(QuestionTextService);
const quizService: QuizService = TestBed.inject(QuizService);
const attendeeService: AttendeeService = TestBed.inject(AttendeeService);
const questionTextService: QuestionTextService = TestBed.inject(QuestionTextService);
component.questionIndex = 2;
component.hideProgressbarCssStyle = false;
......@@ -181,9 +182,9 @@ describe('ProgressBarComponent', () => {
}));
it('#attendeeDataForAnswer - RangedQuestion anonymous', async(() => {
const quizService: QuizService = TestBed.get(QuizService);
const attendeeService: AttendeeService = TestBed.get(AttendeeService);
const questionTextService: QuestionTextService = TestBed.get(QuestionTextService);
const quizService: QuizService = TestBed.inject(QuizService);
const attendeeService: AttendeeService = TestBed.inject(AttendeeService);
const questionTextService: QuestionTextService = TestBed.inject(QuestionTextService);
component.questionIndex = 2;
const question = <RangedQuestionEntity>quizService.quiz.questionList[component.questionIndex];
......@@ -208,9 +209,9 @@ describe('ProgressBarComponent', () => {
}));
it('#attendeeDataForAnswer - FreeTextQuestion', async(() => {
const quizService: QuizService = TestBed.get(QuizService);
const attendeeService: AttendeeService = TestBed.get(AttendeeService);
const questionTextService: QuestionTextService = TestBed.get(QuestionTextService);
const quizService: QuizService = TestBed.inject(QuizService);
const attendeeService: AttendeeService = TestBed.inject(AttendeeService);
const questionTextService: QuestionTextService = TestBed.inject(QuestionTextService);
component.questionIndex = 1;
component.hideProgressbarCssStyle = false;
......@@ -236,9 +237,9 @@ describe('ProgressBarComponent', () => {
}));
it('#attendeeDataForAnswer - FreeTextQuestion anonymous', async(() => {
const quizService: QuizService = TestBed.get(QuizService);
const attendeeService: AttendeeService = TestBed.get(AttendeeService);
const questionTextService: QuestionTextService = TestBed.get(QuestionTextService);
const quizService: QuizService = TestBed.inject(QuizService);
const attendeeService: AttendeeService = TestBed.inject(AttendeeService);
const questionTextService: QuestionTextService = TestBed.inject(QuestionTextService);
component.questionIndex = 1;
const question = <FreeTextQuestionEntity>quizService.quiz.questionList[component.questionIndex];
......
......@@ -150,7 +150,7 @@ export class QuizResultsComponent implements OnInit, OnDestroy, IHasTriggeredNav
const matches = this.attendeeService.attendees.filter(value => {
return value.responses[questionIndex] ? value.responses[questionIndex].confidence > -1 : false;
});
const hasConfidenceSet = typeof this.quizService.quiz.sessionConfig.confidenceSliderEnabled !== 'undefined';
const hasConfidenceSet = this.quizService.quiz.sessionConfig.confidenceSliderEnabled ?? false;
const isConfidenceEnabled = typeof hasConfidenceSet ? this.quizService.quiz.sessionConfig.confidenceSliderEnabled : false;
return hasConfidenceSet ? matches.length > 0 || isConfidenceEnabled : matches.length > 0;
}
......@@ -199,7 +199,7 @@ export class QuizResultsComponent implements OnInit, OnDestroy, IHasTriggeredNav
return value.responses[questionIndex] ? value.responses[questionIndex].readingConfirmation : false;
}).length;
const readingConfirmationStatus = this.quizService.quiz.sessionConfig.readingConfirmationEnabled;
const isReadingConfirmationEnabled = typeof readingConfirmationStatus === 'undefined' ? false : readingConfirmationStatus;
const isReadingConfirmationEnabled = readingConfirmationStatus ?? false;
this.cd.markForCheck();
return matchCount > 0 || isReadingConfirmationEnabled;
}
......@@ -211,7 +211,7 @@ export class QuizResultsComponent implements OnInit, OnDestroy, IHasTriggeredNav
this.quizService.quiz && this.quizService.quiz.sessionConfig.showResponseProgress
) || //
(
currentQuestion && currentQuestion.timer && this.countdown === 0
currentQuestion?.timer && this.countdown === 0
);
}
......
......@@ -7,12 +7,10 @@ import { JWT_OPTIONS, JwtModule } from '@auth0/angular-jwt';
import { FaIconLibrary, FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { faHourglass, faSpinner } from '@fortawesome/free-solid-svg-icons';
import { NgbModalModule } from '@ng-bootstrap/ng-bootstrap';
import { TranslateService } from '@ngx-translate/core';
import { RxStompService } from '@stomp/ng2-stompjs';
import { SimpleMQ } from 'ng2-simple-mq';
import { MarkdownService, MarkedOptions } from 'ngx-markdown';
import { TranslatePipeMock } from '../../../../_mocks/_pipes/TranslatePipeMock';
import { TranslateServiceMock } from '../../../../_mocks/_services/TranslateServiceMock';
import { jwtOptionsFactory } from '../../../lib/jwt.factory';
import { ServerUnavailableModalComponent } from '../../../modals/server-unavailable-modal/server-unavailable-modal.component';
import { MemberApiService } from '../../../service/api/member/member-api.service';
......@@ -28,6 +26,7 @@ import { QuizMockService } from '../../../service/quiz/quiz-mock.service';
import { QuizService } from '../../../service/quiz/quiz.service';
import { StorageService } from '../../../service/storage/storage.service';
import { StorageServiceMock } from '../../../service/storage/storage.service.mock';
import { I18nTestingModule } from '../../../shared/testing/i18n-testing/i18n-testing.module';
import { VotingQuestionComponent } from './voting-question/voting-question.component';
import { VotingComponent } from './voting.component';
......@@ -39,7 +38,7 @@ describe('VotingComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule, FontAwesomeModule, HttpClientTestingModule, NgbModalModule, JwtModule.forRoot({
I18nTestingModule, RouterTestingModule, FontAwesomeModule, HttpClientTestingModule, NgbModalModule, JwtModule.forRoot({
jwtOptionsProvider: {
provide: JWT_OPTIONS,
useFactory: jwtOptionsFactory,
......@@ -51,9 +50,7 @@ describe('VotingComponent', () => {
MarkdownService, {
provide: MarkedOptions,
useValue: {},
},
RxStompService,
{
}, RxStompService, {
provide: StorageService,
useClass: StorageServiceMock,
}, {
......@@ -65,17 +62,14 @@ describe('VotingComponent', () => {
}, FooterBarService, {
provide: ConnectionService,
useClass: ConnectionMockService,
}, MemberApiService, QuizApiService, {
provide: TranslateService,
useClass: TranslateServiceMock,
}, SimpleMQ, QuestionTextService, HeaderLabelService,
}, MemberApiService, QuizApiService, SimpleMQ, QuestionTextService, HeaderLabelService,
],
declarations: [VotingComponent, VotingQuestionComponent, ServerUnavailableModalComponent, TranslatePipeMock],
}).overrideModule(BrowserDynamicTestingModule, { set: { entryComponents: [ServerUnavailableModalComponent] } }).compileComponents();
}));
beforeEach(async(() => {
const library: FaIconLibrary = TestBed.get(FaIconLibrary);
const library: FaIconLibrary = TestBed.inject(FaIconLibrary);
library.addIcons(faHourglass);
library.addIcons(faSpinner);
fixture = TestBed.createComponent(VotingComponent);
......
......@@ -5,14 +5,12 @@ import { RouterTestingModule } from '@angular/router/testing';
import { SwUpdate } from '@angular/service-worker';
import { FontAwesomeModule } from