Fix a randomly failing DatePicker test.

This commit is contained in:
Hristo Deshev
2016-03-29 14:37:33 +03:00
parent 69f3dd101e
commit 336379a18e

View File

@@ -154,13 +154,13 @@ export class DatePickerTest extends testModule.UITest<datePickerModule.DatePicke
}
public test_DateIsSetCorrectlyWhenYearIsSet() {
let today = new Date();
this.testView.month = today.getMonth();
this.testView.day = today.getDate();
let current = new Date(2016, 3, 15);
this.testView.month = current.getMonth();
this.testView.day = current.getDate();
let expectedValue = 1980;
this.testView.year = expectedValue;
let expectedDate = new Date(1980, today.getMonth() - 1, today.getDate());
let expectedDate = new Date(1980, current.getMonth() - 1, current.getDate());
TKUnit.assertEqual(this.testView.date.getDate(), expectedDate.getDate(), "Getting Day from date property failed.");
TKUnit.assertEqual(this.testView.date.getMonth(), expectedDate.getMonth(), "Getting Month from date property failed.");
@@ -292,4 +292,4 @@ export class DatePickerTest extends testModule.UITest<datePickerModule.DatePicke
export function createTestCase(): DatePickerTest {
return new DatePickerTest();
}
}