refactor: 确立独立子工程架构 (backend, admin, mpuniapp) 并同步更新 AGENTS.md 规范
这个提交包含在:
@@ -0,0 +1,54 @@
|
||||
const isDom2 = process.env.UNI_APP_X_DOM2 === 'true'
|
||||
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
|
||||
const isAndroid = platformInfo.startsWith('android')
|
||||
const isIos = platformInfo.startsWith('ios')
|
||||
const isHarmony = platformInfo.startsWith('harmony')
|
||||
const isApp = isAndroid || isIos || isHarmony
|
||||
|
||||
describe('/pages/CSS/selector/selector.uvue', () => {
|
||||
if (!isApp) {
|
||||
it('skip non-app platform', () => {
|
||||
expect(1).toBe(1)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (!isDom2) {
|
||||
it('skip non-dom2', () => {
|
||||
expect(1).toBe(1)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
let page
|
||||
|
||||
beforeAll(async () => {
|
||||
page = await program.reLaunch('/pages/CSS/selector/selector')
|
||||
await page.waitFor('view')
|
||||
})
|
||||
|
||||
const expectPagePadding = async (expectedPadding) => {
|
||||
const pageElement = await page.$('page')
|
||||
expect(pageElement).toBeTruthy()
|
||||
|
||||
const paddingTop = await pageElement.style('padding-top')
|
||||
const paddingRight = await pageElement.style('padding-right')
|
||||
const paddingBottom = await pageElement.style('padding-bottom')
|
||||
const paddingLeft = await pageElement.style('padding-left')
|
||||
expect([expectedPadding]).toContain(paddingTop)
|
||||
expect([expectedPadding]).toContain(paddingRight)
|
||||
expect([expectedPadding]).toContain(paddingBottom)
|
||||
expect([expectedPadding]).toContain(paddingLeft)
|
||||
}
|
||||
|
||||
it('get page node padding from css variable', async () => {
|
||||
await expectPagePadding('16px')
|
||||
})
|
||||
|
||||
it('change page node padding from css variable', async () => {
|
||||
const button = await page.$('#setPagePaddingButton')
|
||||
await button.tap()
|
||||
await page.waitFor(500)
|
||||
await expectPagePadding('20px')
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,25 @@
|
||||
<template>
|
||||
<view>
|
||||
默认通过page选择器设置padding: 16px
|
||||
<!-- WEB 和 MP-WEIXIN 暂不支持动态修改 page 的 style,因此不展示切换按钮 -->
|
||||
<!-- #ifndef WEB || MP-WEIXIN -->
|
||||
<button id="setPagePaddingButton" @tap="setPagePadding">切换page padding为20px</button>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
// #ifndef WEB || MP-WEIXIN
|
||||
const setPagePadding = () => {
|
||||
const pages = getCurrentPages()
|
||||
pages[pages.length - 1].querySelector('page')?.style.setProperty('padding', 'var(--page-padding-change)')
|
||||
}
|
||||
// #endif
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
--page-padding-change: 20px;
|
||||
padding: var(--page-padding);
|
||||
}
|
||||
</style>
|
||||
在新工单中引用
屏蔽一个用户