mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 10:24:02 +00:00
test: follow formatted shell owners and make playback keyboard focus explicit
This commit is contained in:
1 parent
945a809994
commit
841da87ca4
13 files changed
+90
-83
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { StyleManager } from './ui/applicationShell.js';
|
||||
import { createHoverDisclosure, collapsePanelOnEscape } from './ui/panelDisclosure.js';
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
@@ -11,17 +12,6 @@ const locationToggleMarkup = locationMarkup.match(/<button\b([^>]*\bid="location
|
||||
const locationToggleAttributes = Object.fromEntries(
|
||||
[...(locationToggleMarkup?.[1] || '').matchAll(/([\w-]+)="([^"]*)"/g)].map((match) => [match[1], match[2]]),
|
||||
);
|
||||
const initStart = source.indexOf(' _initAutoHoverPanel(');
|
||||
const initEnd = source.indexOf(' /**\n * Sets up drag-to-reposition', initStart);
|
||||
const escapeStart = source.indexOf(' _collapsePanelOnEscape(');
|
||||
const escapeEnd = source.indexOf(' _initCommandDockPins(', escapeStart);
|
||||
const closeStart = source.indexOf(' setPanelCollapsed(panelId, collapsed, {');
|
||||
const closeEnd = source.indexOf(' /**\n * Toggles "clean view"', closeStart);
|
||||
const syncStart = source.indexOf(' _syncPanelCollapseButton(panelEl) {');
|
||||
const syncEnd = source.indexOf(' /**\n * Converts a panel', syncStart);
|
||||
assert.ok(initStart >= 0 && initEnd > initStart && escapeStart >= 0 && escapeEnd > escapeStart
|
||||
&& closeStart >= 0 && closeEnd > closeStart);
|
||||
assert.ok(syncStart >= 0 && syncEnd > syncStart);
|
||||
|
||||
function harness({ hidden = false, selected = true, noChips = false } = {}) {
|
||||
let now = 0;
|
||||
@@ -116,7 +106,7 @@ function harness({ hidden = false, selected = true, noChips = false } = {}) {
|
||||
window.performance = { now: () => now };
|
||||
document.defaultView = window;
|
||||
const methods = new Function('createHoverDisclosure', 'collapsePanelOnEscape', 'document', 'window', 'clearTimeout', 'performance', 'requestAnimationFrame',
|
||||
`return ({${source.slice(initStart, initEnd)},\n${source.slice(escapeStart, escapeEnd)},\n${source.slice(closeStart, closeEnd)},\n${source.slice(syncStart, syncEnd)}});`)(
|
||||
`return ({${StyleManager.prototype._initAutoHoverPanel.toString()},\n${StyleManager.prototype._collapsePanelOnEscape.toString()},\n${StyleManager.prototype.setPanelCollapsed.toString()},\n${StyleManager.prototype._syncPanelCollapseButton.toString()}});`)(
|
||||
createHoverDisclosure, collapsePanelOnEscape, document, window, (id) => timers.delete(id), { now: () => now }, () => {},
|
||||
);
|
||||
const saves = [];
|
||||
|
||||
Reference in new issue
Block a user