test(datepicker): set locale to en-US (#5049)

Currently, some of the datepicker tests will fail if the browser's locale is different from en-US. These changes set the locale to en-US in order to avoid potential issues in the future.
This commit is contained in:
Kristiyan Kostadinov
2017-06-10 01:08:42 +02:00
committed by Andrew Seguin
parent 6b659eeda2
commit 419d9da59b
3 changed files with 24 additions and 3 deletions
+8 -1
View File
@@ -8,7 +8,7 @@ import {By} from '@angular/platform-browser';
import {dispatchFakeEvent, dispatchMouseEvent} from '../core/testing/dispatch-events';
import {MdInputModule} from '../input/index';
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
import {MdNativeDateModule} from '../core/datetime/index';
import {MdNativeDateModule, DateAdapter, NativeDateAdapter} from '../core/datetime/index';
// When constructing a Date, the month is zero-based. This can be confusing, since people are
@@ -29,6 +29,13 @@ describe('MdDatepicker', () => {
NoopAnimationsModule,
ReactiveFormsModule,
],
providers: [
{provide: DateAdapter, useFactory: () => {
let adapter = new NativeDateAdapter();
adapter.setLocale('en-US');
return adapter;
}}
],
declarations: [
DatepickerWithFilterAndValidation,
DatepickerWithFormControl,
+8 -1
View File
@@ -3,7 +3,7 @@ import {Component} from '@angular/core';
import {By} from '@angular/platform-browser';
import {MdMonthView} from './month-view';
import {MdCalendarBody} from './calendar-body';
import {MdNativeDateModule} from '../core/datetime/index';
import {MdNativeDateModule, DateAdapter, NativeDateAdapter} from '../core/datetime/index';
// When constructing a Date, the month is zero-based. This can be confusing, since people are
@@ -18,6 +18,13 @@ describe('MdMonthView', () => {
imports: [
MdNativeDateModule,
],
providers: [
{provide: DateAdapter, useFactory: () => {
let adapter = new NativeDateAdapter();
adapter.setLocale('en-US');
return adapter;
}}
],
declarations: [
MdCalendarBody,
MdMonthView,
+8 -1
View File
@@ -3,7 +3,7 @@ import {Component} from '@angular/core';
import {By} from '@angular/platform-browser';
import {MdYearView} from './year-view';
import {MdCalendarBody} from './calendar-body';
import {MdNativeDateModule} from '../core/datetime/index';
import {MdNativeDateModule, DateAdapter, NativeDateAdapter} from '../core/datetime/index';
// When constructing a Date, the month is zero-based. This can be confusing, since people are
@@ -18,6 +18,13 @@ describe('MdYearView', () => {
imports: [
MdNativeDateModule,
],
providers: [
{provide: DateAdapter, useFactory: () => {
let adapter = new NativeDateAdapter();
adapter.setLocale('en-US');
return adapter;
}}
],
declarations: [
MdCalendarBody,
MdYearView,