Skip to content

Commit 194e39d

Browse files
Fix/issue 6563 help lazyload (#6567)
* docs: add issue screenshot for webcam stop bug * Lazy-load help widget from aux pie menu * Delete issue-assets/6562-webcam-stop.png * Trim PR to test-only changes * test: align aux help regression test with merged fix * test: keep PR focused on regression coverage * test: restore source fixture for help regression
1 parent 0ab8bae commit 194e39d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

js/__tests__/piemenus.test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,14 @@
99
* (at your option) any later version.
1010
*/
1111

12+
const fs = require("fs");
13+
const path = require("path");
14+
1215
const { piemenuPitches } = require("../piemenus");
1316

17+
const piemenusPath = path.join(__dirname, "..", "piemenus.js");
18+
let piemenusContent;
19+
1420
// Mock Globals
1521
global.docById = jest.fn().mockReturnValue({
1622
style: { display: "", opacity: "" },
@@ -101,6 +107,11 @@ global.buildScale = jest.fn(() => [["C", "D", "E", "F", "G", "A", "B", "C"], []]
101107

102108
describe("piemenus behavioral tests", () => {
103109
let mockBlock;
110+
111+
beforeAll(() => {
112+
piemenusContent = fs.readFileSync(piemenusPath, "utf8");
113+
});
114+
104115
beforeEach(() => {
105116
mockBlock = {
106117
container: { x: 100, y: 100, setChildIndex: jest.fn(), children: [] },
@@ -188,4 +199,12 @@ describe("piemenus behavioral tests", () => {
188199
// Octave 4 -> 3.
189200
expect(mockBlock.blocks.setPitchOctave).toHaveBeenCalledWith("mock-id", 3);
190201
});
202+
203+
describe("Block Help Menu", () => {
204+
it("should load help before opening the aux pie menu help widget", () => {
205+
expect(piemenusContent).toMatch(
206+
/if \(typeof HelpWidget === "undefined"\)\s*\{\s*if \(typeof require !== "undefined"\)\s*\{\s*require\(\["widgets\/help"\], function \(\) \{\s*new HelpWidget\(that, true\);/
207+
);
208+
});
209+
});
191210
});

0 commit comments

Comments
 (0)