Moved back to data-wd-key approach and fixed tests

This commit is contained in:
orangemug
2019-05-21 19:07:28 +01:00
parent 911549aca3
commit 1fec89b69e
4 changed files with 10 additions and 15 deletions

View File

@@ -108,13 +108,6 @@ class NumberInput extends React.Component {
}
render() {
let wdProps = {};
if (this.props.wdKey) {
wdProps = {
"data-wd-key": this.props.wdKey
};
}
if(
this.props.hasOwnProperty("min") && this.props.hasOwnProperty("max") &&
this.props.min !== undefined && this.props.max !== undefined &&
@@ -146,6 +139,7 @@ class NumberInput extends React.Component {
/>
<input
key="text"
type="text"
spellCheck="false"
className="maputnik-number"
placeholder={this.props.default}
@@ -154,7 +148,6 @@ class NumberInput extends React.Component {
this.changeValue(e.target.value)
}}
onBlur={this.resetValue}
{...wdProps}
/>
</div>
}
@@ -162,13 +155,13 @@ class NumberInput extends React.Component {
return <div className="maputnik-number-container">
<input
key="text"
type="text"
spellCheck="false"
className="maputnik-number"
placeholder={this.props.default}
value={this.state.value}
onChange={e => this.changeValue(e.target.value)}
onBlur={this.resetValue}
{...wdProps}
/>
</div>
}

View File

@@ -12,9 +12,10 @@ class MaxZoomBlock extends React.Component {
}
render() {
return <InputBlock label={"Max Zoom"} doc={latest.layer.maxzoom.doc}>
return <InputBlock label={"Max Zoom"} doc={latest.layer.maxzoom.doc}
data-wd-key="max-zoom"
>
<NumberInput
wdKey="max-zoom"
allowRange={true}
value={this.props.value}
onChange={this.props.onChange}

View File

@@ -12,9 +12,10 @@ class MinZoomBlock extends React.Component {
}
render() {
return <InputBlock label={"Min Zoom"} doc={latest.layer.minzoom.doc}>
return <InputBlock label={"Min Zoom"} doc={latest.layer.minzoom.doc}
data-wd-key="min-zoom"
>
<NumberInput
wdKey="min-zoom"
allowRange={true}
value={this.props.value}
onChange={this.props.onChange}