Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Merge pull request #45 from Polymer/issue43
Browse files Browse the repository at this point in the history
make test not depend on date formatting, fixes #43
  • Loading branch information
Steve Orvell committed Aug 11, 2014
2 parents 5e4cf1e + 739825d commit 96e952b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tests/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ suite('PolymerExpressions', function() {
});
}

function objToString(str) {
return {
toString: function() {
return str;
}
};
}

test('ClassName Singular', function(done) {
var div = createTestHtml(
'<template bind><div class="{{ {foo: bar} | tokenList }}">' +
Expand Down Expand Up @@ -1141,14 +1149,14 @@ suite('PolymerExpressions', function() {
'Tue Jul 08 2014 12:00:00 GMT-0700 (PDT)': 'bar',
'Wed Jul 09 2014 12:00:00 GMT-0700 (PDT)': 'baz'
},
dateObj: new Date('Tue Jul 08 2014 12:00:00 GMT-0700 (PDT)')
dateObj: objToString('Tue Jul 08 2014 12:00:00 GMT-0700 (PDT)')
};

recursivelySetTemplateModel(div, model);

then(function() {
assert.equal('bar', div.childNodes[1].getAttribute('foo'));
model.dateObj = new Date('Wed Jul 09 2014 12:00:00 GMT-0700 (PDT)');
model.dateObj = objToString('Wed Jul 09 2014 12:00:00 GMT-0700 (PDT)');

}).then(function() {
assert.equal('baz', div.childNodes[1].getAttribute('foo'));
Expand All @@ -1167,7 +1175,7 @@ suite('PolymerExpressions', function() {
myObj: {
'Tue Jul 08 2014 12:00:00 GMT-0700 (PDT)': 'bar',
},
dateObj: new Date('Tue Jul 08 2014 12:00:00 GMT-0700 (PDT)')
dateObj: objToString('Tue Jul 08 2014 12:00:00 GMT-0700 (PDT)')
};

recursivelySetTemplateModel(div, model);
Expand Down

0 comments on commit 96e952b

Please sign in to comment.