Skip to content

Commit

Permalink
fix(print): footer bar panel visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
tonio committed Dec 20, 2024
1 parent 112fa65 commit 92e92b3
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 6 deletions.
16 changes: 16 additions & 0 deletions cypress/e2e/footer-bar.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,20 @@ describe('Footer bar', () => {
})
})
})

describe('Print button', () => {
describe('When opening print panel', () => {
it('opens the print panel', () => {
cy.get('[data-cy="printPanel"]').should('not.exist')
cy.get('button[data-cy="printButton"]').click()
cy.get('[data-cy="printPanel"]').should('exist')
})

it('Other panels are closed', () => {
cy.get('[data-cy="styleSelector"]').should('not.exist')
cy.get('[data-cy="myMapsPanel"]').should('not.exist')
cy.get('[data-cy="infoPanel"]').should('be.hidden')
})
})
})
})
20 changes: 18 additions & 2 deletions src/components/footer/footer-bar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,24 @@ function onClickLayersIcon() {
themeGridOpen.value = false
}
watch(drawToolbarOpen, isOpen => isOpen && (measureToolbarOpen.value = false))
watch(measureToolbarOpen, isOpen => isOpen && (drawToolbarOpen.value = false))
watch(drawToolbarOpen, isOpen => {
if (isOpen) {
measureToolbarOpen.value = false
printToolbarOpen.value = false
}
})
watch(measureToolbarOpen, isOpen => {
if (isOpen) {
drawToolbarOpen.value = false
printToolbarOpen.value = false
}
})
watch(printToolbarOpen, isOpen => {
if (isOpen) {
drawToolbarOpen.value = false
measureToolbarOpen.value = false
}
})
const featureInfoStore = useFeatureInfoStore()
const { displayStarOnMobile } = storeToRefs(featureInfoStore)
Expand Down
30 changes: 30 additions & 0 deletions src/services/print.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,34 @@ describe('PrintService', () => {
downloadURL: `${BASE_URL}/printproxy/download`,
})
})

it('should return correct legends', async () => {
const mockLayer = {
get: vi.fn().mockImplementation((key: string) => {
if (key === 'metadata') {
return {
legend_name: 'Test Legend',
max_dpi: '300',
}
}
if (key === 'queryable_id') {
return 'test-id'
}
if (key === 'label') {
return 'Test Label'
}
}),
}

const legends = await printService.getLegends([mockLayer as any], 'en')
expect(legends).toEqual([
{ name: 'Test Legend' },
{
name: 'Test Label',
restUrl:
'https://migration.geoportail.lu/legends/get_html?lang=en&id=test-id&dpi=127&legend_title=Test Label',
legendTitle: 'Test Label',
},
])
})
})
4 changes: 0 additions & 4 deletions src/stores/app.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ export const useAppStore = defineStore(

function togglePrintToolbarOpen(open?: boolean) {
printToolbarOpen.value = open ?? !printToolbarOpen.value
if (printToolbarOpen.value) {
drawToolbarOpen.value = false
myMapsOpen.value = false
}
}

return {
Expand Down

0 comments on commit 92e92b3

Please sign in to comment.