| 123456789101112131415161718 |
- import test from 'node:test'
- import assert from 'node:assert/strict'
- import fs from 'node:fs'
- import path from 'node:path'
- const homeFile = path.resolve('pages/home.vue')
- test('首页使用单一滚动容器并让两行活动分类吸顶', () => {
- const source = fs.readFileSync(homeFile, 'utf8')
- assert.match(source, /const TYPEGRID_PAGE_SIZE\s*=\s*8/)
- assert.match(source, /<scroll-view class="c-box adffc"[^>]*scroll-y[^>]*@scroll="handleScroll"[^>]*@scrolltolower="scrolltolower"/)
- assert.match(source, /<view class="typegrid-page[\s\S]*?flex-wrap:\s*wrap/)
- assert.match(source, /isTypeGridSticky/)
- assert.match(source, /\.is-typegrid-sticky\s*\{[\s\S]*?position:\s*fixed/)
- assert.doesNotMatch(source, /position:\s*sticky/)
- assert.doesNotMatch(source, /<up-list[\s\S]*?@scrolltolower="scrolltolower"/)
- })
|