Files
BoosAPI/desktop/libs/markstream-vue/test/markstream-angular-paragraph-media-only.test.ts
T
boos e0a5f57793 feat(desktop): embed BoosAPI Desktop client as a subproject
Vendor the rebranded BoosAPI Desktop client (Tauri + Vue) into metapi as
a monorepo subdirectory under desktop/. Source only — node_modules,
dist, Cargo target and the upstream .git history are excluded.

desktop/ keeps its own independent Cargo workspace (desktop/src-tauri
with crates/*); it is not part of the backend boosapi crate, so a
`cargo check` at the metapi root still compiles only the backend. Build
the desktop app from desktop/src-tauri per desktop/README.md.

Note: app icons are still placeholder assets pending the final BoosAPI
logo. The updater signing keys live outside the repo and are not
included.
2026-06-22 11:32:57 +08:00

64 lines
1.9 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import {
isMediaOnlyParagraphNodes,
normalizeMediaOnlyParagraphNodes,
splitParagraphChildren,
} from '../packages/markstream-angular/src/components/shared/node-helpers'
describe('markstream-angular paragraph media-only links', () => {
it('keeps image links in the same inline segment and normalizes separator whitespace', () => {
const children = [
{
type: 'link',
href: 'https://www.npmjs.com/package/markstream-vue',
title: null,
text: 'NPM version',
raw: '',
children: [
{
type: 'image',
src: 'https://img.shields.io/npm/v/markstream-vue?color=a1b858&label=',
alt: 'NPM version',
title: 'NPM version',
raw: '',
},
],
},
{
type: 'text',
content: '\n',
raw: '\n',
},
{
type: 'link',
href: 'README.zh-CN.md',
title: null,
text: '中文版',
raw: '',
children: [
{
type: 'image',
src: 'https://img.shields.io/badge/docs-中文文档-blue',
alt: '中文版',
title: '中文版',
raw: '',
},
],
},
] as any[]
const segments = splitParagraphChildren(children as any)
expect(segments).toHaveLength(1)
expect(segments[0]).toMatchObject({ kind: 'inline' })
const inlineNodes = (segments[0] as any).nodes
expect(isMediaOnlyParagraphNodes(inlineNodes)).toBe(true)
const normalized = normalizeMediaOnlyParagraphNodes(inlineNodes)
expect(normalized.map(node => node.type)).toEqual(['link', 'text', 'link'])
expect((normalized[1] as any).content).toBe(' ')
expect(((normalized[0] as any).children[0] as any).type).toBe('image')
expect(((normalized[2] as any).children[0] as any).type).toBe('image')
})
})