Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
59
gaia/apps/system/test/unit/mute_icon_test.js
Executable file
59
gaia/apps/system/test/unit/mute_icon_test.js
Executable file
|
|
@ -0,0 +1,59 @@
|
|||
/* global MuteIcon, MockL10n */
|
||||
'use strict';
|
||||
|
||||
requireApp('system/js/service.js');
|
||||
requireApp('system/js/base_ui.js');
|
||||
requireApp('system/js/base_icon.js');
|
||||
requireApp('system/js/mute_icon.js');
|
||||
require('/shared/test/unit/mocks/mock_l10n.js');
|
||||
|
||||
suite('system/MuteIcon', function() {
|
||||
var subject, realL10n, MockSoundManager;
|
||||
|
||||
setup(function() {
|
||||
MockSoundManager = {
|
||||
vibrationEnabled: false,
|
||||
currentVolume: {
|
||||
notification: 10
|
||||
}
|
||||
};
|
||||
realL10n = navigator.mozL10n;
|
||||
navigator.mozL10n = MockL10n;
|
||||
subject = new MuteIcon(MockSoundManager);
|
||||
subject.start();
|
||||
subject.element = document.createElement('div');
|
||||
});
|
||||
|
||||
teardown(function() {
|
||||
navigator.mozL10n = realL10n;
|
||||
subject.stop();
|
||||
});
|
||||
|
||||
test('Vibration disabled and notification volume is 0', function() {
|
||||
MockSoundManager.vibrationEnabled = false;
|
||||
MockSoundManager.currentVolume.notification = 0;
|
||||
this.sinon.stub(MockL10n, 'get');
|
||||
subject.update();
|
||||
assert.isTrue(subject.isVisible());
|
||||
assert.isFalse(subject.element.classList.contains('vibration'));
|
||||
assert.equal(MockL10n.getAttributes(subject.element).id,
|
||||
'statusbarIconOn-mute');
|
||||
});
|
||||
|
||||
test('Vibration enabled and notification volume is 0"', function() {
|
||||
MockSoundManager.vibrationEnabled = true;
|
||||
MockSoundManager.currentVolume.notification = 0;
|
||||
subject.update();
|
||||
assert.isTrue(subject.isVisible());
|
||||
assert.isTrue(subject.element.classList.contains('vibration'));
|
||||
assert.equal(MockL10n.getAttributes(subject.element).id,
|
||||
'statusbarIconOn-vibration');
|
||||
});
|
||||
|
||||
test('Vibration disabled and notification is not muted', function() {
|
||||
MockSoundManager.vibrationEnabled = false;
|
||||
MockSoundManager.currentVolume.notification = 11;
|
||||
subject.update();
|
||||
assert.isFalse(subject.isVisible());
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue