Skip to content

Commit c80a130

Browse files
refactor(Teacher Tools): Convert all components to standalone (#2237)
1 parent 4c16f96 commit c80a130

File tree

159 files changed

+974
-1210
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+974
-1210
lines changed

package-lock.json

Lines changed: 59 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/classroom-monitor/milestones/milestones.component.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,20 @@ import { MilestoneService } from '../../../assets/wise5/services/milestoneServic
88
import { TeacherDataService } from '../../../assets/wise5/services/teacherDataService';
99
import { Milestone } from '../../domain/milestone';
1010
import { Annotation } from '../../../assets/wise5/common/Annotation';
11+
import { MatCard, MatCardContent } from '@angular/material/card';
12+
import { MatProgressSpinner } from '@angular/material/progress-spinner';
13+
import { NgClass } from '@angular/common';
14+
import { MatIcon } from '@angular/material/icon';
1115

1216
@Component({
13-
selector: 'milestones',
14-
styleUrls: ['milestones.component.scss'],
15-
templateUrl: 'milestones.component.html',
16-
standalone: false
17+
imports: [MatCard, MatCardContent, MatProgressSpinner, NgClass, MatIcon],
18+
selector: 'milestones',
19+
styleUrl: 'milestones.component.scss',
20+
templateUrl: 'milestones.component.html'
1721
})
1822
export class MilestonesComponent {
19-
milestones: Milestone[];
20-
subscriptions: Subscription = new Subscription();
23+
protected milestones: Milestone[];
24+
private subscriptions: Subscription = new Subscription();
2125

2226
constructor(
2327
private achievementService: AchievementService,

src/app/classroom-monitor/workgroup-node-status/workgroup-node-status.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { Component, Input } from '@angular/core';
22

33
@Component({
44
selector: 'workgroup-node-status',
5-
standalone: true,
65
template: `<span class="md-body-2 block center {{ statusClass }}">{{ statusText }}</span>`
76
})
87
export class WorkgroupNodeStatusComponent {

src/app/classroom-monitor/workgroup-select/workgroup-select-autocomplete/workgroup-select-autocomplete.component.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ import { filter, map, startWith } from 'rxjs/operators';
1010
import { copy } from '../../../../assets/wise5/common/object/object';
1111

1212
@Component({
13-
encapsulation: ViewEncapsulation.None,
14-
imports: [
15-
CommonModule,
16-
MatAutocompleteModule,
17-
MatFormFieldModule,
18-
MatInputModule,
19-
ReactiveFormsModule
20-
],
21-
selector: 'workgroup-select-autocomplete',
22-
styleUrl: 'workgroup-select-autocomplete.component.scss',
23-
templateUrl: 'workgroup-select-autocomplete.component.html'
13+
encapsulation: ViewEncapsulation.None,
14+
imports: [
15+
CommonModule,
16+
MatAutocompleteModule,
17+
MatFormFieldModule,
18+
MatInputModule,
19+
ReactiveFormsModule
20+
],
21+
selector: 'workgroup-select-autocomplete',
22+
styleUrl: 'workgroup-select-autocomplete.component.scss',
23+
templateUrl: 'workgroup-select-autocomplete.component.html'
2424
})
2525
export class WorkgroupSelectAutocompleteComponent extends WorkgroupSelectComponent {
2626
protected filteredWorkgroups: Observable<any>;

src/app/classroom-monitor/workgroup-select/workgroup-select.component.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ import { Subscription } from 'rxjs';
33
import { ConfigService } from '../../../assets/wise5/services/configService';
44
import { TeacherDataService } from '../../../assets/wise5/services/teacherDataService';
55

6-
@Directive({
7-
selector: 'workgroup-select',
8-
standalone: false
9-
})
6+
@Directive()
107
export class WorkgroupSelectComponent {
118
@Input() customClass: string;
129
protected canViewStudentNames: boolean;

src/app/modules/google-sign-in/google-sign-in-button/google-sign-in-button.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import { GoogleUser } from '../GoogleUser';
1717
@Component({
1818
encapsulation: ViewEncapsulation.None,
1919
selector: 'google-sign-in-button',
20-
standalone: true,
2120
styleUrl: 'google-sign-in-button.component.scss',
2221
template: '<div #googleButton class="googleButton center"></div>'
2322
})
@@ -26,7 +25,10 @@ export class GoogleSignInButtonComponent implements AfterViewInit {
2625
@Output() signedIn = new EventEmitter<GoogleUser>();
2726
@Input() text: string = 'signin_with';
2827

29-
constructor(private configService: ConfigService, private ngZone: NgZone) {}
28+
constructor(
29+
private configService: ConfigService,
30+
private ngZone: NgZone
31+
) {}
3032

3133
ngAfterViewInit(): void {
3234
google.accounts.id.initialize({

src/app/privacy/privacy.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { Component } from '@angular/core';
22

33
@Component({
44
selector: 'app-privacy',
5-
standalone: true,
65
styleUrl: './privacy.component.scss',
76
templateUrl: './privacy.component.html'
87
})

src/app/teacher/account/edit-profile/edit-profile.component.spec.ts

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,10 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
22
import { TeacherEditProfileComponent } from './edit-profile.component';
33
import { UserService } from '../../../services/user.service';
44
import { Teacher } from '../../../domain/teacher';
5-
import { Observable, of, BehaviorSubject } from 'rxjs';
6-
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
7-
import { ReactiveFormsModule } from '@angular/forms';
8-
import { MatInputModule } from '@angular/material/input';
9-
import { MatSelectModule } from '@angular/material/select';
10-
import { MatSnackBarModule } from '@angular/material/snack-bar';
5+
import { Observable, BehaviorSubject } from 'rxjs';
116
import { TeacherService } from '../../teacher.service';
12-
import { NO_ERRORS_SCHEMA } from '@angular/core';
137
import { By } from '@angular/platform-browser';
148
import { User } from '../../../domain/user';
15-
import { MatDialogModule } from '@angular/material/dialog';
169

1710
export class MockUserService {
1811
user: User;
@@ -86,20 +79,11 @@ describe('TeacherEditProfileComponent', () => {
8679

8780
beforeEach(() => {
8881
TestBed.configureTestingModule({
89-
declarations: [TeacherEditProfileComponent],
90-
imports: [
91-
BrowserAnimationsModule,
92-
ReactiveFormsModule,
93-
MatDialogModule,
94-
MatInputModule,
95-
MatSelectModule,
96-
MatSnackBarModule
97-
],
82+
imports: [TeacherEditProfileComponent],
9883
providers: [
9984
{ provide: TeacherService, useClass: MockTeacherService },
10085
{ provide: UserService, useClass: MockUserService }
101-
],
102-
schemas: [NO_ERRORS_SCHEMA]
86+
]
10387
});
10488
fixture = TestBed.createComponent(TeacherEditProfileComponent);
10589
component = fixture.componentInstance;

src/app/teacher/account/edit-profile/edit-profile.component.ts

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import { Component } from '@angular/core';
2-
import { FormControl, FormGroup, Validators, FormBuilder } from '@angular/forms';
2+
import {
3+
FormControl,
4+
FormGroup,
5+
Validators,
6+
FormBuilder,
7+
FormsModule,
8+
ReactiveFormsModule
9+
} from '@angular/forms';
310
import { finalize } from 'rxjs/operators';
411
import { MatSnackBar } from '@angular/material/snack-bar';
512
import { UserService } from '../../../services/user.service';
@@ -9,10 +16,28 @@ import { MatDialog } from '@angular/material/dialog';
916
import { Subscription } from 'rxjs';
1017
import { SchoolLevel, schoolLevels } from '../../../domain/profile.constants';
1118
import { EditProfileComponent } from '../../../common/edit-profile/edit-profile.component';
19+
import { MatFormField, MatLabel, MatError, MatHint } from '@angular/material/form-field';
20+
import { MatInput } from '@angular/material/input';
21+
import { MatSelect } from '@angular/material/select';
22+
import { MatOption } from '@angular/material/autocomplete';
23+
import { MatButton } from '@angular/material/button';
24+
import { MatProgressBar } from '@angular/material/progress-bar';
1225

1326
@Component({
27+
imports: [
28+
FormsModule,
29+
ReactiveFormsModule,
30+
MatFormField,
31+
MatLabel,
32+
MatInput,
33+
MatError,
34+
MatHint,
35+
MatSelect,
36+
MatOption,
37+
MatButton,
38+
MatProgressBar
39+
],
1440
selector: 'teacher-edit-profile',
15-
standalone: false,
1641
styleUrls: [
1742
'../../../common/edit-profile/edit-profile.component.scss',
1843
'./edit-profile.component.scss'

src/app/teacher/account/edit/edit.component.spec.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
22
import { EditComponent } from './edit.component';
3-
import { NO_ERRORS_SCHEMA } from '@angular/core';
3+
import { MockComponents, MockProvider } from 'ng-mocks';
4+
import { TeacherEditProfileComponent } from '../edit-profile/edit-profile.component';
5+
import { UserService } from '../../../services/user.service';
6+
import { BehaviorSubject } from 'rxjs';
7+
import { User } from '../../../domain/user';
48

59
describe('EditComponent', () => {
610
let component: EditComponent;
711
let fixture: ComponentFixture<EditComponent>;
812

913
beforeEach(waitForAsync(() => {
1014
TestBed.configureTestingModule({
11-
declarations: [EditComponent],
12-
providers: [],
13-
schemas: [NO_ERRORS_SCHEMA]
15+
imports: [EditComponent, MockComponents(TeacherEditProfileComponent)],
16+
providers: [
17+
MockProvider(UserService, {
18+
getUser: () => new BehaviorSubject<User>(null)
19+
})
20+
]
1421
}).compileComponents();
1522
}));
1623

0 commit comments

Comments
 (0)