forked from swimlane/ngx-datatable
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: datatable-selection and datatable-scroller as directive
BREAKING CHANGE: replaced `DataTableSelectionComponent` with `DataTableSelectionDirective` and `ScrollerComponent` with `ScrollerDirective`. This components were used internally and now replaced as directives.
- Loading branch information
1 parent
ab910c3
commit 23addae
Showing
9 changed files
with
283 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
380 changes: 189 additions & 191 deletions
380
projects/ngx-datatable/src/lib/components/body/body.component.ts
Large diffs are not rendered by default.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
projects/ngx-datatable/src/lib/components/body/scroller.component.spec.ts
This file was deleted.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
projects/ngx-datatable/src/lib/components/body/scroller.directive.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; | ||
import { ScrollerDirective } from './scroller.directive'; | ||
import { Component, ViewChild } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'test-fixture-component', | ||
template: ` <datatable-scroller #scroller="scroller" /> `, | ||
standalone: true, | ||
imports: [ScrollerDirective] | ||
}) | ||
class TestFixtureComponent { | ||
@ViewChild(ScrollerDirective, { static: true }) scroller!: ScrollerDirective; | ||
} | ||
|
||
describe('ScrollerDirective', () => { | ||
let fixture: ComponentFixture<TestFixtureComponent>; | ||
let component: TestFixtureComponent; | ||
|
||
// provide our implementations or mocks to the dependency injector | ||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [TestFixtureComponent, ScrollerDirective] | ||
}); | ||
}); | ||
|
||
beforeEach(waitForAsync(() => { | ||
TestBed.compileComponents().then(() => { | ||
fixture = TestBed.createComponent(TestFixtureComponent); | ||
component = fixture.componentInstance; | ||
}); | ||
})); | ||
|
||
describe('fixture', () => { | ||
it('should have a directive instance', () => { | ||
expect(component.scroller).toBeTruthy(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 0 additions & 27 deletions
27
projects/ngx-datatable/src/lib/components/body/selection.component.spec.ts
This file was deleted.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
projects/ngx-datatable/src/lib/components/body/selection.directive.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; | ||
import { DataTableSelectionDirective } from './selection.directive'; | ||
import { Component, ViewChild } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'test-fixture-component', | ||
template: ` <div datatable-selection></div> `, | ||
standalone: true, | ||
imports: [DataTableSelectionDirective] | ||
}) | ||
class TestFixtureComponent { | ||
@ViewChild(DataTableSelectionDirective, { static: true }) selector!: DataTableSelectionDirective; | ||
} | ||
|
||
describe('DataTableSelectionDirective', () => { | ||
let fixture: ComponentFixture<TestFixtureComponent>; | ||
let component: TestFixtureComponent; | ||
|
||
// provide our implementations or mocks to the dependency injector | ||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [TestFixtureComponent, DataTableSelectionDirective] | ||
}); | ||
}); | ||
|
||
beforeEach(waitForAsync(() => { | ||
TestBed.compileComponents().then(() => { | ||
fixture = TestBed.createComponent(TestFixtureComponent); | ||
component = fixture.componentInstance; | ||
}); | ||
})); | ||
|
||
describe('fixture', () => { | ||
it('should have a component instance', () => { | ||
expect(component.selector).toBeTruthy(); | ||
}); | ||
}); | ||
}); |
11 changes: 5 additions & 6 deletions
11
...ib/components/body/selection.component.ts → ...ib/components/body/selection.directive.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters