remove obsolete elements and cleanup gui
This commit is contained in:
+26
-1
@@ -79,6 +79,10 @@ class FakeElement extends EventTarget {
|
||||
this.dataset = {};
|
||||
this.attributes = new Map();
|
||||
this.focused = false;
|
||||
this.classes = new Set();
|
||||
this.classList = {
|
||||
toggle: (name, enabled) => enabled ? this.classes.add(name) : this.classes.delete(name)
|
||||
};
|
||||
}
|
||||
|
||||
focus() {
|
||||
@@ -140,6 +144,10 @@ test('legal overlay handlers synchronize switches without advancing the start sc
|
||||
const cookieToggles = [new FakeElement()];
|
||||
let enabled = false;
|
||||
const changes = [];
|
||||
const frames = [];
|
||||
function flushFrames() {
|
||||
while (frames.length) frames.shift()();
|
||||
}
|
||||
|
||||
class TestCustomEvent extends Event {
|
||||
constructor(type, options = {}) {
|
||||
@@ -178,7 +186,8 @@ test('legal overlay handlers synchronize switches without advancing the start sc
|
||||
document,
|
||||
Event,
|
||||
EventTarget,
|
||||
CustomEvent: TestCustomEvent
|
||||
CustomEvent: TestCustomEvent,
|
||||
requestAnimationFrame: callback => frames.push(callback)
|
||||
};
|
||||
context.globalThis = context;
|
||||
await loadI18n(context);
|
||||
@@ -188,6 +197,22 @@ test('legal overlay handlers synchronize switches without advancing the start sc
|
||||
assert.equal(elements.get('info-dropdown').hidden, false);
|
||||
assert.equal(elements.get('info-button').attributes.get('aria-expanded'), 'true');
|
||||
assert.equal(elements.get('info-dialog').open, false);
|
||||
assert.equal(elements.get('info-dropdown').classes.has('is-open'), false);
|
||||
frames.shift()();
|
||||
assert.equal(elements.get('info-dropdown').classes.has('is-open'), false);
|
||||
frames.shift()();
|
||||
assert.equal(elements.get('info-dropdown').classes.has('is-open'), true);
|
||||
|
||||
elements.get('info-button').dispatchEvent(pointerEvent());
|
||||
assert.equal(elements.get('info-dropdown').classes.has('is-open'), false);
|
||||
elements.get('info-button').dispatchEvent(pointerEvent());
|
||||
elements.get('info-button').dispatchEvent(pointerEvent());
|
||||
flushFrames();
|
||||
assert.equal(elements.get('info-dropdown').hidden, true);
|
||||
assert.equal(elements.get('info-dropdown').classes.has('is-open'), false);
|
||||
|
||||
elements.get('info-button').dispatchEvent(pointerEvent());
|
||||
flushFrames();
|
||||
|
||||
targetButtons[0].dispatchEvent(pointerEvent());
|
||||
assert.equal(elements.get('info-dialog').open, true);
|
||||
|
||||
Reference in New Issue
Block a user