20 lines
1.1 KiB
TypeScript
20 lines
1.1 KiB
TypeScript
import assert from 'node:assert/strict'
|
|
import { readFileSync } from 'node:fs'
|
|
import { renderToStaticMarkup } from 'react-dom/server'
|
|
import { NativeBrowserPane } from '../src/renderer/src/workbuddy/workbench/NativeBrowserPane'
|
|
|
|
;(globalThis as any).window = { ycode: { browser: {} } }
|
|
const markup = renderToStaticMarkup(<NativeBrowserPane id="browser-fixture" sessionId="fixture" />)
|
|
assert.match(markup, /data-browser-host-id="browser-fixture"/)
|
|
assert.match(markup, /_browserToolbar_x8iy7_18 _nativeToolbar_rh4x8_319/)
|
|
assert.match(markup, /搜索或输入网址/)
|
|
assert.match(markup, /输入网址,或打开对话中的链接/)
|
|
assert.match(markup, /aria-label="后退" disabled/)
|
|
assert.match(markup, /M5\.2806 11\.9404/)
|
|
assert.match(markup, /M7\.4702 11\.9404/)
|
|
assert.match(markup, /M14\.83 7\.415/)
|
|
const css = readFileSync('src/renderer/src/workbuddy/workbench/browser-source.css', 'utf8')
|
|
assert.match(css, /\._browserToolbar_x8iy7_18\{[^}]*padding:8px 16px/)
|
|
assert.match(css, /\._browserUrl_rh4x8_10\{[^}]*height:28px/)
|
|
console.log('Native browser toolbar, disabled state, source locale/SVG and CSS contracts passed')
|