Skip to content

Commit

Permalink
All components are standalone
Browse files Browse the repository at this point in the history
EcoFabSpeedDialModule stays for convenience of importing all components at once
  • Loading branch information
PowerKiKi committed Aug 5, 2022
1 parent 668e188 commit 9001ed8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 23 deletions.
8 changes: 4 additions & 4 deletions projects/fab-speed-dial/src/lib/fab-speed-dial.module.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {
EcoFabSpeedDialActionsComponent,
EcoFabSpeedDialComponent,
EcoFabSpeedDialTriggerComponent,
} from './fab-speed-dial';

const components = [EcoFabSpeedDialActionsComponent, EcoFabSpeedDialComponent, EcoFabSpeedDialTriggerComponent];

@NgModule({
imports: [CommonModule],
declarations: [EcoFabSpeedDialActionsComponent, EcoFabSpeedDialComponent, EcoFabSpeedDialTriggerComponent],
exports: [EcoFabSpeedDialActionsComponent, EcoFabSpeedDialComponent, EcoFabSpeedDialTriggerComponent],
imports: components,
exports: components,
})
export class EcoFabSpeedDialModule {}
22 changes: 4 additions & 18 deletions projects/fab-speed-dial/src/lib/fab-speed-dial.spec.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@
import {TestBed} from '@angular/core/testing';

import {
Direction,
EcoFabSpeedDialActionsComponent,
EcoFabSpeedDialComponent,
EcoFabSpeedDialTriggerComponent,
} from './fab-speed-dial';
import {Direction, EcoFabSpeedDialActionsComponent, EcoFabSpeedDialComponent} from './fab-speed-dial';
import {By} from '@angular/platform-browser';
import {Component, ViewChild} from '@angular/core';
import {EcoFabSpeedDialModule} from '@ecodev/fab-speed-dial';

describe('FabSpeedDial', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [],
declarations: [
EcoFabSpeedDialComponent,
EcoFabSpeedDialTriggerComponent,
EcoFabSpeedDialActionsComponent,
TestAppComponent,
],
});
});

it('should apply direction class based on direction', () => {
const fixture = TestBed.createComponent(TestAppComponent);

Expand Down Expand Up @@ -151,6 +135,8 @@ describe('FabSpeedDial', () => {
<div class="testElement">Test element</div>
</div>
`,
standalone: true,
imports: [EcoFabSpeedDialModule],
})
class TestAppComponent {
@ViewChild(EcoFabSpeedDialActionsComponent)
Expand Down
6 changes: 5 additions & 1 deletion projects/fab-speed-dial/src/lib/fab-speed-dial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
ViewEncapsulation,
} from '@angular/core';
import {MatButton} from '@angular/material/button';
import {DOCUMENT} from '@angular/common';
import {CommonModule, DOCUMENT} from '@angular/common';
import {forkJoin, fromEvent, Subscription} from 'rxjs';
import {take} from 'rxjs/operators';

Expand All @@ -29,6 +29,8 @@ export type AnimationMode = 'fling' | 'scale';
@Component({
selector: 'eco-fab-speed-dial-actions',
template: ` <ng-content select="[mat-mini-fab]" *ngIf="miniFabVisible"></ng-content>`,
standalone: true,
imports: [CommonModule],
})
export class EcoFabSpeedDialActionsComponent implements AfterContentInit {
private _parent: EcoFabSpeedDialComponent;
Expand Down Expand Up @@ -164,6 +166,7 @@ export class EcoFabSpeedDialActionsComponent implements AfterContentInit {
`,
styleUrls: ['fab-speed-dial.scss'],
encapsulation: ViewEncapsulation.None,
standalone: true,
})
export class EcoFabSpeedDialComponent implements OnDestroy, AfterContentInit {
private isInitialized = false;
Expand Down Expand Up @@ -333,6 +336,7 @@ export class EcoFabSpeedDialComponent implements OnDestroy, AfterContentInit {
@Component({
selector: 'eco-fab-speed-dial-trigger',
template: ` <ng-content select="[mat-fab]"></ng-content>`,
standalone: true,
})
export class EcoFabSpeedDialTriggerComponent {
private _parent: EcoFabSpeedDialComponent;
Expand Down

0 comments on commit 9001ed8

Please sign in to comment.