diff --git a/src/assets/wise5/components/Components.ts b/src/assets/wise5/components/Components.ts
index 741773b5d79..173a84299fd 100644
--- a/src/assets/wise5/components/Components.ts
+++ b/src/assets/wise5/components/Components.ts
@@ -35,7 +35,7 @@ import { MatchGradingComponent } from './match/match-grading/match-grading.compo
import { MatchStudent } from './match/match-student/match-student.component';
import { MultipleChoiceAuthoring } from './multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component';
import { MultipleChoiceGradingComponent } from './multipleChoice/multiple-choice-grading/multiple-choice-grading.component';
-import { MultipleChoiceStudent } from './multipleChoice/multiple-choice-student/multiple-choice-student.component';
+import { MultipleChoiceStudentComponent } from './multipleChoice/multiple-choice-student/multiple-choice-student.component';
import { OpenResponseAuthoringComponent } from './openResponse/open-response-authoring/open-response-authoring.component';
import { OpenResponseGradingComponent } from './openResponse/open-response-grading/open-response-grading.component';
import { OpenResponseStudent } from './openResponse/open-response-student/open-response-student.component';
@@ -100,7 +100,7 @@ export const components = {
MultipleChoice: {
authoring: MultipleChoiceAuthoring,
grading: MultipleChoiceGradingComponent,
- student: MultipleChoiceStudent
+ student: MultipleChoiceStudentComponent
},
OpenResponse: {
authoring: OpenResponseAuthoringComponent,
diff --git a/src/assets/wise5/components/component/component-student.module.ts b/src/assets/wise5/components/component/component-student.module.ts
index 62dab50a9e4..b0ab762f821 100644
--- a/src/assets/wise5/components/component/component-student.module.ts
+++ b/src/assets/wise5/components/component/component-student.module.ts
@@ -15,7 +15,6 @@ import { GraphStudentModule } from '../graph/graph-student/graph-student.module'
import { HtmlStudentComponent } from '../html/html-student/html-student.component';
import { LabelStudentModule } from '../label/label-student/label-student.module';
import { MatchStudentModule } from '../match/match-student/match-student.module';
-import { MultipleChoiceStudentModule } from '../multipleChoice/multiple-choice-student/multiple-choice-student.module';
import { OpenResponseStudentModule } from '../openResponse/open-response-student/open-response-student.module';
import { OutsideUrlStudentModule } from '../outsideURL/outside-url-student/outside-url-student.module';
import { PeerChatStudentModule } from '../peerChat/peer-chat-student/peer-chat-student.module';
@@ -26,6 +25,7 @@ import { TableStudentModule } from '../table/table-student/table-student.module'
import { ComponentComponent } from './component.component';
import { AiChatStudentModule } from '../aiChat/ai-chat-student/ai-chat-student.module';
import { HelpIconComponent } from '../../themes/default/themeComponents/helpIcon/help-icon.component';
+import { MultipleChoiceStudentComponent } from '../multipleChoice/multiple-choice-student/multiple-choice-student.component';
@NgModule({
imports: [
@@ -45,7 +45,7 @@ import { HelpIconComponent } from '../../themes/default/themeComponents/helpIcon
HtmlStudentComponent,
LabelStudentModule,
MatchStudentModule,
- MultipleChoiceStudentModule,
+ MultipleChoiceStudentComponent,
OpenResponseStudentModule,
OutsideUrlStudentModule,
PeerChatStudentModule,
diff --git a/src/assets/wise5/components/multipleChoice/MultipleChoiceComponent.ts b/src/assets/wise5/components/multipleChoice/MultipleChoiceComponent.ts
index 299c07cf324..4aefd4d42e9 100644
--- a/src/assets/wise5/components/multipleChoice/MultipleChoiceComponent.ts
+++ b/src/assets/wise5/components/multipleChoice/MultipleChoiceComponent.ts
@@ -16,7 +16,7 @@ export class MultipleChoiceComponent extends Component {
return this.content.choices;
}
- getChoiceType(): string {
+ getChoiceType(): 'radio' | 'checkbox' {
return this.content.choiceType;
}
diff --git a/src/assets/wise5/components/multipleChoice/multiple-choice-student/multiple-choice-student.component.spec.ts b/src/assets/wise5/components/multipleChoice/multiple-choice-student/multiple-choice-student.component.spec.ts
index 6139bd87d87..6bdfc50c527 100644
--- a/src/assets/wise5/components/multipleChoice/multiple-choice-student/multiple-choice-student.component.spec.ts
+++ b/src/assets/wise5/components/multipleChoice/multiple-choice-student/multiple-choice-student.component.spec.ts
@@ -1,11 +1,10 @@
-import { provideHttpClientTesting } from '@angular/common/http/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { StudentTeacherCommonServicesModule } from '../../../../../app/student-teacher-common-services.module';
import { copy } from '../../../common/object/object';
import { ProjectService } from '../../../services/projectService';
import { MultipleChoiceComponent } from '../MultipleChoiceComponent';
-import { MultipleChoiceStudent } from './multiple-choice-student.component';
+import { MultipleChoiceStudentComponent } from './multiple-choice-student.component';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
const choiceId1 = 'choice1';
@@ -14,12 +13,12 @@ const choiceId3 = 'choice3';
const choiceText1 = 'A';
const choiceText2 = 'B';
const choiceText3 = 'C
';
-let component: MultipleChoiceStudent;
+let component: MultipleChoiceStudentComponent;
const componentId = 'component1';
const feedback1 = 'A Feedback';
const feedback2 = 'B Feedback';
const feedback3 = 'C Feedback';
-let fixture: ComponentFixture;
+let fixture: ComponentFixture;
const multipleChoiceType = 'MultipleChoice';
const nodeId = 'node1';
let originalComponentContent: any;
@@ -102,10 +101,14 @@ function createComponent(choiceType: string, choices: any[]): any {
describe('MultipleChoiceStudentComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
- imports: [BrowserAnimationsModule, MultipleChoiceStudent, StudentTeacherCommonServicesModule],
- providers: [provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
+ imports: [
+ BrowserAnimationsModule,
+ MultipleChoiceStudentComponent,
+ StudentTeacherCommonServicesModule
+ ],
+ providers: [provideHttpClient(withInterceptorsFromDi())]
});
- fixture = TestBed.createComponent(MultipleChoiceStudent);
+ fixture = TestBed.createComponent(MultipleChoiceStudentComponent);
spyOn(TestBed.inject(ProjectService), 'getThemeSettings').and.returnValue({});
component = fixture.componentInstance;
originalComponentContent = {
diff --git a/src/assets/wise5/components/multipleChoice/multiple-choice-student/multiple-choice-student.component.ts b/src/assets/wise5/components/multipleChoice/multiple-choice-student/multiple-choice-student.component.ts
index 9022b89875d..edcb6f304fb 100644
--- a/src/assets/wise5/components/multipleChoice/multiple-choice-student/multiple-choice-student.component.ts
+++ b/src/assets/wise5/components/multipleChoice/multiple-choice-student/multiple-choice-student.component.ts
@@ -34,27 +34,27 @@ import { MultipleChoiceCheckboxStudentComponent } from '../multiple-choice-check
styleUrl: 'multiple-choice-student.component.scss',
templateUrl: 'multiple-choice-student.component.html'
})
-export class MultipleChoiceStudent extends ComponentStudent {
+export class MultipleChoiceStudentComponent extends ComponentStudent {
choices: any[];
- choiceType: string;
+ protected choiceType: 'radio' | 'checkbox';
component: MultipleChoiceComponent;
- componentHasCorrectAnswer: boolean;
+ protected componentHasCorrectAnswer: boolean;
isCorrect: boolean;
- isLatestComponentStateSubmit: boolean;
- originalComponentContent: MultipleChoiceContent;
- showFeedback: boolean;
+ protected isLatestComponentStateSubmit: boolean;
+ private originalComponentContent: MultipleChoiceContent;
+ protected showFeedback: boolean;
studentChoices: string | string[];
constructor(
protected annotationService: AnnotationService,
protected componentService: ComponentService,
protected configService: ConfigService,
+ protected dataService: StudentDataService,
protected dialog: MatDialog,
private multipleChoiceService: MultipleChoiceService,
protected nodeService: NodeService,
protected notebookService: NotebookService,
- protected studentAssetService: StudentAssetService,
- protected studentDataService: StudentDataService
+ protected studentAssetService: StudentAssetService
) {
super(
annotationService,
@@ -64,7 +64,7 @@ export class MultipleChoiceStudent extends ComponentStudent {
nodeService,
notebookService,
studentAssetService,
- studentDataService
+ dataService
);
}
@@ -106,7 +106,7 @@ export class MultipleChoiceStudent extends ComponentStudent {
handleConnectedComponents(): void {
for (const connectedComponent of this.componentContent.connectedComponents) {
- const componentState = this.studentDataService.getLatestComponentStateByNodeIdAndComponentId(
+ const componentState = this.dataService.getLatestComponentStateByNodeIdAndComponentId(
connectedComponent.nodeId,
connectedComponent.componentId
);
@@ -228,7 +228,7 @@ export class MultipleChoiceStudent extends ComponentStudent {
}
if (submitTriggeredBy == null || submitTriggeredBy === 'componentSubmitButton') {
- this.studentDataService.broadcastComponentSubmitTriggered({
+ this.dataService.broadcastComponentSubmitTriggered({
nodeId: this.component.nodeId,
componentId: this.component.id
});
diff --git a/src/assets/wise5/components/multipleChoice/multiple-choice-student/multiple-choice-student.module.ts b/src/assets/wise5/components/multipleChoice/multiple-choice-student/multiple-choice-student.module.ts
deleted file mode 100644
index d9a9e758136..00000000000
--- a/src/assets/wise5/components/multipleChoice/multiple-choice-student/multiple-choice-student.module.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { NgModule } from '@angular/core';
-import { StudentTeacherCommonModule } from '../../../../../app/student-teacher-common.module';
-import { StudentComponentModule } from '../../../../../app/student/student.component.module';
-import { MultipleChoiceStudent } from './multiple-choice-student.component';
-
-@NgModule({
- imports: [MultipleChoiceStudent, StudentTeacherCommonModule, StudentComponentModule],
- exports: [MultipleChoiceStudent]
-})
-export class MultipleChoiceStudentModule {}