Skip to content

Commit

Permalink
refactor(CopyComponentButtonComponent): Convert to standalone (#1887)
Browse files Browse the repository at this point in the history
  • Loading branch information
hirokiterashima authored Aug 19, 2024
1 parent ba94664 commit f58d4f8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/app/teacher/authoring-tool.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ import { ComponentTypeButtonComponent } from '../../assets/wise5/authoringTool/c
ChooseSimulationComponent,
ConcurrentAuthorsMessageComponent,
ConfigureAutomatedAssessmentComponent,
CopyComponentButtonComponent,
EditProjectLanguageSettingComponent,
InsertNodeAfterButtonComponent,
InsertNodeInsideButtonComponent,
Expand Down Expand Up @@ -113,6 +112,7 @@ import { ComponentTypeButtonComponent } from '../../assets/wise5/authoringTool/c
ComponentAuthoringModule,
ComponentStudentModule,
ComponentTypeButtonComponent,
CopyComponentButtonComponent,
EditNodeTitleComponent,
MatBadgeModule,
MatChipsModule,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CopyComponentButtonComponent } from './copy-component-button.component';
import { TeacherProjectService } from '../../../services/teacherProjectService';
import { MatIconModule } from '@angular/material/icon';
import { CopyTranslationsService } from '../../../services/copyTranslationsService';
import { ConfigService } from '../../../services/configService';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';

class MockTeacherProjectService {}
describe('CopyComponentButtonComponent', () => {
Expand All @@ -13,11 +12,11 @@ describe('CopyComponentButtonComponent', () => {

beforeEach(() => {
TestBed.configureTestingModule({
declarations: [CopyComponentButtonComponent],
imports: [HttpClientTestingModule, MatIconModule],
imports: [CopyComponentButtonComponent],
providers: [
ConfigService,
CopyTranslationsService,
provideHttpClient(withInterceptorsFromDi()),
{ provide: TeacherProjectService, useClass: MockTeacherProjectService }
]
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@ import { Component, EventEmitter, Input, Output } from '@angular/core';
import { TeacherProjectService } from '../../../services/teacherProjectService';
import { CopyTranslationsService } from '../../../services/copyTranslationsService';
import { Node } from '../../../common/Node';
import { MatIconModule } from '@angular/material/icon';
import { MatButtonModule } from '@angular/material/button';
import { MatTooltipModule } from '@angular/material/tooltip';

@Component({
imports: [MatButtonModule, MatIconModule, MatTooltipModule],
selector: 'copy-component-button',
standalone: true,
templateUrl: './copy-component-button.component.html'
})
export class CopyComponentButtonComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ <h5 i18n>Components</h5>
[node]="node"
[componentId]="component.id"
(newComponentEvent)="highlightAndExpandComponents($event)"
></copy-component-button>
/>
<button
mat-icon-button
color="primary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@ let saveProjectSpy: jasmine.Spy;
describe('NodeAuthoringComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [CopyComponentButtonComponent, NodeAuthoringComponent],
declarations: [NodeAuthoringComponent],
imports: [
AddComponentButtonComponent,
BrowserAnimationsModule,
ComponentAuthoringModule,
ComponentTypeServiceModule,
CopyComponentButtonComponent,
DragDropModule,
EditNodeTitleComponent,
FormsModule,
Expand Down

0 comments on commit f58d4f8

Please sign in to comment.