Skip to content

Commit

Permalink
feat(collapse): migrated to standalone
Browse files Browse the repository at this point in the history
  • Loading branch information
lexasq committed Jul 16, 2024
1 parent 95475c4 commit aaef99a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 23 deletions.
2 changes: 1 addition & 1 deletion libs/doc-pages/collapse/src/lib/collapse.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export { CollapseSectionComponent } from './collapse-section.component';
...DEMO_COMPONENTS
],
imports: [
CollapseModule.forRoot(),
CollapseModule,
CommonModule,
FormsModule,
DocsModule,
Expand Down
2 changes: 1 addition & 1 deletion libs/doc-pages/collapse/src/lib/docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { CollapseModule } from 'ngx-bootstrap/collapse';
@NgModule({
imports: [
BrowserAnimationsModule,
CollapseModule.forRoot(),
CollapseModule,
...
]
})
Expand Down
13 changes: 7 additions & 6 deletions src/collapse/collapse.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ import {
} from './collapse-animations';

@Directive({
selector: '[collapse]',
exportAs: 'bs-collapse',
// eslint-disable-next-line @angular-eslint/no-host-metadata-property
host: {
'[class.collapse]': 'true'
}
selector: '[collapse]',
exportAs: 'bs-collapse',
// eslint-disable-next-line @angular-eslint/no-host-metadata-property
host: {
'[class.collapse]': 'true'
},
standalone: true
})
export class CollapseDirective implements AfterViewChecked {
/** This event fires as soon as content collapses */
Expand Down
12 changes: 4 additions & 8 deletions src/collapse/collapse.module.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { NgModule, ModuleWithProviders } from '@angular/core';
import { NgModule } from '@angular/core';

import { CollapseDirective } from './collapse.directive';

@NgModule({
declarations: [CollapseDirective],
exports: [CollapseDirective]
imports: [CollapseDirective],
exports: [CollapseDirective]
})
export class CollapseModule {
static forRoot(): ModuleWithProviders<CollapseModule> {
return { ngModule: CollapseModule, providers: [] };
}
}
export class CollapseModule {}
16 changes: 9 additions & 7 deletions src/collapse/testing/collapse.directive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ const template = `
`;

@Component({
selector: 'collapse-test',
template
selector: 'collapse-test',
template,
standalone: true,
imports: [CollapseModule]
})
class TestCollapseComponent {}

Expand All @@ -28,12 +30,12 @@ describe('Directive: Collapse', () => {

beforeEach(() => {
TestBed.configureTestingModule({
declarations: [TestCollapseComponent],
imports: [
imports: [
CollapseModule,
BrowserAnimationsModule
]
});
BrowserAnimationsModule,
TestCollapseComponent
]
});
fixture = TestBed.createComponent(TestCollapseComponent);
fixture.detectChanges();
context = fixture.componentInstance;
Expand Down

0 comments on commit aaef99a

Please sign in to comment.