@@ -158,7 +158,6 @@ export const POI_CATEGORIES = Object.freeze(
|
|||||||
)
|
)
|
||||||
|
|
||||||
const homeCategoryOrder: readonly PoiCategoryId[] = [
|
const homeCategoryOrder: readonly PoiCategoryId[] = [
|
||||||
'itinerary',
|
|
||||||
'exhibition-hall',
|
'exhibition-hall',
|
||||||
'cinema',
|
'cinema',
|
||||||
'restroom',
|
'restroom',
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ describe('POI 搜索面板实际渲染与状态闭环', () => {
|
|||||||
expect(wrapper.find('.voice-icon').exists()).toBe(false)
|
expect(wrapper.find('.voice-icon').exists()).toBe(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('首页收缩和展开复用同一份十项快捷入口,搜索页保留完整分类', async () => {
|
it('首页收缩和展开复用同一份九项快捷入口,搜索页保留完整分类', async () => {
|
||||||
const escalatorPoi = createPoi('escalator-1', '自动扶梯', 'floor-1', '1F', 'escalator', [5, 0, 5])
|
const escalatorPoi = createPoi('escalator-1', '自动扶梯', 'floor-1', '1F', 'escalator', [5, 0, 5])
|
||||||
guideMocks.getInitialSearchSpacePoints.mockResolvedValue([...poiPool, escalatorPoi])
|
guideMocks.getInitialSearchSpacePoints.mockResolvedValue([...poiPool, escalatorPoi])
|
||||||
const homeWrapper = mount(PoiSearchPanel, {
|
const homeWrapper = mount(PoiSearchPanel, {
|
||||||
@@ -116,13 +116,13 @@ describe('POI 搜索面板实际渲染与状态闭环', () => {
|
|||||||
await flushMountedSearch()
|
await flushMountedSearch()
|
||||||
|
|
||||||
const homeCategories = homeWrapper.findAll('.home-category-chip')
|
const homeCategories = homeWrapper.findAll('.home-category-chip')
|
||||||
expect(homeCategories).toHaveLength(10)
|
expect(homeCategories).toHaveLength(9)
|
||||||
expect(homeCategories.map((item) => item.text())).toEqual([
|
expect(homeCategories.map((item) => item.text())).toEqual([
|
||||||
'行程', '展览', '影院', '洗手间', '餐厅',
|
'展览', '影院', '洗手间', '餐厅', '售票处',
|
||||||
'售票处', '母婴室', '服务中心', '电梯', '扶梯'
|
'母婴室', '服务中心', '电梯', '扶梯'
|
||||||
])
|
])
|
||||||
expect(homeCategories.slice(0, 5).map((item) => item.text())).toEqual([
|
expect(homeCategories.slice(0, 5).map((item) => item.text())).toEqual([
|
||||||
'行程', '展览', '影院', '洗手间', '餐厅'
|
'展览', '影院', '洗手间', '餐厅', '售票处'
|
||||||
])
|
])
|
||||||
homeCategories.forEach((item) => {
|
homeCategories.forEach((item) => {
|
||||||
expect(item.find('.poi-category-icon').exists()).toBe(true)
|
expect(item.find('.poi-category-icon').exists()).toBe(true)
|
||||||
@@ -139,10 +139,10 @@ describe('POI 搜索面板实际渲染与状态闭环', () => {
|
|||||||
await homeWrapper.get('.search-box').trigger('tap')
|
await homeWrapper.get('.search-box').trigger('tap')
|
||||||
await flushMountedSearch()
|
await flushMountedSearch()
|
||||||
const expandedCategories = homeWrapper.findAll('.home-shortcut-grid .category-item')
|
const expandedCategories = homeWrapper.findAll('.home-shortcut-grid .category-item')
|
||||||
expect(expandedCategories).toHaveLength(10)
|
expect(expandedCategories).toHaveLength(9)
|
||||||
expect(expandedCategories.map((item) => item.text())).toEqual([
|
expect(expandedCategories.map((item) => item.text())).toEqual([
|
||||||
'行程', '展览', '影院', '洗手间', '餐厅',
|
'展览', '影院', '洗手间', '餐厅', '售票处',
|
||||||
'售票处', '母婴室', '服务中心', '电梯', '扶梯'
|
'母婴室', '服务中心', '电梯', '扶梯'
|
||||||
])
|
])
|
||||||
expect(expandedCategories.slice(0, 5).map((item) => item.text()))
|
expect(expandedCategories.slice(0, 5).map((item) => item.text()))
|
||||||
.toEqual(homeCategories.slice(0, 5).map((item) => item.text()))
|
.toEqual(homeCategories.slice(0, 5).map((item) => item.text()))
|
||||||
@@ -295,7 +295,7 @@ describe('POI 搜索面板实际渲染与状态闭环', () => {
|
|||||||
|
|
||||||
expect(wrapper.find('[data-testid="poi-home-category-results"]').exists()).toBe(false)
|
expect(wrapper.find('[data-testid="poi-home-category-results"]').exists()).toBe(false)
|
||||||
expect(wrapper.find('.poi-search-content').exists()).toBe(false)
|
expect(wrapper.find('.poi-search-content').exists()).toBe(false)
|
||||||
expect(wrapper.findAll('.home-category-chip')).toHaveLength(10)
|
expect(wrapper.findAll('.home-category-chip')).toHaveLength(9)
|
||||||
expect(wrapper.findAll('.home-category-chip.active')).toHaveLength(0)
|
expect(wrapper.findAll('.home-category-chip.active')).toHaveLength(0)
|
||||||
expect((wrapper.get('.search-input').element as HTMLInputElement).value).toBe('')
|
expect((wrapper.get('.search-input').element as HTMLInputElement).value).toBe('')
|
||||||
expect((wrapper.emitted('results-change') || []).at(-1)?.[0]).toMatchObject({
|
expect((wrapper.emitted('results-change') || []).at(-1)?.[0]).toMatchObject({
|
||||||
|
|||||||
Reference in New Issue
Block a user