1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-13 11:29:54 +03:00
betaflight-configurator/test/setup.js
David Anson 183e89419d
Replace all 4 instances of jBox-style modal dialog boxes with HTML dialog element (#4484)
* Replace all 4 instances of jBox-style modal dialog boxes with HTML dialog element

Notes:
- The Power & Battery (2), OSD, and CLI tabs have been updated accordingly
- HTML default control behavior was used whereever possible
- HTML indent for the dialog tag is deliberately off to minimize diff noise in GitHub
- Layout is not 100% identical, but spiratually the same - in most cases no changes were needed
- OSD’s Font Manager dialog didn’t transition cleanly, so includes some slight restyling
- OSD Font Manager previously had a green background/color for the graphic - that “just works” now
- Specific cleanup (i.e., calling destroy()) does not seem necessary and was removed
- Removal of jBox from setup.js and global scope seems not to affect jBox tooltips
- Replacement of single quotes with double in main.js was done automatically by Prettier

* Fix unclickable "Select custom image..." button in OSD tab due to overlapping layout; replace with CSS grid.

* Update OSD's Font Manager dialog to not have scroll bars by default (PR feedback).

* Update OSD's Font Manager dialog to remove overflow-y:scroll in order to avoid even a disabled scroll bar on some platforms/browsers (PR feedback).
2025-06-27 21:29:10 +02:00

23 lines
636 B
JavaScript

import { JSDOM } from "jsdom";
import $ from "jquery";
import { vi } from "vitest";
// Note: this can go away once jquery is used as module everywhere
const { window } = new JSDOM("");
$(window);
globalThis.$ = $;
globalThis.jQuery = $;
Object.defineProperty(window, "matchMedia", {
writable: true,
value: vi.fn().mockImplementation((query) => ({
matches: false,
media: query,
onchange: null,
addListener: vi.fn(), // deprecated
removeListener: vi.fn(), // deprecated
addEventListener: vi.fn(),
removeEventListener: vi.fn(),
dispatchEvent: vi.fn(),
})),
});