forked from swimlane/ngx-datatable
-
Notifications
You must be signed in to change notification settings - Fork 21
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
c222fc6
commit 9735588
Showing
9 changed files
with
95 additions
and
80 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
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/scroller.component.spec.ts
This file was deleted.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
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,36 @@ | ||
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" /> ` | ||
}) | ||
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({ | ||
declarations: [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.
36 changes: 36 additions & 0 deletions
36
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,36 @@ | ||
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> ` | ||
}) | ||
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({ | ||
declarations: [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