-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #143 from Geoportail-Luxembourg/GSLUX-709-msg
GSLUX-709: Notification messages on draw
- Loading branch information
Showing
13 changed files
with
242 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
describe('Draw notifications', () => { | ||
beforeEach(() => { | ||
cy.visit('/') | ||
cy.get('button[data-cy="drawButton"]').click() | ||
}) | ||
|
||
describe('When clicking button to draw point', () => { | ||
it('show a helper message', () => { | ||
cy.get('[data-cy="notification"]').should('not.exist') | ||
cy.get('button[data-cy="drawPointButton"]').click() | ||
cy.get('[data-cy="notification"]').should('have.length', 1) | ||
cy.get('[data-cy="notification"]').should( | ||
'have.text', | ||
'Cliquez pour placer le point' | ||
) | ||
}) | ||
}) | ||
|
||
describe('When clicking button to draw label', () => { | ||
it('show a helper message', () => { | ||
cy.get('[data-cy="notification"]').should('not.exist') | ||
cy.get('button[data-cy="drawLabelButton"]').click() | ||
cy.get('[data-cy="notification"]').should('have.length', 1) | ||
cy.get('[data-cy="notification"]').should( | ||
'have.text', | ||
"Cliquez pour placer l'étiquette" | ||
) | ||
}) | ||
}) | ||
|
||
describe('When clicking button to draw line', () => { | ||
it('show a helper message', () => { | ||
cy.get('[data-cy="notification"]').should('not.exist') | ||
cy.get('button[data-cy="drawLineButton"]').click() | ||
cy.get('[data-cy="notification"]').should('have.length', 1) | ||
cy.get('[data-cy="notification"]').should( | ||
'have.text', | ||
'Cliquez pour commencer à dessiner la ligneFaites un double-clic ou ESC pour terminer. Tapez ⌫ pour enlever le dernier point dessinéActivez la coche "suivre les routes" pour faire coller votre ligne au réseau routier existant' | ||
) | ||
}) | ||
}) | ||
|
||
describe('When clicking button to draw polygon', () => { | ||
it('show a helper message', () => { | ||
cy.get('[data-cy="notification"]').should('not.exist') | ||
cy.get('button[data-cy="drawPolygonButton"]').click() | ||
cy.get('[data-cy="notification"]').should('have.length', 1) | ||
cy.get('[data-cy="notification"]').should( | ||
'have.text', | ||
'Cliquez pour commencer à dessiner le polygoneFaites un double-clic, typez ESC ou cliquez sur le dernier point pour terminerTapez ⌫ pour enlever le dernier point dessiné' | ||
) | ||
}) | ||
}) | ||
|
||
describe('When clicking button to draw circle', () => { | ||
it('show a helper message', () => { | ||
cy.get('[data-cy="notification"]').should('not.exist') | ||
cy.get('button[data-cy="drawCircleButton"]').click() | ||
cy.get('[data-cy="notification"]').should('have.length', 1) | ||
cy.get('[data-cy="notification"]').should( | ||
'have.text', | ||
'Cliquez pour commencer à dessiner un cercle' | ||
) | ||
}) | ||
}) | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { watch } from 'vue' | ||
import { storeToRefs } from 'pinia' | ||
import { useTranslation } from 'i18next-vue' | ||
|
||
import { useAlertNotificationsStore } from '@/stores/alert-notifications.store' | ||
import { useDrawStore } from '@/stores/draw.store' | ||
import { DrawStateActive } from '@/stores/draw.store.model' | ||
|
||
export default function useDrawNotifications() { | ||
const { t } = useTranslation() | ||
const { addNotification } = useAlertNotificationsStore() | ||
const { drawStateActive } = storeToRefs(useDrawStore()) | ||
|
||
watch(drawStateActive, notify) | ||
|
||
function notify(drawStateActive: DrawStateActive) { | ||
let notification: string | undefined | ||
|
||
switch (drawStateActive) { | ||
case 'drawPoint': | ||
notification = t('Click to draw the point') | ||
break | ||
case 'drawLine': | ||
notification = t( | ||
'Click to start drawing line<br>Double-click to finish' | ||
) | ||
break | ||
case 'drawPolygon': | ||
notification = t( | ||
'Click to start drawing polygon<br>Double-click or click last point to finish' | ||
) | ||
break | ||
case 'drawCircle': | ||
notification = t('Click to start drawing circle') | ||
break | ||
case 'drawLabel': | ||
notification = t('Click to place the label') | ||
break | ||
} | ||
|
||
if (notification) { | ||
addNotification(notification) | ||
} | ||
} | ||
|
||
return {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.