forked from Blendman974/faceclaw
[verified] fix: hide notification background only on screen wake
This commit is contained in:
1 parent
22df4d76d9
commit
9ddc864b0d
6 files changed
+75
-20
No files matched your search
@@ -3,13 +3,27 @@ const assert = require("node:assert/strict");
|
||||
|
||||
const { NotificationModalQueue } = require("../.test-build/app/ui/shell/notification-modal-queue.js");
|
||||
|
||||
test('background visibility follows each arrival, independently of inherited return-to-sleep state', () => {
|
||||
const host = makeHost();
|
||||
const queue = new NotificationModalQueue(host);
|
||||
queue.post('wake', true);
|
||||
queue.post('already-on', false);
|
||||
assert.equal(host.opened[0].hideBackground, true);
|
||||
queue.closed(host.opened[0]);
|
||||
assert.equal(host.opened[1].hideBackground, false, 'queued arrivals must not inherit the first popup mask');
|
||||
queue.closed(host.opened[1]);
|
||||
assert.equal(host.sleeps, 1, 'sleep restoration is still inherited across the queue');
|
||||
queue.post('normal', false);
|
||||
assert.equal(host.opened[2].hideBackground, false);
|
||||
});
|
||||
|
||||
/** A host that records opened modals (one handle object each) and sleeps. */
|
||||
function makeHost(unavailable = new Set()) {
|
||||
const host = {
|
||||
opened: [],
|
||||
sleeps: 0,
|
||||
open(notificationKey) {
|
||||
const modal = { notificationKey };
|
||||
open(notificationKey, hideBackground) {
|
||||
const modal = { notificationKey, hideBackground };
|
||||
host.opened.push(modal);
|
||||
return modal;
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user