Skip to content

Commit

Permalink
refactor(PossibleScoresComponent): Convert to standalone (#1783)
Browse files Browse the repository at this point in the history
  • Loading branch information
hirokiterashima authored May 7, 2024
1 parent 38cd4d4 commit ec5e89d
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 30 deletions.
15 changes: 7 additions & 8 deletions src/app/possible-score/possible-score.component.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
import { Component, Input } from '@angular/core';
import { ProjectService } from '../../assets/wise5/services/projectService';
import { CommonModule } from '@angular/common';

@Component({
imports: [CommonModule],
selector: 'possible-score',
standalone: true,
templateUrl: 'possible-score.component.html'
})
export class PossibleScoreComponent {
@Input()
maxScore: any;

themeSettings: any;
hidePossibleScores: any;
protected hidePossibleScores: boolean;
@Input() maxScore: number;

constructor(private projectService: ProjectService) {}

ngOnInit() {
this.themeSettings = this.projectService.getThemeSettings();
this.hidePossibleScores = this.themeSettings.hidePossibleScores;
ngOnInit(): void {
this.hidePossibleScores = this.projectService.getThemeSettings().hidePossibleScores;
}
}
4 changes: 1 addition & 3 deletions src/app/student/student.component.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,15 @@ import { StudentTeacherCommonModule } from '../student-teacher-common.module';
ComponentHeader,
ComponentSaveSubmitButtons,
DynamicPromptComponent,
PossibleScoreComponent,
PromptComponent
],
imports: [StudentTeacherCommonModule, ComponentStateInfoModule],
imports: [ComponentStateInfoModule, PossibleScoreComponent, StudentTeacherCommonModule],
exports: [
AddToNotebookButton,
ComponentAnnotationsComponent,
ComponentHeader,
ComponentSaveSubmitButtons,
DynamicPromptComponent,
PossibleScoreComponent,
PromptComponent
]
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,22 @@ import { ComponentHeader } from '../../../directives/component-header/component-
import { AiChatModule } from '../ai-chat.module';
import { MatFormFieldModule } from '@angular/material/form-field';
import { PromptComponent } from '../../../directives/prompt/prompt.component';
import { PossibleScoreComponent } from '../../../../../app/possible-score/possible-score.component';
import { AiChatComponent } from '../AiChatComponent';
import { FormsModule } from '@angular/forms';
import { MatInputModule } from '@angular/material/input';
import { ProjectService } from '../../../services/projectService';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { ChatInputComponent } from '../../../common/chat-input/chat-input.component';
import { PossibleScoreComponent } from '../../../../../app/possible-score/possible-score.component';

describe('AiChatStudentComponent', () => {
let component: AiChatStudentComponent;
let fixture: ComponentFixture<AiChatStudentComponent>;

beforeEach(() => {
TestBed.configureTestingModule({
declarations: [
AiChatStudentComponent,
ComponentHeader,
PossibleScoreComponent,
PromptComponent
],
declarations: [AiChatStudentComponent, ComponentHeader, PromptComponent],
imports: [
AiChatModule,
BrowserAnimationsModule,
Expand All @@ -41,6 +36,7 @@ describe('AiChatStudentComponent', () => {
MatFormFieldModule,
MatInputModule,
MatSnackBarModule,
PossibleScoreComponent,
StudentTeacherCommonServicesModule
],
providers: [AiChatService]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ describe('AudioOscillatorStudent', () => {
MatInputModule,
MatSelectModule,
MatTooltipModule,
PossibleScoreComponent,
ReactiveFormsModule,
StudentTeacherCommonServicesModule
],
declarations: [AudioOscillatorStudent, ComponentHeader, PossibleScoreComponent],
declarations: [AudioOscillatorStudent, ComponentHeader],
schemas: [NO_ERRORS_SCHEMA]
});
fixture = TestBed.createComponent(AudioOscillatorStudent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { MatFormFieldModule } from '@angular/material/form-field';
import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { PossibleScoreComponent } from '../../../../../app/possible-score/possible-score.component';
import { StudentTeacherCommonServicesModule } from '../../../../../app/student-teacher-common-services.module';
import { ComputerAvatar } from '../../../common/computer-avatar/ComputerAvatar';
import { ComponentHeader } from '../../../directives/component-header/component-header.component';
Expand All @@ -27,6 +26,7 @@ import { DialogGuidanceComponent } from '../DialogGuidanceComponent';
import { RawCRaterResponse } from '../../common/cRater/RawCRaterResponse';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { ChatInputComponent } from '../../../common/chat-input/chat-input.component';
import { PossibleScoreComponent } from '../../../../../app/possible-score/possible-score.component';

let component: DialogGuidanceStudentComponent;
let fixture: ComponentFixture<DialogGuidanceStudentComponent>;
Expand All @@ -50,12 +50,7 @@ function createDialogGuidanceComponent(isComputerAvatarEnabled: boolean): Dialog
describe('DialogGuidanceStudentComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [
ComponentHeader,
DialogGuidanceStudentComponent,
DialogResponsesComponent,
PossibleScoreComponent
],
declarations: [ComponentHeader, DialogGuidanceStudentComponent, DialogResponsesComponent],
imports: [
BrowserAnimationsModule,
ChatInputComponent,
Expand All @@ -66,6 +61,7 @@ describe('DialogGuidanceStudentComponent', () => {
MatFormFieldModule,
MatIconModule,
MatInputModule,
PossibleScoreComponent,
StudentTeacherCommonServicesModule
],
providers: [DialogGuidanceFeedbackService],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,11 @@ describe('MultipleChoiceStudentComponent', () => {
MatCheckboxModule,
MatDialogModule,
MatRadioModule,
PossibleScoreComponent,
ReactiveFormsModule,
StudentTeacherCommonServicesModule
],
declarations: [ComponentHeader, MultipleChoiceStudent, PossibleScoreComponent],
declarations: [ComponentHeader, MultipleChoiceStudent],
schemas: [NO_ERRORS_SCHEMA]
});
fixture = TestBed.createComponent(MultipleChoiceStudent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ describe('OpenResponseStudent', () => {
HttpClientTestingModule,
MatDialogModule,
MatIconModule,
PossibleScoreComponent,
ReactiveFormsModule,
StudentTeacherCommonServicesModule
],
declarations: [
ComponentHeader,
ComponentSaveSubmitButtons,
DialogWithoutCloseComponent,
OpenResponseStudent,
PossibleScoreComponent
OpenResponseStudent
],
providers: [AudioRecorderService],
schemas: [NO_ERRORS_SCHEMA]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,13 @@ describe('PeerChatStudentComponent', () => {
MatIconModule,
MatInputModule,
PeerChatModule,
PossibleScoreComponent,
StudentTeacherCommonServicesModule
],
declarations: [
ComponentHeader,
DynamicPromptComponent,
PeerChatStudentComponent,
PossibleScoreComponent,
PromptComponent
],
providers: [
Expand Down

0 comments on commit ec5e89d

Please sign in to comment.