Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #23737 from yzen/bug-1063039
Browse files Browse the repository at this point in the history
Bug 1063039 - update playing icon only if the audio channel actually cha...
  • Loading branch information
yzen committed Sep 9, 2014
2 parents bafd6f5 + c9842bc commit 3b76462
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/system/js/statusbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,11 @@ var StatusBar = {
break;

case 'audio-channel-changed':
this.playingActive = (evt.detail.channel === 'content');
var active = evt.detail.channel === 'content';
if (this.playingActive === active) {
break;
}
this.playingActive = active;
this.update.playing.call(this);
break;
}
Expand Down
14 changes: 14 additions & 0 deletions apps/system/test/unit/statusbar_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1336,6 +1336,7 @@ suite('system/Statusbar', function() {

teardown(function() {
StatusBar.recordingCount = 0;
StatusBar.playingActive = false;
fakeClock.restore();
});

Expand Down Expand Up @@ -1393,6 +1394,19 @@ suite('system/Statusbar', function() {
StatusBar.handleEvent(evt);
assert.equal(StatusBar.icons.playing.hidden, false);
});

test('repeat audio-channel-changed event', function() {
var evt = new CustomEvent('mozChromeEvent', {
detail: {
type: 'audio-channel-changed',
channel: 'content'
}
});
var updatePlayingSpy = sinon.spy(StatusBar.update, 'playing');
StatusBar.handleEvent(evt);
StatusBar.handleEvent(evt);
assert.equal(updatePlayingSpy.callCount, 1);
});
});

suite('fullscreen mode >', function() {
Expand Down

0 comments on commit 3b76462

Please sign in to comment.