Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 0 additions & 73 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
contents: read
pull-requests: write
steps:
- uses: actions/setup-node@v4
- uses: actions/checkout@v4
- uses: actions/setup-node@v5
- uses: actions/checkout@v5
with:
repository: Next2D/player
ref: main
Expand All @@ -31,8 +31,8 @@ jobs:
contents: read
pull-requests: write
steps:
- uses: actions/setup-node@v4
- uses: actions/checkout@v4
- uses: actions/setup-node@v5
- uses: actions/checkout@v5
with:
repository: Next2D/player
ref: main
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
- run: npm install
- run: npx eslint ./src/**/*.ts

Expand All @@ -28,7 +28,7 @@ jobs:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
- run: npm install
- run: npx eslint ./src/**/*.ts
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: "22.x"
registry-url: "https://registry.npmjs.org"
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@next2d/framework",
"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.",
"version": "3.0.12",
"version": "3.0.13",
"homepage": "https://next2d.app",
"bugs": "https://github.com/Next2D/Framework/issues/new",
"author": "Toshiyuki Ienaga <[email protected]> (https://github.com/ienaga/)",
Expand Down Expand Up @@ -32,18 +32,18 @@
},
"devDependencies": {
"@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.36.0",
"@types/node": "^24.6.2",
"@typescript-eslint/eslint-plugin": "^8.45.0",
"@typescript-eslint/parser": "^8.45.0",
"@vitest/web-worker": "^3.2.4",
"eslint": "^9.36.0",
"eslint-plugin-unused-imports": "^4.2.0",
"@eslint/js": "^9.39.0",
"@types/node": "^24.9.2",
"@typescript-eslint/eslint-plugin": "^8.46.2",
"@typescript-eslint/parser": "^8.46.2",
"@vitest/web-worker": "^4.0.6",
"eslint": "^9.39.0",
"eslint-plugin-unused-imports": "^4.3.0",
"globals": "^16.4.0",
"jsdom": "^27.0.0",
"jsdom": "^27.1.0",
"typescript": "^5.9.3",
"vite": "^7.1.8",
"vitest": "^3.2.4",
"vite": "^7.1.12",
"vitest": "^4.0.6",
"vitest-webgl-canvas-mock": "^1.1.0"
},
"peerDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IQueryObject } from "src/interface/IQueryObject";
import type { IQueryObject } from "../../../interface/IQueryObject";
import { $getConfig } from "../../variable/Config";
import { query } from "../../variable/Query";

Expand Down
148 changes: 148 additions & 0 deletions src/application/Application/usecase/ApplicationGotoViewUseCase.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
import { execute } from "./ApplicationGotoViewUseCase";
import { describe, expect, it, vi, beforeEach } from "vitest";
import { MovieClip } from "@next2d/display";
import { Context } from "../../Context";
import { $setConfig } from "../../variable/Config";
import { $setContext } from "../../variable/Context";
import { response } from "../../../infrastructure/Response/variable/Response";

vi.mock("../../../domain/screen/Capture/service/AddScreenCaptureService", () => ({
execute: vi.fn().mockResolvedValue(undefined)
}));

vi.mock("../../../domain/screen/Capture/service/DisposeCaptureService", () => ({
execute: vi.fn()
}));

vi.mock("../../../domain/loading/Loading/service/LoadingStartService", () => ({
execute: vi.fn().mockResolvedValue(undefined)
}));

vi.mock("../../../domain/loading/Loading/service/LoadingEndService", () => ({
execute: vi.fn().mockResolvedValue(undefined)
}));

vi.mock("../../../infrastructure/Response/usecase/ResponseRemoveVariableUseCase", () => ({
execute: vi.fn()
}));

vi.mock("../service/ApplicationQueryStringParserService", () => ({
execute: vi.fn()
}));

vi.mock("../../../infrastructure/Request/usecase/RequestUseCase", () => ({
execute: vi.fn().mockResolvedValue([])
}));

vi.mock("../../../domain/callback/service/CallbackService", () => ({
execute: vi.fn().mockResolvedValue(undefined)
}));

describe("ApplicationGotoViewUseCase Test", () =>
{
let mockApplication: any;
let mockContext: Context;
let root: MovieClip;

beforeEach(() =>
{
response.clear();

mockApplication = {
currentName: "",
popstate: false
};

root = new MovieClip();
mockContext = new Context(root);
mockContext.unbind = vi.fn().mockResolvedValue(undefined);
mockContext.bind = vi.fn().mockResolvedValue(null);

$setContext(mockContext);
$setConfig({
platform: "web",
spa: false,
stage: {
width: 800,
height: 600,
fps: 60
}
});

global.history = {
pushState: vi.fn()
} as any;

global.location = {
origin: "http://localhost"
} as any;

vi.clearAllMocks();
});

it("execute test case1: basic navigation without loading", async () =>
{
const { execute: applicationQueryStringParserService } = await import("../service/ApplicationQueryStringParserService");
const { execute: requestUseCase } = await import("../../../infrastructure/Request/usecase/RequestUseCase");

vi.mocked(applicationQueryStringParserService).mockReturnValue({
name: "home",
queryString: ""
});

vi.mocked(requestUseCase).mockResolvedValue([]);

await execute(mockApplication, "home");

expect(mockContext.unbind).toHaveBeenCalled();
expect(mockApplication.currentName).toBe("home");
expect(mockContext.bind).toHaveBeenCalledWith("home");
});

it("execute test case2: navigation with response data", async () =>
{
const { execute: applicationQueryStringParserService } = await import("../service/ApplicationQueryStringParserService");
const { execute: requestUseCase } = await import("../../../infrastructure/Request/usecase/RequestUseCase");

vi.mocked(applicationQueryStringParserService).mockReturnValue({
name: "dashboard",
queryString: ""
});

const mockResponses = [
{ name: "user", response: { id: 1, name: "Test User" } },
{ name: "settings", response: { theme: "dark" } }
];

vi.mocked(requestUseCase).mockResolvedValue(mockResponses);

await execute(mockApplication, "dashboard");

expect(response.get("user")).toEqual({ id: 1, name: "Test User" });
expect(response.get("settings")).toEqual({ theme: "dark" });
expect(mockApplication.currentName).toBe("dashboard");
});

it("execute test case3: handle response without name", async () =>
{
const { execute: applicationQueryStringParserService } = await import("../service/ApplicationQueryStringParserService");
const { execute: requestUseCase } = await import("../../../infrastructure/Request/usecase/RequestUseCase");

vi.mocked(applicationQueryStringParserService).mockReturnValue({
name: "test",
queryString: ""
});

const mockResponses = [
{ name: "", response: { data: "should be skipped" } },
{ name: "valid", response: { data: "should be set" } }
];

vi.mocked(requestUseCase).mockResolvedValue(mockResponses);

await execute(mockApplication, "test");

expect(response.has("")).toBe(false);
expect(response.get("valid")).toEqual({ data: "should be set" });
});
});
2 changes: 1 addition & 1 deletion src/domain/loading/Loading.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ILoading } from "src/interface/ILoading";
import type { ILoading } from "../../interface/ILoading";

/**
* @type {object}
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { TextFieldContent } from "./application/content/TextFieldContent";
import { VideoContent } from "./application/content/VideoContent";

// output build version
console.log("%c Next2D Framework %c 3.0.12 %c https://next2d.app",
console.log("%c Next2D Framework %c 3.0.13 %c https://next2d.app",
"color: #fff; background: #5f5f5f",
"color: #fff; background: #4bc729",
"");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IRequest } from "src/interface/IRequest";
import type { IRequest } from "../../../interface/IRequest";
import { Loader } from "@next2d/display";
import { URLRequest } from "@next2d/net";
import { cache } from "../../../application/variable/Cache";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IRequest } from "src/interface/IRequest";
import type { IRequest } from "../../../interface/IRequest";
import { packages } from "../../../application/variable/Packages";
import { cache } from "../../../application/variable/Cache";
import { ResponseDTO } from "../../Response/dto/ResponseDTO";
Expand Down
5 changes: 1 addition & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,

"baseUrl": ".",
"outDir": "./dist/src",

"types": [
"vitest/globals"
]
Expand All @@ -37,6 +34,6 @@
"scripts",
"dist",
"src/**/*.test.ts",
".github",
".github"
]
}