fix(quickref-cookbook): fix date test to work in any timezone

closes #1062
This commit is contained in:
Filipe Silva 2016-04-08 02:20:37 +01:00 committed by Ward Bell
parent adb4093af7
commit 1ba1407385
1 changed files with 19 additions and 17 deletions

View File

@ -13,7 +13,7 @@ describe('Angular 1 to 2 Quick Reference Tests', function () {
var expectedSamples = [
{row: 0, column: 0, element: 'img', attr: 'src', value: 'images/hero.png', contains: true},
{row: 0, column: 2, value: 'Celeritas'},
{row: 1, column: 3, value: 'Dec 17, 2015'},
{row: 1, column: 3, matches: /Dec 1[678], 2015/}, // absorb timezone dif; we care about date format
{row: 1, column: 5, value: '$14.95'},
{row: 2, column: 4, value: 'PG-13'},
{row: 2, column: 7, value: '100%'},
@ -36,9 +36,11 @@ describe('Angular 1 to 2 Quick Reference Tests', function () {
? elementToCheck.getAttribute(sample.attr)
: elementToCheck.getText();
// Test for equals/contains
// Test for equals/contains/match
if (sample.contains) {
expect(valueToCheck).toContain(sample.value);
} else if (sample.matches) {
expect(valueToCheck).toMatch(sample.matches);
} else {
expect(valueToCheck).toEqual(sample.value);
}