Skip to content

Commit

Permalink
Add pmtiles source test
Browse files Browse the repository at this point in the history
  • Loading branch information
pka committed Dec 28, 2024
1 parent 06369bd commit 59acd1b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cypress/e2e/modals.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,20 @@ describe("modals", () => {
});
});

it("add new pmtiles source", () => {
let sourceId = "pmtilestest";
when.setValue("modal:sources.add.source_id", sourceId);
when.select("modal:sources.add.source_type", "pmtiles_vector");
when.setValue("modal:sources.add.source_url", "https://pmtiles.io/stamen_toner(raster)CC-BY+ODbL_z3.pmtiles");
when.click("modal:sources.add.add_source");
when.wait(200);
then(
get.styleFromLocalStorage().then((style) => style.sources[sourceId])
).shouldInclude({
url: "pmtiles://https://pmtiles.io/stamen_toner(raster)CC-BY+ODbL_z3.pmtiles",
});
});

it("add new raster source", () => {
let sourceId = "rastertest";
when.setValue("modal:sources.add.source_id", sourceId);
Expand Down
1 change: 1 addition & 0 deletions src/components/ModalSourcesTypeEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ class PMTilesSourceEditor extends React.Component<PMTilesSourceEditorProps> {
label={t("PMTiles URL")}
fieldSpec={latest.source_vector.url}
value={this.props.source.url}
data-wd-key="modal:sources.add.source_url"
onChange={(url: string) => this.props.onChange({
...this.props.source,
url: url.startsWith("pmtiles://") ? url : `pmtiles://${url}`
Expand Down

0 comments on commit 59acd1b

Please sign in to comment.