Skip to content

Commit

Permalink
refactor(GradingEditComponentMaxScore): Convert to standalone (#1957)
Browse files Browse the repository at this point in the history
  • Loading branch information
hirokiterashima authored Sep 27, 2024
1 parent 9a091b8 commit 5585c29
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/app/teacher/grading-common.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { NavItemProgressComponent } from '../classroom-monitor/nav-item-progress
imports: [
ComponentGradingModule,
EditComponentScoreComponent,
GradingEditComponentMaxScoreComponent,
IntersectionObserverModule,
StatusIconComponent,
StudentTeacherCommonModule,
Expand All @@ -28,7 +29,6 @@ import { NavItemProgressComponent } from '../classroom-monitor/nav-item-progress
declarations: [
EditComponentAnnotationsComponent,
EditComponentCommentComponent,
GradingEditComponentMaxScoreComponent,
NavItemProgressComponent,
WorkgroupComponentGradingComponent,
WorkgroupInfoComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
[componentId]="componentId"
[disabled]="isDisabled || !canAuthorProject"
[nodeId]="nodeId"
></grading-edit-component-max-score>
/>
</div>
<div *ngIf="edit || !showAutoComment()" class="annotations--grading__item">
<edit-component-comment
Expand Down Expand Up @@ -81,7 +81,7 @@
[componentId]="componentId"
[disabled]="true"
[nodeId]="nodeId"
></grading-edit-component-max-score>
/>
</div>
<div *ngIf="latestAnnotations.comment" class="annotations--grading__item">
<edit-component-comment
Expand Down Expand Up @@ -126,7 +126,7 @@
[nodeId]="nodeId"
[componentId]="componentId"
[disabled]="true"
></grading-edit-component-max-score>
/>
</div>
<div
class="annotations--grading__item annotations--grading__auto-comment"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { GradingEditComponentMaxScoreComponent } from './grading-edit-component-max-score.component';
import { TeacherProjectService } from '../../../services/teacherProjectService';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { CopyNodesService } from '../../../services/copyNodesService';
import { StudentTeacherCommonServicesModule } from '../../../../../app/student-teacher-common-services.module';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { Node } from '../../../common/Node';
Expand All @@ -17,15 +14,8 @@ let projectService: TeacherProjectService;
describe('GradingEditComponentMaxScoreComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [GradingEditComponentMaxScoreComponent],
schemas: [NO_ERRORS_SCHEMA],
imports: [StudentTeacherCommonServicesModule],
providers: [
CopyNodesService,
TeacherProjectService,
provideHttpClient(withInterceptorsFromDi()),
provideHttpClientTesting()
]
imports: [GradingEditComponentMaxScoreComponent, StudentTeacherCommonServicesModule],
providers: [TeacherProjectService, provideHttpClient(withInterceptorsFromDi())]
});
projectService = TestBed.inject(TeacherProjectService);
fixture = TestBed.createComponent(GradingEditComponentMaxScoreComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ import { Component, Input, ViewEncapsulation } from '@angular/core';
import { Subject, Subscription } from 'rxjs';
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
import { TeacherProjectService } from '../../../services/teacherProjectService';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';

@Component({
imports: [CommonModule, FormsModule, MatFormFieldModule, MatInputModule],
selector: 'grading-edit-component-max-score',
standalone: true,
styles: [
`
/* TODO(mdc-migration): The following rule targets internal classes of form-field that may no longer apply for the MDC version. */
Expand All @@ -22,7 +28,7 @@ export class GradingEditComponentMaxScoreComponent {
maxScore: number;
maxScoreChanged: Subject<string> = new Subject<string>();
@Input() nodeId: string;
subscriptions: Subscription = new Subscription();
private subscriptions: Subscription = new Subscription();

constructor(private projectService: TeacherProjectService) {}

Expand Down

0 comments on commit 5585c29

Please sign in to comment.