Files
order_site/apps/frontend/tests/consignment-price-with-diff-layout.test.ts
T

17 lines
805 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import assert from 'node:assert/strict'
import { readFile } from 'node:fs/promises'
import test from 'node:test'
test('售价与差价分两行展示,差价完整不折行', async () => {
const source = await readFile(
new URL('../src/components/admin/ConsignmentPriceWithDiff.tsx', import.meta.url),
'utf8',
)
// PercentTable 会把列宽归一化成百分比,单行放不下时会把「(+¥」拆开,必须显式分行。
assert.ok(source.includes("flexDirection: 'column'"), '售价与差价必须垂直排列')
assert.ok(source.includes("whiteSpace: 'nowrap'"), '售价与差价都必须禁止折行')
assert.ok(source.includes('fontSize: 12'), '差价字号应小于售价')
assert.ok(!source.includes('({diff.text})'), '差价不再使用全角括号包裹')
})