18 lines
742 B
TypeScript
18 lines
742 B
TypeScript
|
|
import assert from 'node:assert/strict'
|
||
|
|
import {readFileSync} from 'node:fs'
|
||
|
|
import test from 'node:test'
|
||
|
|
|
||
|
|
const common=readFileSync(new URL('../src/Common.tsx',import.meta.url),'utf8')
|
||
|
|
const styles=readFileSync(new URL('../src/styles.css',import.meta.url),'utf8')
|
||
|
|
|
||
|
|
test('inline chat images load eagerly inside the iOS scroll container',()=>{
|
||
|
|
assert.match(common,/className="markdown-image"[\s\S]*loading="eager"/)
|
||
|
|
assert.doesNotMatch(common,/className="markdown-image"[\s\S]*loading="lazy"/)
|
||
|
|
})
|
||
|
|
|
||
|
|
test('inline chat images reserve a visible panoramic area before decoding',()=>{
|
||
|
|
const rule=styles.match(/\.markdown-image>img\{([^}]*)\}/)?.[1]||''
|
||
|
|
assert.match(rule,/aspect-ratio:auto 16\/9/)
|
||
|
|
assert.match(rule,/min-height:160px/)
|
||
|
|
})
|