activity-area-reset.test.js 845 B

1234567891011121314151617
  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 areaFile = path.resolve('components/pages/activityArea/index.vue')
  6. const allActivityFile = path.resolve('pagesHome/allActivity.vue')
  7. test('区域弹窗提供重置入口并清空活动区域筛选', () => {
  8. const areaSource = fs.readFileSync(areaFile, 'utf8')
  9. const pageSource = fs.readFileSync(allActivityFile, 'utf8')
  10. assert.match(areaSource, /class="reset-btn"[^>]*@click="handleReset"[^>]*>重置/)
  11. assert.match(areaSource, /const handleReset = \(\) => \{[\s\S]*?emit\('reset'\)/)
  12. assert.match(pageSource, /<ActivityArea @confirm="areaConfirm" @reset="areaReset"><\/ActivityArea>/)
  13. assert.match(pageSource, /const areaReset = \(\) => \{[\s\S]*?districtId = ''[\s\S]*?placeShow\.value = false/)
  14. })