Skip to content

Commit dd58281

Browse files
committed
Files after running prettier
1 parent d43387f commit dd58281

File tree

2 files changed

+31
-52
lines changed

2 files changed

+31
-52
lines changed

js/utils/__tests__/utils.test.js

Lines changed: 27 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ global.localStorage = {
5858
};
5959

6060
global.XMLHttpRequest = class {
61-
open() { }
62-
setRequestHeader() { }
61+
open() {}
62+
setRequestHeader() {}
6363
send() {
6464
this.status = 200;
6565
this.responseText = "Mock response";
@@ -177,7 +177,6 @@ describe("Utility Functions (logic-only)", () => {
177177
it("handles zero", () => {
178178
expect(mixedNumber(0)).toBe("0/1");
179179
});
180-
181180
});
182181

183182
describe("nearestBeat()", () => {
@@ -187,7 +186,6 @@ describe("Utility Functions (logic-only)", () => {
187186
it("handles large numbers", () => {
188187
expect(nearestBeat(123.456)).toBeDefined();
189188
});
190-
191189
});
192190

193191
describe("oneHundredToFraction()", () => {
@@ -225,7 +223,6 @@ describe("Utility Functions (logic-only)", () => {
225223
expect(rgbToHex(255, 255, 255)).toBe("#ffffff");
226224
});
227225
});
228-
229226
});
230227

231228
describe("hexToRGB()", () => {
@@ -246,7 +243,6 @@ describe("Utility Functions (logic-only)", () => {
246243
expect(rgbToHex(255, 255, 255)).toBe("#ffffff");
247244
});
248245
});
249-
250246
});
251247

252248
describe("hex2rgb()", () => {
@@ -285,23 +281,23 @@ describe("Utility Functions (logic-only)", () => {
285281
expect(result).toBe("Static text");
286282
});
287283
/**
288-
* @license
289-
* MusicBlocks v3.4.1
290-
* Copyright (C) 2024 ravjot07
291-
*
292-
* This program is free software: you can redistribute it and/or modify
293-
* it under the terms of the GNU Affero General Public License as published by
294-
* the Free Software Foundation, either version 3 of the License, or
295-
* (at your option) any later version.
296-
*
297-
* This program is distributed in the hope that it will be useful,
298-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
299-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
300-
* GNU Affero General Public License for more details.
301-
*
302-
* You should have received a copy of the GNU Affero General Public License
303-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
304-
*/
284+
* @license
285+
* MusicBlocks v3.4.1
286+
* Copyright (C) 2024 ravjot07
287+
*
288+
* This program is free software: you can redistribute it and/or modify
289+
* it under the terms of the GNU Affero General Public License as published by
290+
* the Free Software Foundation, either version 3 of the License, or
291+
* (at your option) any later version.
292+
*
293+
* This program is distributed in the hope that it will be useful,
294+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
295+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
296+
* GNU Affero General Public License for more details.
297+
*
298+
* You should have received a copy of the GNU Affero General Public License
299+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
300+
*/
305301

306302
describe("toTitleCase()", () => {
307303
it("converts first character to uppercase", () => {
@@ -412,7 +408,6 @@ describe("Utility Functions (logic-only)", () => {
412408
expect(rgbToHex(0, 255, 0)).toBe("#00ff00");
413409
expect(rgbToHex(0, 0, 255)).toBe("#0000ff");
414410
});
415-
416411
});
417412

418413
describe("hexToRGB()", () => {
@@ -424,7 +419,6 @@ describe("Utility Functions (logic-only)", () => {
424419
it("returns null for invalid hex", () => {
425420
expect(hexToRGB("#zzz")).toBeNull();
426421
});
427-
428422
});
429423

430424
describe("hex2rgb()", () => {
@@ -474,7 +468,6 @@ describe("Utility Functions (logic-only)", () => {
474468
it("ignores unmatched braces", () => {
475469
expect(format("Hello {name", { name: "A" })).toBe("Hello {name");
476470
});
477-
478471
});
479472
});
480473
describe("fileBasename() edge cases", () => {
@@ -484,8 +477,7 @@ describe("Utility Functions (logic-only)", () => {
484477
});
485478
describe("safeSVG() multiple characters", () => {
486479
it("escapes &, < and >", () => {
487-
expect(safeSVG("<div>&</div>"))
488-
.toBe("&lt;div&gt;&amp;&lt;/div&gt;");
480+
expect(safeSVG("<div>&</div>")).toBe("&lt;div&gt;&amp;&lt;/div&gt;");
489481
});
490482
});
491483
describe("rationalToFraction() > 1 case", () => {
@@ -545,7 +537,6 @@ describe("Utility Functions (logic-only)", () => {
545537
expect(rationalSum([-1, 3], [1, 3])).toEqual([0, 3]);
546538
});
547539
});
548-
549540
});
550541
describe("hexToRGB() without hash", () => {
551542
it("parses hex without #", () => {
@@ -625,12 +616,10 @@ describe("Utility Functions (logic-only)", () => {
625616
});
626617
it("calls window.widgetWindows.hideAllWindows", () => {
627618
closeWidgets();
628-
expect(window.widgetWindows.hideAllWindows)
629-
.toHaveBeenCalled();
619+
expect(window.widgetWindows.hideAllWindows).toHaveBeenCalled();
630620
});
631621
});
632622
describe("closeBlkWidgets()", () => {
633-
634623
beforeEach(() => {
635624
window.widgetWindows = {
636625
hideAllWindows: jest.fn(),
@@ -645,23 +634,18 @@ describe("Utility Functions (logic-only)", () => {
645634

646635
closeBlkWidgets("TestWidget");
647636

648-
expect(window.widgetWindows.hideWindow)
649-
.toHaveBeenCalledWith("TestWidget");
637+
expect(window.widgetWindows.hideWindow).toHaveBeenCalledWith("TestWidget");
650638
});
651639

652640
it("does nothing if no match found", () => {
653-
document.getElementsByClassName = jest.fn(() => [
654-
{ innerHTML: "OtherWidget" }
655-
]);
641+
document.getElementsByClassName = jest.fn(() => [{ innerHTML: "OtherWidget" }]);
656642

657643
closeBlkWidgets("TestWidget");
658644

659-
expect(window.widgetWindows.hideWindow)
660-
.not.toHaveBeenCalled();
645+
expect(window.widgetWindows.hideWindow).not.toHaveBeenCalled();
661646
});
662647
});
663648
describe("resolveObject()", () => {
664-
665649
beforeAll(() => {
666650
global.TestNamespace = {
667651
Sub: {
@@ -671,13 +655,11 @@ describe("Utility Functions (logic-only)", () => {
671655
});
672656

673657
it("resolves nested path", () => {
674-
expect(resolveObject("TestNamespace.Sub.value"))
675-
.toBe(42);
658+
expect(resolveObject("TestNamespace.Sub.value")).toBe(42);
676659
});
677660

678661
it("returns undefined for invalid path", () => {
679-
expect(resolveObject("TestNamespace.Invalid.prop"))
680-
.toBeUndefined();
662+
expect(resolveObject("TestNamespace.Invalid.prop")).toBeUndefined();
681663
});
682664

683665
it("returns undefined for null input", () => {
@@ -687,10 +669,8 @@ describe("Utility Functions (logic-only)", () => {
687669
it("returns undefined for non-string input", () => {
688670
expect(resolveObject(123)).toBeUndefined();
689671
});
690-
691672
});
692673
describe("importMembers()", () => {
693-
694674
class DummyModel {
695675
constructor() {
696676
this.modelVar = 10;
@@ -719,7 +699,7 @@ describe("Utility Functions (logic-only)", () => {
719699
});
720700

721701
it("imports model and view members into object", () => {
722-
class TestController { }
702+
class TestController {}
723703

724704
const obj = new TestController();
725705

@@ -730,6 +710,5 @@ describe("Utility Functions (logic-only)", () => {
730710
expect(obj.modelMethod()).toBe("model");
731711
expect(obj.viewMethod()).toBe("view");
732712
});
733-
734713
});
735714
});

js/utils/utils.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,10 +1612,10 @@ let hexToRGB = hex => {
16121612
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
16131613
return result
16141614
? {
1615-
r: parseInt(result[1], 16),
1616-
g: parseInt(result[2], 16),
1617-
b: parseInt(result[3], 16)
1618-
}
1615+
r: parseInt(result[1], 16),
1616+
g: parseInt(result[2], 16),
1617+
b: parseInt(result[3], 16)
1618+
}
16191619
: null;
16201620
};
16211621

0 commit comments

Comments
 (0)