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

Bug 1227089 - fixed: remove overlay hidden and postpone the class adding action #33452

Open
wants to merge 1 commit into
base: v2.5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions apps/system/lockscreen/js/lockscreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
}

if (!this.locked) {
this.overlay.hidden = true;
this.overlay.classList.add('unlocked');
this.unlockDetail = undefined;
}
break;
Expand Down Expand Up @@ -530,13 +530,11 @@
this.overlay.classList.toggle('no-transition', instant);
this.dispatchEvent('lockscreen-request-unlock', this._unlockingMessage);
this.dispatchEvent('secure-modeoff');
this.overlay.classList.add('unlocked');

// If we don't unlock instantly here,
// these are run in transitioned callback.
if (instant) {
this.overlay.hidden = true;
this.overlay.classList.add('unlocked');
// Otherwise, postpone it to transitionend.
}

// Clear the state after we send the request.
this._unlockingMessage = {};
};
Expand All @@ -545,8 +543,6 @@
this.overlay.focus();
this.overlay.classList.toggle('no-transition', instant);
this.overlay.classList.remove('unlocked');
this.overlay.hidden = false;

};

LockScreen.prototype.lock =
Expand Down
18 changes: 18 additions & 0 deletions apps/system/test/unit/lockscreen/lockscreen_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,24 @@ suite('system/LockScreen >', function() {
stubDispatch.restore();
});

test('Handle event: when unlock animation ends,' +
'it would add `unlocked` class',
function() {
assert.isFalse(subject.overlay.classList.contains('unlocked'));
subject.locked = false;
subject.handleEvent({ type: 'transitionend', target: subject.overlay });
assert.isTrue(subject.overlay.classList.contains('unlocked'));
});

test('Unlock method will add `unlocked` class if it is not an' +
' instant request',
function() {
assert.isFalse(subject.overlay.classList.contains('unlocked'));
subject.enabled = true;
subject.unlock(true); // or lock screen is already enabled
assert.isTrue(subject.overlay.classList.contains('unlocked'));
});

test('Switch panel: to Camera; should notify SecureWindowFactory\'s method',
function() {
var stubDispatch = this.sinon.stub(window, 'dispatchEvent');
Expand Down