forked from swimlane/ngx-datatable
-
Notifications
You must be signed in to change notification settings - Fork 22
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
13cd502
commit 62aafd5
Showing
10 changed files
with
106 additions
and
93 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
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