feat(semi-auto): 虎牙客户页登录→资料→绑定流程与返回上一步重置
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { readFile } from 'node:fs/promises'
|
||||
import test from 'node:test'
|
||||
|
||||
function source(relativePath: string) {
|
||||
return new URL(`../src/${relativePath}`, import.meta.url)
|
||||
}
|
||||
|
||||
/**
|
||||
* 半自动履约客户页是公开 H5 页面,可能被应用内浏览器、分屏或系统显示放大打开。
|
||||
* 全局 base.css 的 body { min-width:320px } + worker.css 的 overflow-x:hidden
|
||||
* 会在实际视口小于 320px 时把页面右侧直接裁掉(输入框/商品值/提示文案)。
|
||||
* 这里锁住客户页专属移动端根类和 480px 移动壳,防止以后被全局样式改回去。
|
||||
*/
|
||||
test('客户履约页必须覆盖 body 320px 最小宽度并使用 480px 移动端壳', async () => {
|
||||
const [app, css] = await Promise.all([
|
||||
readFile(source('App.tsx'), 'utf8'),
|
||||
readFile(source('styles/client.css'), 'utf8'),
|
||||
])
|
||||
|
||||
assert.match(app, /customer-mobile-html/)
|
||||
assert.match(app, /customer-mobile-body/)
|
||||
assert.match(
|
||||
css,
|
||||
/html\.customer-mobile-html,\s*body\.customer-mobile-body\s*\{[^}]*min-width:\s*0/s,
|
||||
)
|
||||
assert.match(
|
||||
css,
|
||||
/body\.customer-mobile-body \.customer-collect-body\s*\{[^}]*max-width:\s*480px/s,
|
||||
)
|
||||
assert.match(
|
||||
css,
|
||||
/body\.customer-mobile-body \.customer-auth-shell\s*\{[^}]*width:\s*min\(480px,\s*100%\)/s,
|
||||
)
|
||||
})
|
||||
|
||||
test('客户履约页固定宽度弹窗必须收进手机视口', async () => {
|
||||
const [page, huya, css] = await Promise.all([
|
||||
readFile(source('pages/customer-fulfillment/CustomerFulfillmentPage.tsx'), 'utf8'),
|
||||
readFile(source('pages/customer-fulfillment/HuyaChallengeModal.tsx'), 'utf8'),
|
||||
readFile(source('styles/client.css'), 'utf8'),
|
||||
])
|
||||
|
||||
assert.match(page, /className="customer-binding-modal"/)
|
||||
assert.match(huya, /className="customer-huya-challenge-modal"/)
|
||||
assert.match(
|
||||
css,
|
||||
/\.customer-binding-modal,\s*\.customer-huya-challenge-modal\s*\{[^}]*width:\s*calc\(100vw - 24px\)\s*!important/s,
|
||||
)
|
||||
})
|
||||
Reference in New Issue
Block a user