diff --git a/src/components/space/carto/Map.js b/src/components/space/carto/Map.js
index eaf6a9c..a7012e8 100644
--- a/src/components/space/carto/Map.js
+++ b/src/components/space/carto/Map.js
@@ -573,7 +573,7 @@ function mapStateToProps(state) {
},
},
ui: {
- tiles: state.ui.tiles.current,
+ tiles: selectors.getTiles(state),
dom: state.ui.dom,
narratives: state.ui.style.narratives,
mapSelectedEvents: state.ui.style.selectedEvents,
diff --git a/src/components/space/carto/atoms/__tests__/SatelliteOverlayToggle.spec.js b/src/components/space/carto/atoms/__tests__/SatelliteOverlayToggle.spec.js
new file mode 100644
index 0000000..6dae582
--- /dev/null
+++ b/src/components/space/carto/atoms/__tests__/SatelliteOverlayToggle.spec.js
@@ -0,0 +1,56 @@
+import React from "react";
+import { fireEvent, render, screen } from "@testing-library/react";
+import SatelliteOverlayToggle from "../SatelliteOverlayToggle";
+import "@testing-library/jest-dom";
+
+describe("", () => {
+ it("disables the currently selected default option", () => {
+ render(
+
+ );
+ expect(
+ screen.getByRole("button", { name: /satellite/i })
+ ).not.toBeDisabled();
+ expect(screen.getByRole("button", { name: /default/i })).toBeDisabled();
+ });
+
+ it("disables the currently selected satellite option", () => {
+ render(
+
+ );
+ expect(screen.getByRole("button", { name: /satellite/i })).toBeDisabled();
+ expect(screen.getByRole("button", { name: /default/i })).not.toBeDisabled();
+ });
+
+ it("calls the reset function when switching to the default overlay", () => {
+ const mockReset = jest.fn();
+ const mockSat = jest.fn();
+ render(
+
+ );
+ const btn = screen.getByRole("button", { name: /default/i });
+ fireEvent.click(btn);
+ expect(mockReset).toHaveBeenCalledTimes(1);
+ expect(mockSat).not.toHaveBeenCalled();
+ });
+
+ it("calls the switchToSatellite function when switching to the satellite overlay", () => {
+ const mockReset = jest.fn();
+ const mockSat = jest.fn();
+ render(
+
+ );
+ const btn = screen.getByRole("button", { name: /satellite/i });
+ fireEvent.click(btn);
+ expect(mockSat).toHaveBeenCalledTimes(1);
+ expect(mockReset).not.toHaveBeenCalled();
+ });
+});
diff --git a/src/reducers/__tests__/ui.spec.js b/src/reducers/__tests__/ui.spec.js
new file mode 100644
index 0000000..c2e2d20
--- /dev/null
+++ b/src/reducers/__tests__/ui.spec.js
@@ -0,0 +1,23 @@
+import { useSatelliteTilesOverlay, resetTilesOverlay } from "../../actions";
+import initial from "../../store/initial.js";
+import ui from "../ui";
+
+describe("UI reducer", () => {
+ it("can change the tiling", () => {
+ const result = ui(initial.ui, useSatelliteTilesOverlay());
+ expect(result.tiles.current).toEqual("satellite");
+ expect(result.tiles.default).toEqual(initial.ui.tiles.default);
+ });
+
+ it("can revert to the default tiling", () => {
+ const result = ui(
+ {
+ ...initial.ui,
+ tiles: { default: "some default", current: "something else" },
+ },
+ resetTilesOverlay()
+ );
+ expect(result.tiles.current).toEqual("some default");
+ expect(result.tiles.default).toEqual("some default");
+ });
+});
diff --git a/src/selectors/index.js b/src/selectors/index.js
index 63ea94a..61c1e93 100644
--- a/src/selectors/index.js
+++ b/src/selectors/index.js
@@ -39,6 +39,7 @@ export const getTimelineDimensions = (state) => state.app.timeline.dimensions;
export const selectNarrative = (state) => state.app.associations.narrative;
export const getFeatures = (state) => state.features;
export const getEventRadius = (state) => state.ui.eventRadius;
+export const getTiles = (state) => state.ui.tiles.current;
export const selectSites = createSelector(
[getSites, getFeatures],