Skip to content

Commit 12484f1

Browse files
author
gourijain026@gmail.com
committed
Fix TypeError when creating a new project from the Planet interface
1 parent 637759e commit 12484f1

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

js/__tests__/planetInterface.test.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const mockActivity = {
2929
prepSearchWidget: jest.fn(),
3030
sendAllToTrash: jest.fn(),
3131
refreshCanvas: jest.fn(),
32-
_loadStart: jest.fn(),
32+
justLoadStart: jest.fn(),
3333
doLoadAnimation: jest.fn(),
3434
textMsg: jest.fn(),
3535
stage: { enableDOMEvents: jest.fn(), update: jest.fn() },
@@ -108,31 +108,31 @@ describe("PlanetInterface", () => {
108108
});
109109

110110
test("openPlanet calls saveLocally, hideMusicBlocks, and showPlanet", () => {
111-
jest.spyOn(planetInterface, "saveLocally").mockImplementation(() => {});
112-
jest.spyOn(planetInterface, "hideMusicBlocks").mockImplementation(() => {});
113-
jest.spyOn(planetInterface, "showPlanet").mockImplementation(() => {});
111+
jest.spyOn(planetInterface, "saveLocally").mockImplementation(() => { });
112+
jest.spyOn(planetInterface, "hideMusicBlocks").mockImplementation(() => { });
113+
jest.spyOn(planetInterface, "showPlanet").mockImplementation(() => { });
114114
planetInterface.openPlanet();
115115
expect(planetInterface.saveLocally).toHaveBeenCalled();
116116
expect(planetInterface.hideMusicBlocks).toHaveBeenCalled();
117117
expect(planetInterface.showPlanet).toHaveBeenCalled();
118118
});
119119

120120
test("closePlanet calls hidePlanet and showMusicBlocks", () => {
121-
jest.spyOn(planetInterface, "hidePlanet").mockImplementation(() => {});
122-
jest.spyOn(planetInterface, "showMusicBlocks").mockImplementation(() => {});
121+
jest.spyOn(planetInterface, "hidePlanet").mockImplementation(() => { });
122+
jest.spyOn(planetInterface, "showMusicBlocks").mockImplementation(() => { });
123123
planetInterface.closePlanet();
124124
expect(planetInterface.hidePlanet).toHaveBeenCalled();
125125
expect(planetInterface.showMusicBlocks).toHaveBeenCalled();
126126
});
127127

128-
test("newProject calls closePlanet, initialiseNewProject, _loadStart, and saveLocally", () => {
129-
jest.spyOn(planetInterface, "closePlanet").mockImplementation(() => {});
130-
jest.spyOn(planetInterface, "initialiseNewProject").mockImplementation(() => {});
131-
jest.spyOn(planetInterface, "saveLocally").mockImplementation(() => {});
128+
test("newProject calls closePlanet, initialiseNewProject, justLoadStart, and saveLocally", () => {
129+
jest.spyOn(planetInterface, "closePlanet").mockImplementation(() => { });
130+
jest.spyOn(planetInterface, "initialiseNewProject").mockImplementation(() => { });
131+
jest.spyOn(planetInterface, "saveLocally").mockImplementation(() => { });
132132
planetInterface.newProject();
133133
expect(planetInterface.closePlanet).toHaveBeenCalled();
134134
expect(planetInterface.initialiseNewProject).toHaveBeenCalled();
135-
expect(mockActivity._loadStart).toHaveBeenCalled();
135+
expect(mockActivity.justLoadStart).toHaveBeenCalled();
136136
expect(planetInterface.saveLocally).toHaveBeenCalled();
137137
});
138138
test("onConverterLoad sets window.Converter", () => {
@@ -248,7 +248,7 @@ describe("PlanetInterface", () => {
248248
setOnConverterLoad: jest.fn()
249249
};
250250

251-
win.makePlanet = jest.fn(async () => {});
251+
win.makePlanet = jest.fn(async () => { });
252252
win.p = stubPlanet;
253253

254254
await planetInterface.init();
@@ -294,7 +294,7 @@ describe("PlanetInterface", () => {
294294

295295
global.createjs = {
296296
Bitmap: class {
297-
constructor(img) {}
297+
constructor(img) { }
298298
getBounds() {
299299
return { x: 0, y: 0, width: 1, height: 1 };
300300
}

js/planetInterface.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class PlanetInterface {
179179
this.newProject = () => {
180180
this.closePlanet();
181181
this.initialiseNewProject();
182-
this.activity._loadStart();
182+
this.activity.justLoadStart();
183183
this.saveLocally();
184184
};
185185

0 commit comments

Comments
 (0)