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 #24663 from alivedise/bugzilla/1072616/attention-w…
Browse files Browse the repository at this point in the history
…indow-polish

Bug 1076216 - Attention indicator polish, r=etienne
  • Loading branch information
alivedise committed Oct 6, 2014
2 parents 1d153c6 + 25452e1 commit 48ce866
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 15 deletions.
2 changes: 0 additions & 2 deletions apps/system/js/attention_indicator.js
Expand Up @@ -18,7 +18,6 @@
}
},
stop: function() {
window.addEventListener('screenrendered', this.render);
},
render: function() {
if (this._rendered) {
Expand All @@ -34,7 +33,6 @@
'data-z-index-level="attention-indicator">' +
'<div class="handle handle1"></div>' +
'<div class="handle handle2"></div>' +
'<div class="handle handle3"></div>' +
'</div>';
},
show: function() {
Expand Down
7 changes: 7 additions & 0 deletions apps/system/js/attention_toaster.js
Expand Up @@ -26,6 +26,8 @@

TOASTER_TIMEOUT: 5000,

RESPAWN_TIMEOUT: 45000,

start: function() {
this.app.element.addEventListener('_closed', this);
this.app.element.addEventListener('_requestopen', this);
Expand Down Expand Up @@ -123,6 +125,9 @@
}.bind(this));
} else if (evt == 'complete') {
this.app && this.app.setVisible(false);
this.respawnTimer = window.setTimeout(function() {
this.processStateChange('open', 'respawn');
}.bind(this), this.RESPAWN_TIMEOUT);
}
},

Expand All @@ -146,6 +151,8 @@
return;
}

window.clearTimeout(this.respawnTimer);
this.respawnTimer = null;
this.app.setVisible(true);
this.app.element.classList.add('displayed');
},
Expand Down
3 changes: 1 addition & 2 deletions apps/system/js/callscreen_window.js
Expand Up @@ -129,20 +129,19 @@
return;
}
this._terminated = true;
this.publish('terminated');
if (this.isActive()) {
var self = this;
this.element.addEventListener('_closed', function onclosed() {
// XXX: We will have trouble if the second call comes during closing.
self.element.removeEventListener('_closed', onclosed);
self.hide();
self.reloadWindow();
self.publish('terminated');
});
this.requestClose();
} else {
this.hide();
this.reloadWindow();
this.publish('terminated');
}
// XXX: We are leaving the focus in the callscreen iframe
if (document.activeElement === this.browser.element) {
Expand Down
19 changes: 8 additions & 11 deletions apps/system/style/attention_indicator.css
@@ -1,6 +1,6 @@
.attention-indicator {
background: none #00bec3 repeat;
height: 0.2666rem;
background: none #006e86 repeat;
height: 0.2rem;
width: 100%;
position: absolute;
top: 0;
Expand All @@ -13,21 +13,18 @@
}

.attention-indicator > .handle {
background: none #b2f2ff repeat;
border-top: 0.2rem #00d3ff solid;
border-left: 0.2rem transparent solid;
border-right: 0.2rem transparent solid;
animation: handle 1s infinite;
height: 0.2666rem;
height: 0.2rem;
width: 8.6rem;
margin: 0 auto;
}

.attention-indicator > .handle2 {
animation-delay: 333ms;
margin: -0.2666rem auto;
}

.attention-indicator > .handle3 {
animation-delay: 666ms;
margin: -0.5333rem auto;
animation-delay: 0.5ms;
margin: -0.4rem auto;
}

@keyframes handle {
Expand Down
11 changes: 11 additions & 0 deletions apps/system/test/unit/attention_toaster_test.js
Expand Up @@ -86,6 +86,17 @@ suite('system/AttentionToaster', function() {
assert.equal(at1._currentToasterState, 'closing');
});

test('Enter opening state if being at closed state for 30sec.',
function() {
var app1 = new MockAppWindow(fakeAppConfig1);
var at1 = new AttentionToaster(app1);
at1.start();
at1._currentToasterState = 'closing';
at1._enter_closed('complete');
this.sinon.clock.tick(at1.RESPAWN_TIMEOUT);
assert.equal(at1._currentToasterState, 'opening');
});

test('Enter closed state while the attention window transition ends.',
function() {
var app1 = new MockAppWindow(fakeAppConfig1);
Expand Down
2 changes: 2 additions & 0 deletions apps/system/test/unit/callscreen_window_test.js
Expand Up @@ -78,10 +78,12 @@ suite('system/CallscreenWindow', function() {

test('Close while window.close() then hide', function() {
var callscreen = new CallscreenWindow();
var stubPublish = this.sinon.stub(callscreen, 'publish');
this.sinon.stub(callscreen, 'isActive').returns(true);
var stubBlur = this.sinon.stub(callscreen.browser.element, 'blur');
var stubReloadWindow = this.sinon.stub(callscreen, 'reloadWindow');
callscreen.element.dispatchEvent(new CustomEvent('mozbrowserclose'));
assert.isTrue(stubPublish.calledWith('terminated'));
assert.isFalse(stubReloadWindow.called);
callscreen.element.dispatchEvent(new CustomEvent('_closed'));
assert.isTrue(callscreen.isHidden());
Expand Down

0 comments on commit 48ce866

Please sign in to comment.