Skip to content

Commit 9001ed8

Browse files
committed
All components are standalone
EcoFabSpeedDialModule stays for convenience of importing all components at once
1 parent 668e188 commit 9001ed8

File tree

3 files changed

+13
-23
lines changed

3 files changed

+13
-23
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import {NgModule} from '@angular/core';
2-
import {CommonModule} from '@angular/common';
32
import {
43
EcoFabSpeedDialActionsComponent,
54
EcoFabSpeedDialComponent,
65
EcoFabSpeedDialTriggerComponent,
76
} from './fab-speed-dial';
87

8+
const components = [EcoFabSpeedDialActionsComponent, EcoFabSpeedDialComponent, EcoFabSpeedDialTriggerComponent];
9+
910
@NgModule({
10-
imports: [CommonModule],
11-
declarations: [EcoFabSpeedDialActionsComponent, EcoFabSpeedDialComponent, EcoFabSpeedDialTriggerComponent],
12-
exports: [EcoFabSpeedDialActionsComponent, EcoFabSpeedDialComponent, EcoFabSpeedDialTriggerComponent],
11+
imports: components,
12+
exports: components,
1313
})
1414
export class EcoFabSpeedDialModule {}

projects/fab-speed-dial/src/lib/fab-speed-dial.spec.ts

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,11 @@
11
import {TestBed} from '@angular/core/testing';
22

3-
import {
4-
Direction,
5-
EcoFabSpeedDialActionsComponent,
6-
EcoFabSpeedDialComponent,
7-
EcoFabSpeedDialTriggerComponent,
8-
} from './fab-speed-dial';
3+
import {Direction, EcoFabSpeedDialActionsComponent, EcoFabSpeedDialComponent} from './fab-speed-dial';
94
import {By} from '@angular/platform-browser';
105
import {Component, ViewChild} from '@angular/core';
6+
import {EcoFabSpeedDialModule} from '@ecodev/fab-speed-dial';
117

128
describe('FabSpeedDial', () => {
13-
beforeEach(() => {
14-
TestBed.configureTestingModule({
15-
imports: [],
16-
declarations: [
17-
EcoFabSpeedDialComponent,
18-
EcoFabSpeedDialTriggerComponent,
19-
EcoFabSpeedDialActionsComponent,
20-
TestAppComponent,
21-
],
22-
});
23-
});
24-
259
it('should apply direction class based on direction', () => {
2610
const fixture = TestBed.createComponent(TestAppComponent);
2711

@@ -151,6 +135,8 @@ describe('FabSpeedDial', () => {
151135
<div class="testElement">Test element</div>
152136
</div>
153137
`,
138+
standalone: true,
139+
imports: [EcoFabSpeedDialModule],
154140
})
155141
class TestAppComponent {
156142
@ViewChild(EcoFabSpeedDialActionsComponent)

projects/fab-speed-dial/src/lib/fab-speed-dial.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
ViewEncapsulation,
1818
} from '@angular/core';
1919
import {MatButton} from '@angular/material/button';
20-
import {DOCUMENT} from '@angular/common';
20+
import {CommonModule, DOCUMENT} from '@angular/common';
2121
import {forkJoin, fromEvent, Subscription} from 'rxjs';
2222
import {take} from 'rxjs/operators';
2323

@@ -29,6 +29,8 @@ export type AnimationMode = 'fling' | 'scale';
2929
@Component({
3030
selector: 'eco-fab-speed-dial-actions',
3131
template: ` <ng-content select="[mat-mini-fab]" *ngIf="miniFabVisible"></ng-content>`,
32+
standalone: true,
33+
imports: [CommonModule],
3234
})
3335
export class EcoFabSpeedDialActionsComponent implements AfterContentInit {
3436
private _parent: EcoFabSpeedDialComponent;
@@ -164,6 +166,7 @@ export class EcoFabSpeedDialActionsComponent implements AfterContentInit {
164166
`,
165167
styleUrls: ['fab-speed-dial.scss'],
166168
encapsulation: ViewEncapsulation.None,
169+
standalone: true,
167170
})
168171
export class EcoFabSpeedDialComponent implements OnDestroy, AfterContentInit {
169172
private isInitialized = false;
@@ -333,6 +336,7 @@ export class EcoFabSpeedDialComponent implements OnDestroy, AfterContentInit {
333336
@Component({
334337
selector: 'eco-fab-speed-dial-trigger',
335338
template: ` <ng-content select="[mat-fab]"></ng-content>`,
339+
standalone: true,
336340
})
337341
export class EcoFabSpeedDialTriggerComponent {
338342
private _parent: EcoFabSpeedDialComponent;

0 commit comments

Comments
 (0)