From 3c922da4e89b037f922c180853c60f90d89e63a5 Mon Sep 17 00:00:00 2001 From: Matthew Thornton <44626690+ThorntonMatthewD@users.noreply.github.com> Date: Sat, 7 Oct 2023 23:42:20 -0400 Subject: [PATCH 1/2] Add attribution control banner --- cypress/e2e/map.cy.ts | 15 +++++++++++++++ src/@vue-leaflet/vue-leaflet.d.ts | 1 + src/components/MainMap.vue | 16 ++++++++++++++-- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/map.cy.ts b/cypress/e2e/map.cy.ts index 751d2fc..89fcb4d 100644 --- a/cypress/e2e/map.cy.ts +++ b/cypress/e2e/map.cy.ts @@ -95,4 +95,19 @@ describe("Map", () => { cy.url().should("not.contain", "lng=-82.401078"); }); + + it.only("Attribution control displays the proper message and link", () => { + loadMap("/"); + + cy.get(".leaflet-control-attribution").contains( + "Brought to you by HackGreenville Labs. Click here to contribute!" + ); + + // Get contribution link and ensure that the URL is as expected + cy.get( + ".leaflet-control-container > div.leaflet-bottom.leaflet-right > div > a:nth-child(2)" + ) + .should("have.attr", "href") + .and("match", /https:\/\/data.openupstate.org\/contribute/); + }); }); diff --git a/src/@vue-leaflet/vue-leaflet.d.ts b/src/@vue-leaflet/vue-leaflet.d.ts index 98bd856..210c253 100644 --- a/src/@vue-leaflet/vue-leaflet.d.ts +++ b/src/@vue-leaflet/vue-leaflet.d.ts @@ -2,4 +2,5 @@ declare module "@vue-leaflet/vue-leaflet" { import type { DefineComponent } from "vue"; export const LMap: DefineComponent; export const LTileLayer: DefineComponent; + export const LControlAttribution: DefineComponent; } diff --git a/src/components/MainMap.vue b/src/components/MainMap.vue index 7972ec8..2a143b3 100644 --- a/src/components/MainMap.vue +++ b/src/components/MainMap.vue @@ -5,7 +5,11 @@ import type { Map, GeoJSON, LayersControlEvent } from "leaflet";