Fix 'gr-date-formatter' tests in Edge

Bug: Issue 3999
Change-Id: I77df1cfb1c87cb02ac72293b45b3d00c7f59273e
This commit is contained in:
Urs Wolfer
2016-03-18 23:01:22 +01:00
parent 72c5a61d69
commit f9f521c1c9
2 changed files with 9 additions and 6 deletions

View File

@@ -37,11 +37,12 @@
}, },
_timeFormat: String, _timeFormat: String,
_timeFormatPromise: Object, // Used for testing.
}, },
attached: function() { attached: function() {
this._getTimeFormat().then(function(timeFormat) { this._timeFormatPromise = this._getTimeFormat().then(function(tf) {
this._timeFormat = timeFormat; this._timeFormat = tf;
}.bind(this)); }.bind(this));
}, },

View File

@@ -129,14 +129,15 @@ limitations under the License.
} }
suite('logged in', function() { suite('logged in', function() {
setup(function() { setup(function(done) {
return stubRestAPI(true, {time_format: 'HHMM_12'}).then(function() { return stubRestAPI(true, {time_format: 'HHMM_12'}).then(function() {
element = fixture('basic'); element = fixture('basic');
done();
}); });
}); });
test('Preferences are respected', function(done) { test('Preferences are respected', function(done) {
flush(function() { element._timeFormatPromise.then(function() {
assert.equal(element._timeFormat, 'HHMM_12'); assert.equal(element._timeFormat, 'HHMM_12');
done(); done();
}); });
@@ -144,14 +145,15 @@ limitations under the License.
}); });
suite('logged out', function() { suite('logged out', function() {
setup(function() { setup(function(done) {
return stubRestAPI(false, null).then(function() { return stubRestAPI(false, null).then(function() {
element = fixture('basic'); element = fixture('basic');
done();
}); });
}); });
test('Default preferences are respected', function(done) { test('Default preferences are respected', function(done) {
flush(function() { element._timeFormatPromise.then(function() {
assert.equal(element._timeFormat, 'HHMM_24'); assert.equal(element._timeFormat, 'HHMM_24');
done(); done();
}); });