mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-10 20:55:59 +08:00
feat(ui): show plugin version on brand hover
This commit is contained in:
parent
7211534aef
commit
b42fc411c2
5 changed files with 173 additions and 7 deletions
|
|
@ -7,6 +7,7 @@ import { renderToStaticMarkup } from 'react-dom/server';
|
|||
|
||||
import {
|
||||
apply as applyClient,
|
||||
IM_PLUGIN_VERSION,
|
||||
IMSettingsTab,
|
||||
inject as clientInject,
|
||||
} from '../plugin-src/client/index.js';
|
||||
|
|
@ -98,6 +99,10 @@ const QQ_SOURCE_URL = new URL(
|
|||
);
|
||||
|
||||
test('IM settings renders nine IM channels plus the AI Office connector', async () => {
|
||||
const { default: packageMetadata } = await import('../package.json', {
|
||||
with: { type: 'json' },
|
||||
});
|
||||
const { version: packageVersion } = packageMetadata;
|
||||
const styles = await readFile(STYLES_URL, 'utf8');
|
||||
const markup = renderToStaticMarkup(React.createElement(IMSettingsTab, {
|
||||
feishuRpcCall: async () => ({ ok: true, value: {} }),
|
||||
|
|
@ -115,7 +120,12 @@ test('IM settings renders nine IM channels plus the AI Office connector', async
|
|||
assert.match(markup, /IM机器人/);
|
||||
assert.match(markup, /让 DeepSeek Harness 触手可及/);
|
||||
assert.match(markup, /class="dim-brand"/);
|
||||
assert.equal(IM_PLUGIN_VERSION, packageVersion);
|
||||
assert.match(markup, /class="dim-brand" tabindex="0" aria-describedby="[^"]+"/);
|
||||
assert.match(markup, /<strong class="dim-brandName">DSH-IM<\/strong>/);
|
||||
assert.match(markup, new RegExp(
|
||||
`class="dim-versionTooltip" role="tooltip"><span>当前版本<\\/span><strong>v${packageVersion.replaceAll('.', '\\.')}`,
|
||||
));
|
||||
assert.doesNotMatch(markup, /dim-brandLogo|<img/);
|
||||
assert.match(markup, /href="https:\/\/github\.com\/xmanrui\/dsh-im"/);
|
||||
assert.match(markup, /target="_blank"/);
|
||||
|
|
@ -125,8 +135,11 @@ test('IM settings renders nine IM channels plus the AI Office connector', async
|
|||
assert.match(markup, /role="tooltip"[^>]*>帮助与反馈 · 前往 GitHub</);
|
||||
assert.match(styles, /\.dim-title \{[^}]*margin: 0 0 18px;/);
|
||||
assert.match(styles, /\.dim-title p \{[^}]*color: var\(--dsw-alias-label-secondary, #646a73\);[^}]*font-size: 12px;[^}]*font-weight: 500;/);
|
||||
assert.match(styles, /\.dim-brand \{[^}]*display: flex;[^}]*flex-direction: column;[^}]*align-items: flex-start;[^}]*gap: 1px;/);
|
||||
assert.match(styles, /\.dim-brand \{[^}]*position: relative;[^}]*display: flex;[^}]*flex-direction: column;[^}]*align-items: flex-start;[^}]*gap: 1px;[^}]*cursor: help;/);
|
||||
assert.doesNotMatch(styles, /\.dim-brand:hover\s*\{[^}]*background:/);
|
||||
assert.match(styles, /\.dim-brandName \{[^}]*font-size: 20px;[^}]*font-weight: 800;[^}]*letter-spacing: \.04em;/);
|
||||
assert.match(styles, /\.dim-versionTooltip \{[^}]*bottom: calc\(100% \+ 8px\);[^}]*display: inline-flex;[^}]*opacity: 0;[^}]*visibility: hidden;/);
|
||||
assert.match(styles, /\.dim-brand:hover \.dim-versionTooltip, \.dim-brand:focus \.dim-versionTooltip \{[^}]*opacity: 1;[^}]*visibility: visible;/);
|
||||
assert.doesNotMatch(styles, /\.dim-brandLogo/);
|
||||
assert.match(styles, /\.dim-githubLink \{[^}]*border: 1px solid var\(--dsw-alias-border-l2, #dfe1e5\);[^}]*text-decoration: none;/);
|
||||
assert.match(styles, /\.dim-githubTooltip \{[^}]*bottom: calc\(100% \+ 8px\);[^}]*transform: translateY\(3px\);/);
|
||||
|
|
@ -724,6 +737,9 @@ test('client registers a live bilingual locale seat and directory picker for the
|
|||
injected,
|
||||
));
|
||||
assert.match(markup, /DeepSeek Harness, always within reach/);
|
||||
assert.match(markup, new RegExp(
|
||||
`<span>Current version<\\/span><strong>v${IM_PLUGIN_VERSION.replaceAll('.', '\\.')}`,
|
||||
));
|
||||
assert.match(markup, /Help & feedback · Open GitHub/);
|
||||
assert.match(markup, />WeChat<|>Feishu<|>DingTalk<|>WeCom</);
|
||||
assert.match(markup, />QQ<[^]*>Slack<[^]*>Telegram<[^]*>Discord<[^]*>WhatsApp</);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue