更新deno.json和deno.lock文件,调整依赖项版本并添加开发模式标识,确保与最新的库版本兼容,提升项目的可维护性和稳定性。
This commit is contained in:
61
client/admin/test/theme_setting_page.test.tsx
Normal file
61
client/admin/test/theme_setting_page.test.tsx
Normal file
@@ -0,0 +1,61 @@
|
||||
import { JSDOM } from 'npm:jsdom'
|
||||
import React from 'react'
|
||||
import {render, fireEvent, within, screen} from '@testing-library/react'
|
||||
import { ThemeSettingsPage } from "../pages_settings.tsx"
|
||||
import { ThemeProvider } from "../hooks_sys.tsx"
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||
|
||||
const queryClient = new QueryClient()
|
||||
|
||||
|
||||
const dom = new JSDOM(`<body></body>`, { runScripts: "dangerously" , pretendToBeVisual: true });
|
||||
|
||||
// The script will be executed and modify the DOM:
|
||||
// console.log(dom.window.document.getElementById("root").innerHTML); // 1
|
||||
globalThis.window = dom.window;
|
||||
globalThis.document = dom.window.document;
|
||||
const customScreen = within(document.body)
|
||||
|
||||
// console.log(dom.window.document.getElementById("root").innerHTML); // 1
|
||||
// const div = globalThis.document.createElement("div");
|
||||
// div.innerHTML = "主题设置";
|
||||
// globalThis.document.getElementById("root")?.appendChild(div);
|
||||
|
||||
// render(<TestNode />);
|
||||
|
||||
// const testMessage = 'Test Message'
|
||||
// render(<HiddenMessage>{testMessage}</HiddenMessage>)
|
||||
// console.log('document.body.innerHTML', document.body.innerHTML);
|
||||
// const customScreen = within(document.body)
|
||||
|
||||
// screen.debug()
|
||||
|
||||
// // // query* functions will return the element or null if it cannot be found
|
||||
// // // get* functions will return the element or throw an error if it cannot be found
|
||||
// console.log('queryByText', customScreen.queryByText(testMessage))
|
||||
|
||||
// // // the queries can accept a regex to make your selectors more resilient to content tweaks and changes.
|
||||
// fireEvent.click(customScreen.getByLabelText(/show/i))
|
||||
|
||||
// screen.debug()
|
||||
|
||||
// // // .toBeInTheDocument() is an assertion that comes from jest-dom
|
||||
// // // otherwise you could use .toBeDefined()
|
||||
// console.log('getByText', customScreen.getByText(testMessage).innerHTML.includes(testMessage))
|
||||
|
||||
// // console.log(globalThis.document.body.innerHTML);
|
||||
// // console.log(screen.debug());
|
||||
// // screen.findByText("主题设置");
|
||||
|
||||
render((
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<ThemeProvider>
|
||||
<ThemeSettingsPage />
|
||||
</ThemeProvider>
|
||||
</QueryClientProvider>
|
||||
))
|
||||
|
||||
screen.debug()
|
||||
|
||||
// screen.findByText("主题设置")
|
||||
|
||||
26
deno.json
26
deno.json
@@ -9,14 +9,6 @@
|
||||
"@d8d-appcontainer/auth": "https://esm.d8d.fun/@d8d-appcontainer/auth@0.0.14",
|
||||
"debug": "https://esm.d8d.fun/debug@4.4.0",
|
||||
"dayjs/plugin/utc": "https://esm.d8d.fun/dayjs@1.11.13/plugin/utc",
|
||||
"react": "https://esm.d8d.fun/react@19.0.0",
|
||||
"react-dom": "https://esm.d8d.fun/react-dom@19.0.0",
|
||||
"react-dom/client": "https://esm.d8d.fun/react-dom@19.0.0/client",
|
||||
"react-router": "https://esm.d8d.fun/react-router@7.3.0?deps=react@19.0.0,react-dom@19.0.0",
|
||||
"antd": "https://esm.d8d.fun/antd@5.24.5?standalone&deps=react@19.0.0,react-dom@19.0.0",
|
||||
"antd/locale/zh_CN": "https://esm.d8d.fun/antd@5.24.5/locale/zh_CN?standalone&deps=react@19.0.0,react-dom@19.0.0",
|
||||
"@ant-design/icons": "https://esm.d8d.fun/@ant-design/icons@5.6.1?standalone&deps=react@19.0.0,react-dom@19.0.0",
|
||||
"@tanstack/react-query": "https://esm.d8d.fun/@tanstack/react-query@5.67.1?deps=react@19.0.0,react-dom@19.0.0",
|
||||
"axios": "https://esm.d8d.fun/axios@1.6.2",
|
||||
"dayjs": "https://esm.d8d.fun/dayjs@1.11.13",
|
||||
"dayjs/locale/zh-cn": "https://esm.d8d.fun/dayjs@1.11.13/locale/zh-cn",
|
||||
@@ -24,12 +16,20 @@
|
||||
"dayjs/plugin/localeData": "https://esm.d8d.fun/dayjs@1.11.13/plugin/localeData",
|
||||
"@d8d-appcontainer/types": "https://esm.d8d.fun/@d8d-appcontainer/types@3.0.47",
|
||||
"@d8d-appcontainer/api": "https://esm.d8d.fun/@d8d-appcontainer/api@3.0.47",
|
||||
"@ant-design/plots": "https://esm.d8d.fun/@ant-design/plots@2.1.13?deps=react@19.0.0,react-dom@19.0.0",
|
||||
"lodash": "https://esm.d8d.fun/lodash@4.17.21",
|
||||
"react-hook-form": "https://esm.d8d.fun/react-hook-form@7.55.0?deps=react@19.0.0,react-dom@19.0.0",
|
||||
"@heroicons/react/24/outline": "https://esm.d8d.fun/@heroicons/react@2.1.1/24/outline?deps=react@19.0.0,react-dom@19.0.0",
|
||||
"@heroicons/react/24/solid": "https://esm.d8d.fun/@heroicons/react@2.1.1/24/solid?deps=react@19.0.0,react-dom@19.0.0"
|
||||
|
||||
"react": "https://esm.d8d.fun/react@19.0.0?dev",
|
||||
"react-dom": "https://esm.d8d.fun/react-dom@19.0.0?dev",
|
||||
"react-dom/client": "https://esm.d8d.fun/react-dom@19.0.0/client?dev",
|
||||
"react-router": "https://esm.d8d.fun/react-router@7.3.0?dev&deps=react@19.0.0,react-dom@19.0.0",
|
||||
"antd": "https://esm.d8d.fun/antd@5.24.5?dev&standalone&deps=react@19.0.0,react-dom@19.0.0",
|
||||
"antd/locale/zh_CN": "https://esm.d8d.fun/antd@5.24.5/locale/zh_CN?dev&standalone&deps=react@19.0.0,react-dom@19.0.0",
|
||||
"@ant-design/icons": "https://esm.d8d.fun/@ant-design/icons@5.6.1?dev&standalone&deps=react@19.0.0,react-dom@19.0.0",
|
||||
"@tanstack/react-query": "https://esm.d8d.fun/@tanstack/react-query@5.67.1?dev&deps=react@19.0.0,react-dom@19.0.0",
|
||||
"@ant-design/plots": "https://esm.d8d.fun/@ant-design/plots@2.1.13?dev&deps=react@19.0.0,react-dom@19.0.0",
|
||||
"react-hook-form": "https://esm.d8d.fun/react-hook-form@7.55.0?dev&deps=react@19.0.0,react-dom@19.0.0",
|
||||
"@heroicons/react/24/outline": "https://esm.d8d.fun/@heroicons/react@2.1.1/24/outline?dev&deps=react@19.0.0,react-dom@19.0.0",
|
||||
"@heroicons/react/24/solid": "https://esm.d8d.fun/@heroicons/react@2.1.1/24/solid?dev&deps=react@19.0.0,react-dom@19.0.0",
|
||||
"@testing-library/react": "https://esm.d8d.fun/@testing-library/react@16.3.0?dev&deps=react@19.0.0,react-dom@19.0.0"
|
||||
},
|
||||
"compilerOptions": {
|
||||
"lib": ["dom", "dom.iterable", "esnext", "deno.ns"]
|
||||
|
||||
Reference in New Issue
Block a user