mirror of
https://github.com/maputnik/editor.git
synced 2026-07-02 20:17:30 +00:00
Add a test that adds a source
This commit is contained in:
@@ -61,9 +61,27 @@ describe("modals", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("sources", () => {
|
describe("sources", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
when.setStyle("layer");
|
||||||
|
when.click("nav:sources");
|
||||||
|
});
|
||||||
|
|
||||||
it("active sources");
|
it("active sources");
|
||||||
it("public source");
|
it("public source");
|
||||||
it("add new source");
|
|
||||||
|
it("add new source", () => {
|
||||||
|
let sourceId = "n1z2v3r";
|
||||||
|
when.setValue("modal:sources.add.source_id", sourceId);
|
||||||
|
when.select("modal:sources.add.source_type", "tile_vector");
|
||||||
|
when.select("modal:sources.add.scheme_type", "tms");
|
||||||
|
when.click("modal:sources.add.add_source");
|
||||||
|
when.wait(200);
|
||||||
|
then(
|
||||||
|
get.styleFromLocalStorage().then((style) => style.sources[sourceId])
|
||||||
|
).shouldInclude({
|
||||||
|
scheme: "tms",
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("inspect", () => {
|
describe("inspect", () => {
|
||||||
|
|||||||
@@ -224,6 +224,7 @@ class AddSource extends React.Component<AddSourceProps, AddSourceState> {
|
|||||||
fieldSpec={{doc: t("Unique ID that identifies the source and is used in the layer to reference the source.")}}
|
fieldSpec={{doc: t("Unique ID that identifies the source and is used in the layer to reference the source.")}}
|
||||||
value={this.state.sourceId}
|
value={this.state.sourceId}
|
||||||
onChange={(v: string) => this.setState({ sourceId: v})}
|
onChange={(v: string) => this.setState({ sourceId: v})}
|
||||||
|
data-wd-key="modal:sources.add.source_id"
|
||||||
/>
|
/>
|
||||||
<FieldSelect
|
<FieldSelect
|
||||||
label={t("Source Type")}
|
label={t("Source Type")}
|
||||||
@@ -242,6 +243,7 @@ class AddSource extends React.Component<AddSourceProps, AddSourceState> {
|
|||||||
]}
|
]}
|
||||||
onChange={mode => this.setState({mode: mode as EditorMode, source: this.defaultSource(mode as EditorMode)})}
|
onChange={mode => this.setState({mode: mode as EditorMode, source: this.defaultSource(mode as EditorMode)})}
|
||||||
value={this.state.mode as string}
|
value={this.state.mode as string}
|
||||||
|
data-wd-key="modal:sources.add.source_type"
|
||||||
/>
|
/>
|
||||||
<ModalSourcesTypeEditor
|
<ModalSourcesTypeEditor
|
||||||
onChange={this.onChangeSource}
|
onChange={this.onChangeSource}
|
||||||
@@ -251,6 +253,7 @@ class AddSource extends React.Component<AddSourceProps, AddSourceState> {
|
|||||||
<InputButton
|
<InputButton
|
||||||
className="maputnik-add-source-button"
|
className="maputnik-add-source-button"
|
||||||
onClick={this.onAdd}
|
onClick={this.onAdd}
|
||||||
|
data-wd-key="modal:sources.add.add_source"
|
||||||
>
|
>
|
||||||
{t("Add Source")}
|
{t("Add Source")}
|
||||||
</InputButton>
|
</InputButton>
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ class TileURLSourceEditor extends React.Component<TileURLSourceEditorProps> {
|
|||||||
scheme
|
scheme
|
||||||
})}
|
})}
|
||||||
value={this.props.source.scheme}
|
value={this.props.source.scheme}
|
||||||
|
data-wd-key="modal:sources.add.scheme_type"
|
||||||
/>
|
/>
|
||||||
<FieldNumber
|
<FieldNumber
|
||||||
label={t("Min Zoom")}
|
label={t("Min Zoom")}
|
||||||
|
|||||||
Reference in New Issue
Block a user