home-scroll-sticky-category.test.js 828 B

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