UNPKG

ng-mat-daterange-picker

Version:

[![CircleCI](https://circleci.com/gh/ashishgkwd/ngx-mat-daterange-picker.svg?style=shield)](https://circleci.com/gh/ashishgkwd/ngx-mat-daterange-picker) [![Maintainability](https://api.codeclimate.com/v1/badges/2b0d09a866f6d2ed139c/maintainability)](https

57 lines (47 loc) 1.76 kB
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { CalendarWrapperComponent } from './calendar-wrapper.component'; import { ConfigStoreService } from '../services/config-store.service'; import { NO_ERRORS_SCHEMA } from '@angular/core'; describe('CalendarWrapperComponent', () => { let component: CalendarWrapperComponent; let fixture: ComponentFixture<CalendarWrapperComponent>; let configStoreService:ConfigStoreService; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ CalendarWrapperComponent ], providers: [ConfigStoreService], schemas: [NO_ERRORS_SCHEMA] }) .compileComponents(); })); beforeEach(() => { configStoreService = TestBed.get(ConfigStoreService); configStoreService.ngxDrpOptions = { presets:this.presets, format: 'mediumDate', range: {fromDate:new Date(), toDate:new Date()}, applyLabel: "Submit" }; fixture = TestBed.createComponent(CalendarWrapperComponent); component = fixture.componentInstance; fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); }); it('should set date format from options', () => { expect(component.dateFormat).toEqual(configStoreService.ngxDrpOptions.format); }) it('should setup weekend filter', () => { configStoreService.ngxDrpOptions.excludeWeekends = true; expect(component.weekendFilter).toBeDefined(); }) it('should emit date selection change', () => { component.selectedDateChange.subscribe( val => { expect(val instanceof Date).toBeTruthy(); } ); component.onSelectedChange(new Date()); }) });