Skip to content

Commit 1aff053

Browse files
authored
Merge pull request #154 from Next2D/develop
develop
2 parents 49a837f + 808b037 commit 1aff053

12 files changed

Lines changed: 175 additions & 103 deletions

File tree

.github/workflows/codeql-analysis.yml

Lines changed: 0 additions & 73 deletions
This file was deleted.

.github/workflows/integration.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ jobs:
1717
contents: read
1818
pull-requests: write
1919
steps:
20-
- uses: actions/setup-node@v4
21-
- uses: actions/checkout@v4
20+
- uses: actions/setup-node@v5
21+
- uses: actions/checkout@v5
2222
with:
2323
repository: Next2D/player
2424
ref: main
@@ -31,8 +31,8 @@ jobs:
3131
contents: read
3232
pull-requests: write
3333
steps:
34-
- uses: actions/setup-node@v4
35-
- uses: actions/checkout@v4
34+
- uses: actions/setup-node@v5
35+
- uses: actions/checkout@v5
3636
with:
3737
repository: Next2D/player
3838
ref: main

.github/workflows/lint.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ jobs:
1717
contents: read
1818
pull-requests: write
1919
steps:
20-
- uses: actions/checkout@v4
21-
- uses: actions/setup-node@v4
20+
- uses: actions/checkout@v5
21+
- uses: actions/setup-node@v5
2222
- run: npm install
2323
- run: npx eslint ./src/**/*.ts
2424

@@ -28,7 +28,7 @@ jobs:
2828
contents: read
2929
pull-requests: write
3030
steps:
31-
- uses: actions/checkout@v4
32-
- uses: actions/setup-node@v4
31+
- uses: actions/checkout@v5
32+
- uses: actions/setup-node@v5
3333
- run: npm install
3434
- run: npx eslint ./src/**/*.ts

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ jobs:
1212
contents: read
1313
pull-requests: write
1414
steps:
15-
- uses: actions/checkout@v4
16-
- uses: actions/setup-node@v4
15+
- uses: actions/checkout@v5
16+
- uses: actions/setup-node@v5
1717
with:
1818
node-version: "22.x"
1919
registry-url: "https://registry.npmjs.org"

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@next2d/framework",
33
"description": "Next2D Framework is designed according to the principles of clean architecture, domain-driven development, test-driven development, and MVVM, with an emphasis on flexibility, scalability, and maintainability, and a design methodology that keeps each layer loosely coupled.",
4-
"version": "3.0.12",
4+
"version": "3.0.13",
55
"homepage": "https://next2d.app",
66
"bugs": "https://github.com/Next2D/Framework/issues/new",
77
"author": "Toshiyuki Ienaga <ienaga@next2d.app> (https://github.com/ienaga/)",
@@ -32,18 +32,18 @@
3232
},
3333
"devDependencies": {
3434
"@eslint/eslintrc": "^3.3.1",
35-
"@eslint/js": "^9.36.0",
36-
"@types/node": "^24.6.2",
37-
"@typescript-eslint/eslint-plugin": "^8.45.0",
38-
"@typescript-eslint/parser": "^8.45.0",
39-
"@vitest/web-worker": "^3.2.4",
40-
"eslint": "^9.36.0",
41-
"eslint-plugin-unused-imports": "^4.2.0",
35+
"@eslint/js": "^9.39.0",
36+
"@types/node": "^24.9.2",
37+
"@typescript-eslint/eslint-plugin": "^8.46.2",
38+
"@typescript-eslint/parser": "^8.46.2",
39+
"@vitest/web-worker": "^4.0.6",
40+
"eslint": "^9.39.0",
41+
"eslint-plugin-unused-imports": "^4.3.0",
4242
"globals": "^16.4.0",
43-
"jsdom": "^27.0.0",
43+
"jsdom": "^27.1.0",
4444
"typescript": "^5.9.3",
45-
"vite": "^7.1.8",
46-
"vitest": "^3.2.4",
45+
"vite": "^7.1.12",
46+
"vitest": "^4.0.6",
4747
"vitest-webgl-canvas-mock": "^1.1.0"
4848
},
4949
"peerDependencies": {

src/application/Application/service/ApplicationQueryStringParserService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { IQueryObject } from "src/interface/IQueryObject";
1+
import type { IQueryObject } from "../../../interface/IQueryObject";
22
import { $getConfig } from "../../variable/Config";
33
import { query } from "../../variable/Query";
44

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
import { execute } from "./ApplicationGotoViewUseCase";
2+
import { describe, expect, it, vi, beforeEach } from "vitest";
3+
import { MovieClip } from "@next2d/display";
4+
import { Context } from "../../Context";
5+
import { $setConfig } from "../../variable/Config";
6+
import { $setContext } from "../../variable/Context";
7+
import { response } from "../../../infrastructure/Response/variable/Response";
8+
9+
vi.mock("../../../domain/screen/Capture/service/AddScreenCaptureService", () => ({
10+
execute: vi.fn().mockResolvedValue(undefined)
11+
}));
12+
13+
vi.mock("../../../domain/screen/Capture/service/DisposeCaptureService", () => ({
14+
execute: vi.fn()
15+
}));
16+
17+
vi.mock("../../../domain/loading/Loading/service/LoadingStartService", () => ({
18+
execute: vi.fn().mockResolvedValue(undefined)
19+
}));
20+
21+
vi.mock("../../../domain/loading/Loading/service/LoadingEndService", () => ({
22+
execute: vi.fn().mockResolvedValue(undefined)
23+
}));
24+
25+
vi.mock("../../../infrastructure/Response/usecase/ResponseRemoveVariableUseCase", () => ({
26+
execute: vi.fn()
27+
}));
28+
29+
vi.mock("../service/ApplicationQueryStringParserService", () => ({
30+
execute: vi.fn()
31+
}));
32+
33+
vi.mock("../../../infrastructure/Request/usecase/RequestUseCase", () => ({
34+
execute: vi.fn().mockResolvedValue([])
35+
}));
36+
37+
vi.mock("../../../domain/callback/service/CallbackService", () => ({
38+
execute: vi.fn().mockResolvedValue(undefined)
39+
}));
40+
41+
describe("ApplicationGotoViewUseCase Test", () =>
42+
{
43+
let mockApplication: any;
44+
let mockContext: Context;
45+
let root: MovieClip;
46+
47+
beforeEach(() =>
48+
{
49+
response.clear();
50+
51+
mockApplication = {
52+
currentName: "",
53+
popstate: false
54+
};
55+
56+
root = new MovieClip();
57+
mockContext = new Context(root);
58+
mockContext.unbind = vi.fn().mockResolvedValue(undefined);
59+
mockContext.bind = vi.fn().mockResolvedValue(null);
60+
61+
$setContext(mockContext);
62+
$setConfig({
63+
platform: "web",
64+
spa: false,
65+
stage: {
66+
width: 800,
67+
height: 600,
68+
fps: 60
69+
}
70+
});
71+
72+
global.history = {
73+
pushState: vi.fn()
74+
} as any;
75+
76+
global.location = {
77+
origin: "http://localhost"
78+
} as any;
79+
80+
vi.clearAllMocks();
81+
});
82+
83+
it("execute test case1: basic navigation without loading", async () =>
84+
{
85+
const { execute: applicationQueryStringParserService } = await import("../service/ApplicationQueryStringParserService");
86+
const { execute: requestUseCase } = await import("../../../infrastructure/Request/usecase/RequestUseCase");
87+
88+
vi.mocked(applicationQueryStringParserService).mockReturnValue({
89+
name: "home",
90+
queryString: ""
91+
});
92+
93+
vi.mocked(requestUseCase).mockResolvedValue([]);
94+
95+
await execute(mockApplication, "home");
96+
97+
expect(mockContext.unbind).toHaveBeenCalled();
98+
expect(mockApplication.currentName).toBe("home");
99+
expect(mockContext.bind).toHaveBeenCalledWith("home");
100+
});
101+
102+
it("execute test case2: navigation with response data", async () =>
103+
{
104+
const { execute: applicationQueryStringParserService } = await import("../service/ApplicationQueryStringParserService");
105+
const { execute: requestUseCase } = await import("../../../infrastructure/Request/usecase/RequestUseCase");
106+
107+
vi.mocked(applicationQueryStringParserService).mockReturnValue({
108+
name: "dashboard",
109+
queryString: ""
110+
});
111+
112+
const mockResponses = [
113+
{ name: "user", response: { id: 1, name: "Test User" } },
114+
{ name: "settings", response: { theme: "dark" } }
115+
];
116+
117+
vi.mocked(requestUseCase).mockResolvedValue(mockResponses);
118+
119+
await execute(mockApplication, "dashboard");
120+
121+
expect(response.get("user")).toEqual({ id: 1, name: "Test User" });
122+
expect(response.get("settings")).toEqual({ theme: "dark" });
123+
expect(mockApplication.currentName).toBe("dashboard");
124+
});
125+
126+
it("execute test case3: handle response without name", async () =>
127+
{
128+
const { execute: applicationQueryStringParserService } = await import("../service/ApplicationQueryStringParserService");
129+
const { execute: requestUseCase } = await import("../../../infrastructure/Request/usecase/RequestUseCase");
130+
131+
vi.mocked(applicationQueryStringParserService).mockReturnValue({
132+
name: "test",
133+
queryString: ""
134+
});
135+
136+
const mockResponses = [
137+
{ name: "", response: { data: "should be skipped" } },
138+
{ name: "valid", response: { data: "should be set" } }
139+
];
140+
141+
vi.mocked(requestUseCase).mockResolvedValue(mockResponses);
142+
143+
await execute(mockApplication, "test");
144+
145+
expect(response.has("")).toBe(false);
146+
expect(response.get("valid")).toEqual({ data: "should be set" });
147+
});
148+
});

src/domain/loading/Loading.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ILoading } from "src/interface/ILoading";
1+
import type { ILoading } from "../../interface/ILoading";
22

33
/**
44
* @type {object}

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { TextFieldContent } from "./application/content/TextFieldContent";
88
import { VideoContent } from "./application/content/VideoContent";
99

1010
// output build version
11-
console.log("%c Next2D Framework %c 3.0.12 %c https://next2d.app",
11+
console.log("%c Next2D Framework %c 3.0.13 %c https://next2d.app",
1212
"color: #fff; background: #5f5f5f",
1313
"color: #fff; background: #4bc729",
1414
"");

src/infrastructure/Request/repository/RequestContentRepository.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { IRequest } from "src/interface/IRequest";
1+
import type { IRequest } from "../../../interface/IRequest";
22
import { Loader } from "@next2d/display";
33
import { URLRequest } from "@next2d/net";
44
import { cache } from "../../../application/variable/Cache";

0 commit comments

Comments
 (0)