mirror of
https://github.com/maputnik/editor.git
synced 2026-07-25 23:37:27 +00:00
Add pmtiles source test
This commit is contained in:
@@ -83,6 +83,21 @@ 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://data.source.coop/protomaps/openstreetmap/v4.pmtiles");
|
||||||
|
when.click("modal:sources.add.add_source");
|
||||||
|
when.wait(200);
|
||||||
|
then(
|
||||||
|
get.styleFromLocalStorage().then((style) => style.sources[sourceId])
|
||||||
|
).shouldInclude({
|
||||||
|
type: "vector",
|
||||||
|
// url: "pmtiles://https://data.source.coop/protomaps/openstreetmap/v4.pmtiles",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it("add new raster source", () => {
|
it("add new raster source", () => {
|
||||||
let sourceId = "rastertest";
|
let sourceId = "rastertest";
|
||||||
when.setValue("modal:sources.add.source_id", sourceId);
|
when.setValue("modal:sources.add.source_id", sourceId);
|
||||||
|
|||||||
@@ -302,6 +302,7 @@ class PMTilesSourceEditor extends React.Component<PMTilesSourceEditorProps> {
|
|||||||
label={t("PMTiles URL")}
|
label={t("PMTiles URL")}
|
||||||
fieldSpec={latest.source_vector.url}
|
fieldSpec={latest.source_vector.url}
|
||||||
value={this.props.source.url}
|
value={this.props.source.url}
|
||||||
|
data-wd-key="modal:sources.add.source_url"
|
||||||
onChange={(url: string) => this.props.onChange({
|
onChange={(url: string) => this.props.onChange({
|
||||||
...this.props.source,
|
...this.props.source,
|
||||||
url: url.startsWith("pmtiles://") ? url : `pmtiles://${url}`
|
url: url.startsWith("pmtiles://") ? url : `pmtiles://${url}`
|
||||||
|
|||||||
Reference in New Issue
Block a user