Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(ShowNodeInfoDialog): Convert to standalone component #2006

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MatDialogModule, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { ClassroomMonitorTestingModule } from '../../../assets/wise5/classroomMonitor/classroom-monitor-testing.module';
import { NodeInfoComponent } from '../../../assets/wise5/classroomMonitor/classroomMonitorComponents/shared/node-info/node-info.component';
import { NotebookService } from '../../../assets/wise5/services/notebookService';
import { ProjectService } from '../../../assets/wise5/services/projectService';
import { TeacherDataService } from '../../../assets/wise5/services/teacherDataService';
Expand All @@ -17,7 +16,6 @@ const nodeId1: string = 'node1';
const prompt: string = 'This is the prompt.';
const stepRubric: string = 'This is the step rubric.';
const stepTitle: string = 'This is the title';

const node: any = {
components: [
{
Expand All @@ -35,12 +33,10 @@ const node: any = {
describe('ShowNodeInfoDialogComponents', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ShowNodeInfoDialogComponent],
imports: [
ClassroomMonitorTestingModule,
ComponentTypeServiceModule,
MatDialogModule,
NodeInfoComponent
ShowNodeInfoDialogComponent
],
providers: [
{ provide: MAT_DIALOG_DATA, useValue: nodeId1 },
Expand All @@ -63,7 +59,7 @@ describe('ShowNodeInfoDialogComponents', () => {
});

it('should render the step content in the dialog', () => {
expect(fixture.debugElement.nativeElement.innerHTML).toContain(component.stepNumberAndTitle);
expect(fixture.debugElement.nativeElement.innerHTML).toContain(stepTitle);
expect(fixture.debugElement.nativeElement.innerHTML).toContain(prompt);
expect(fixture.debugElement.nativeElement.innerHTML).toContain(stepRubric);
expect(fixture.debugElement.nativeElement.innerHTML).toContain(componentRubric);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import { Component, ElementRef, Inject, OnInit, ViewChild } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { MatDialogRef, MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
import { MatButtonModule } from '@angular/material/button';
import { ProjectService } from '../../../assets/wise5/services/projectService';
import { NodeInfoComponent } from '../../../assets/wise5/classroomMonitor/classroomMonitorComponents/shared/node-info/node-info.component';

@Component({
imports: [MatButtonModule, MatDialogModule, NodeInfoComponent],
selector: 'show-node-info-dialog',
templateUrl: './show-node-info-dialog.component.html',
styleUrls: ['./show-node-info-dialog.component.scss']
styleUrl: './show-node-info-dialog.component.scss',
standalone: true
})
export class ShowNodeInfoDialogComponent implements OnInit {
@ViewChild('nodeInfoDiv') nodeInfoDiv: ElementRef;
stepNumberAndTitle: string;
protected stepNumberAndTitle: string;

constructor(
public dialogRef: MatDialogRef<ShowNodeInfoDialogComponent>,
Expand Down
4 changes: 1 addition & 3 deletions src/app/teacher/classroom-monitor.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { PeerGroupGradingModule } from './peer-group-grading.module';
import { TeacherSummaryDisplayComponent } from '../../assets/wise5/directives/teacher-summary-display/teacher-summary-display.component';
import { HighchartsChartModule } from 'highcharts-angular';
import { StudentTeacherCommonModule } from '../student-teacher-common.module';
import { NodeInfoComponent } from '../../assets/wise5/classroomMonitor/classroomMonitorComponents/shared/node-info/node-info.component';
import { ComponentStudentModule } from '../../assets/wise5/components/component/component-student.module';
import { NotebookWorkgroupGradingComponent } from '../../assets/wise5/classroomMonitor/classroomMonitorComponents/notebook/notebook-workgroup-grading/notebook-workgroup-grading.component';
import { ProjectProgressComponent } from '../../assets/wise5/classroomMonitor/classroomMonitorComponents/studentProgress/project-progress/project-progress.component';
Expand Down Expand Up @@ -49,7 +48,6 @@ import { SelectPeriodComponent } from '../../assets/wise5/classroomMonitor/class
NotebookWorkgroupGradingComponent,
NotificationsMenuComponent,
PauseScreensMenuComponent,
ShowNodeInfoDialogComponent,
StepItemComponent,
StudentGradingComponent,
StudentGradingToolsComponent,
Expand All @@ -69,13 +67,13 @@ import { SelectPeriodComponent } from '../../assets/wise5/classroomMonitor/class
ManageStudentsModule,
MilestoneModule,
NavItemScoreComponent,
NodeInfoComponent,
PeerGroupGradingModule,
PreviewComponentComponent,
ProjectProgressComponent,
RouterModule,
SaveIndicatorComponent,
SelectPeriodComponent,
ShowNodeInfoDialogComponent,
StepInfoComponent,
StepToolsComponent,
StudentTeacherCommonModule,
Expand Down
Loading