Created
August 19, 2014 10:31
-
-
Save etiennesegonzac/aa42670ebeaf33c39680 to your computer and use it in GitHub Desktop.
Update Manager roaming test with promise
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test('should handle clicking download when using data connection ' + | |
'in the first time', | |
function(done) { | |
MockNavigatorSettings.mSettings['ril.data.roaming_enabled'] = false; | |
var getSpy = this.sinon.spy(UpdateManager, '_getDataRoamingSetting'); | |
UpdateManager.downloadDialog.dataset.nowifi = true; | |
var evt = document.createEvent('MouseEvents'); | |
evt.initEvent('click', true, true); | |
UpdateManager.requestDownloads(evt); | |
getSpy.lastCall.returnValue.then(function() { | |
var css = UpdateManager.downloadViaDataConnectionDialog.classList; | |
var titleL10nId = | |
UpdateManager.downloadViaDataConnectionTitle | |
.getAttribute('data-l10n-id'); | |
var messageL10nId = | |
UpdateManager.downloadViaDataConnectionMessage | |
.getAttribute('data-l10n-id'); | |
assert.isTrue(css.contains('visible')); | |
assert.equal(titleL10nId, 'downloadUpdatesViaDataConnection'); | |
assert.equal(messageL10nId, | |
'downloadUpdatesViaDataConnectionMessage2'); | |
}).then(done, done); | |
}); | |
test('should handle clicking download when using data ' + | |
'connection roaming in the first time', | |
function(done) { | |
UpdateManager.downloadDialog.dataset.nowifi = true; | |
MockNavigatorSettings.mSettings['ril.data.roaming_enabled'] = true; | |
var getSpy = this.sinon.spy(UpdateManager, '_getDataRoamingSetting'); | |
var evt = document.createEvent('MouseEvents'); | |
evt.initEvent('click', true, true); | |
UpdateManager.requestDownloads(evt); | |
getSpy.lastCall.returnValue.then(function() { | |
var css = UpdateManager.downloadViaDataConnectionDialog.classList; | |
var titleL10nId = | |
UpdateManager.downloadViaDataConnectionTitle | |
.getAttribute('data-l10n-id'); | |
var messageL10nId = | |
UpdateManager.downloadViaDataConnectionMessage | |
.getAttribute('data-l10n-id'); | |
assert.isTrue(css.contains('visible')); | |
assert.equal(titleL10nId, | |
'downloadUpdatesViaDataRoamingConnection'); | |
assert.equal(messageL10nId, | |
'downloadUpdatesViaDataRoamingConnectionMessage'); | |
}).then(done, done); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment