Skip to content

Commit 168d1db

Browse files
committed
fix(): 更改开启调试url的key
Ref NEXT_BUILDER-5697
1 parent b1cc7d2 commit 168d1db

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

cypress/e2e/home.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ for (const port of Cypress.env("ports")) {
3232
});
3333

3434
it("work", () => {
35-
cy.visit(`${origin}/next/home?lng=en&debugConsole=true`, {
35+
cy.visit(`${origin}/next/home?lng=en&__debugConsole__=true`, {
3636
onBeforeLoad(win) {
3737
cy.spy(win.console, "error").as("console.error");
3838
cy.spy(win.console, "info").as("console.info");

packages/brick-kit/src/internal/debugManager.spec.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,12 @@ describe("debugManager", () => {
216216

217217
test("should initialize from URL parameter", () => {
218218
mockURLSearchParams.mockReturnValue({
219-
get: jest.fn().mockReturnValue("true"),
219+
get: (key: string) => {
220+
if (key === "__debugConsole__") {
221+
return "true";
222+
}
223+
return null;
224+
},
220225
});
221226

222227
// Create a new instance to test initialization

packages/brick-kit/src/internal/debugManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class DebugManager {
1818
private initDebugMode(): void {
1919
// 1. 首先检查URL参数
2020
const urlParams = new URLSearchParams(window.location.search);
21-
const debugFromUrl = urlParams.get("debugConsole");
21+
const debugFromUrl = urlParams.get("__debugConsole__");
2222

2323
if (debugFromUrl === "true") {
2424
this.activateSessionDebug();
@@ -159,7 +159,7 @@ class DebugManager {
159159
window.debugConsole.help() - 显示此帮助信息
160160
161161
🌐 URL参数:
162-
?debugConsole=true - 通过URL激活会话调试模式
162+
?__debugConsole__=true - 通过URL激活会话调试模式
163163
164164
📝 说明:
165165
- 会话模式:刷新页面后仍然有效,关闭标签页后失效

0 commit comments

Comments
 (0)