Last active
January 30, 2020 20:09
-
-
Save obsd/7906a74a2dc02551ec54cedaf71008f7 to your computer and use it in GitHub Desktop.
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
... | |
fixture = TestBed.createComponent(DatatableFiltersComponent); // component preprerations | |
component = fixture.debugElement.componentInstance; | |
component.filterOptions = createFilterOptions(); | |
component.filtersState = []; | |
}); | |
it('should create pill', async () => { // checking the simplest behaviour | |
const filterValue = ["a"]; | |
const demoFilter = createFilter(EXAMPLE_FILTER_NAME, filterValue); | |
expect(component.pillsSubject.value.length).toEqual(0); | |
component.filtersState = [...component.currentFiltersState, demoFilter]; | |
expect(component.pillsSubject.value.length).toEqual(demoFilter.values.length); | |
}); | |
it('should create 2 pills of same filter', async () => { // we should have 2 search pills, one for each filter | |
const demoFilter = createFilter(EXAMPLE_FILTER_NAME, EXMAPLE_FILTER_VALUES); | |
expect(component.pillsSubject.value.length).toEqual(0); | |
component.filtersState = [...component.currentFiltersState, demoFilter]; | |
expect(component.pillsSubject.value.length).toEqual(demoFilter.values.length); | |
}); | |
... | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment