Skip to content

Commit

Permalink
refactor(Authoring): Convert SelectStepAndComponent to standalone (#1754
Browse files Browse the repository at this point in the history
)
  • Loading branch information
geoffreykwan authored Apr 25, 2024
1 parent b02ad4e commit 51d0a9c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
<mat-form-field>
<mat-label i18n>Component</mat-label>
<mat-select [(ngModel)]="referenceComponent.componentId" (ngModelChange)="componentChanged()">
<mat-option *ngFor="let component of components; index as componentIndex"
[value]="component.id"
[disabled]="!componentToIsAllowed.get(component.id) || component.id === thisComponentId">
<mat-option
*ngFor="let component of components; index as componentIndex"
[value]="component.id"
[disabled]="!componentToIsAllowed.get(component.id) || component.id === thisComponentId"
>
<span>{{ componentIndex + 1 }}. {{ component.type }} </span>
<span *ngIf="component.id === thisComponentId" i18n>(This Component)</span>
</mat-option>
</mat-select>
</mat-form-field>
</mat-form-field>
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { FormsModule } from '@angular/forms';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { MatSelectModule } from '@angular/material/select';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ProjectService } from '../../../assets/wise5/services/projectService';
import { ReferenceComponent } from '../../domain/referenceComponent';
Expand All @@ -27,14 +23,10 @@ describe('SelectStepAndComponentComponent', () => {
await TestBed.configureTestingModule({
imports: [
BrowserAnimationsModule,
FormsModule,
HttpClientTestingModule,
MatFormFieldModule,
MatInputModule,
MatSelectModule,
SelectStepAndComponentComponent,
StudentTeacherCommonServicesModule
],
declarations: [SelectStepAndComponentComponent]
]
}).compileComponents();
fixture = TestBed.createComponent(SelectStepAndComponentComponent);
loader = TestbedHarnessEnvironment.loader(fixture);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { ProjectService } from '../../../assets/wise5/services/projectService';
import { ReferenceComponent } from '../../domain/referenceComponent';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatSelectModule } from '@angular/material/select';
import { FormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';

@Component({
selector: 'select-step-and-component',
templateUrl: './select-step-and-component.component.html',
styleUrls: ['./select-step-and-component.component.scss']
styleUrls: ['./select-step-and-component.component.scss'],
standalone: true,
imports: [CommonModule, FormsModule, MatFormFieldModule, MatSelectModule]
})
export class SelectStepAndComponentComponent implements OnInit {
@Input() allowedComponentTypes: string[] = [];
Expand Down
3 changes: 1 addition & 2 deletions src/app/teacher/component-authoring.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,13 @@ import { EditAiChatAdvancedComponent } from '../../assets/wise5/components/aiCha
PeerChatAuthoringComponent,
ShowGroupWorkAuthoringComponent,
ShowMyWorkAuthoringComponent,
SelectStepAndComponentComponent,
SummaryAuthoring,
TableAuthoring,
WiseLinkAuthoringDialogComponent
],
imports: [
ConstraintAuthoringModule,
SelectStepAndComponentComponent,
StudentTeacherCommonModule,
PeerGroupingAuthoringModule,
WiseTinymceEditorModule
Expand Down Expand Up @@ -246,7 +246,6 @@ import { EditAiChatAdvancedComponent } from '../../assets/wise5/components/aiCha
PeerChatAuthoringComponent,
ShowGroupWorkAuthoringComponent,
ShowMyWorkAuthoringComponent,
SelectStepAndComponentComponent,
SummaryAuthoring,
TableAuthoring
]
Expand Down
2 changes: 1 addition & 1 deletion src/messages.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1688,7 +1688,7 @@ Click &quot;Cancel&quot; to keep the invalid JSON open so you can fix it.</sourc
<source>(This Component)</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/authoring-tool/select-step-and-component/select-step-and-component.component.html</context>
<context context-type="linenumber">16</context>
<context context-type="linenumber">18</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/components/openResponse/edit-open-response-advanced/edit-open-response-advanced.component.html</context>
Expand Down

0 comments on commit 51d0a9c

Please sign in to comment.