修改完成
This commit is contained in:
@@ -38,27 +38,17 @@ const run = async () => {
|
||||
}
|
||||
await sleep(500)
|
||||
const layers = await valueOf(`Array.from(document.querySelectorAll('.person-identity-card,.person-field,.person-long-field')).map((node) => {
|
||||
const skin = node.querySelector('.person-card-skin')
|
||||
const image = skin?.querySelector('img')
|
||||
const cardRect = node.getBoundingClientRect()
|
||||
const skinRect = skin?.getBoundingClientRect()
|
||||
return {
|
||||
className: node.className,
|
||||
hasSkin: Boolean(skin),
|
||||
complete: image?.complete,
|
||||
naturalWidth: image?.naturalWidth,
|
||||
position: skin ? getComputedStyle(skin).position : '',
|
||||
widthDelta: skinRect ? Math.abs(cardRect.width - skinRect.width) : 999,
|
||||
heightDelta: skinRect ? Math.abs(cardRect.height - skinRect.height) : 999
|
||||
backgroundImage: getComputedStyle(node).backgroundImage,
|
||||
position: getComputedStyle(node).position
|
||||
}
|
||||
})`)
|
||||
assert(layers.length >= 6, 'R02 edit cards were not rendered')
|
||||
for (const layer of layers) {
|
||||
assert.strictEqual(layer.hasSkin, true, `${layer.className} decorative skin is missing`)
|
||||
assert.strictEqual(layer.complete, true, `${layer.className} decorative skin did not load`)
|
||||
assert(layer.naturalWidth > 0, `${layer.className} decorative skin has no source pixels`)
|
||||
assert.strictEqual(layer.position, 'absolute', `${layer.className} decorative skin is not a local absolute layer`)
|
||||
assert(layer.widthDelta <= 1 && layer.heightDelta <= 1, `${layer.className} decorative skin does not cover its card`)
|
||||
const expectedAsset = layer.className.includes('person-identity-card') ? 'r01-person-name-card.png' : layer.className.includes('person-field') ? 'module-field-frame.png' : 'module-content-frame.png'
|
||||
assert(layer.backgroundImage.includes(expectedAsset), `${layer.className} does not use its real background asset`)
|
||||
assert.strictEqual(layer.position, 'static', `${layer.className} must remain in document flow`)
|
||||
}
|
||||
process.stdout.write(`${JSON.stringify(layers)}\nR02-BACKGROUND-RUNTIME-SMOKE PASS\n`)
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user