refactor(aio): use the SelectMenuComponent for all select menus

The API filters and the docs version switcher now use
the SelectMenuComponent.

Fixes #16367 and #17055
This commit is contained in:
Peter Bacon Darwin
2017-06-06 10:09:46 +01:00
committed by Alex Rickabaugh
parent c9b930dd82
commit bb46f54ad7
8 changed files with 70 additions and 146 deletions

View File

@ -4,6 +4,7 @@ import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { ApiListComponent } from './api-list.component';
import { ApiItem, ApiSection, ApiService } from './api.service';
import { LocationService } from 'app/shared/location.service';
import { SharedModule } from 'app/shared/shared.module';
describe('ApiListComponent', () => {
let component: ApiListComponent;
@ -12,6 +13,7 @@ describe('ApiListComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [ SharedModule ],
declarations: [ ApiListComponent ],
providers: [
{ provide: ApiService, useClass: TestApiService },
@ -75,17 +77,17 @@ describe('ApiListComponent', () => {
});
it('item.show should be true for items with selected status', () => {
component.setStatus({name: 'stable', title: 'Stable'});
component.setStatus({value: 'stable', title: 'Stable'});
expectFilteredResult('status: stable', item => item.stability === 'stable');
});
it('item.show should be true for items with "security-risk" status when selected', () => {
component.setStatus({name: 'security-risk', title: 'Security Risk'});
component.setStatus({value: 'security-risk', title: 'Security Risk'});
expectFilteredResult('status: security-risk', item => item.securityRisk);
});
it('item.show should be true for items of selected type', () => {
component.setType({name: 'class', title: 'Class'});
component.setType({value: 'class', title: 'Class'});
expectFilteredResult('type: class', item => item.docType === 'class');
});
@ -189,8 +191,8 @@ describe('ApiListComponent', () => {
it('should have query, status, and type', () => {
component.setQuery('foo');
component.setStatus({name: 'stable', title: 'Stable'});
component.setType({name: 'class', title: 'Class'});
component.setStatus({value: 'stable', title: 'Stable'});
component.setType({value: 'class', title: 'Class'});
const search = locationService.setSearch.calls.mostRecent().args[1];
expect(search.query).toBe('foo');