Bläddra i källkod

Fix failing test

bubble
Kyle Shockey 6 år sedan
förälder
incheckning
5224932cf9
3 ändrade filer med 5 tillägg och 5 borttagningar
  1. +1
    -1
      src/core/components/layout-utils.jsx
  2. +2
    -2
      src/core/json-schema-components.js
  3. +2
    -2
      test/components/json-schema-form.js

+ 1
- 1
src/core/components/layout-utils.jsx Visa fil

@@ -183,7 +183,7 @@ export class Select extends React.Component {
{ allowEmptyValue ? <option value="">--</option> : null }
{
allowedValues.map(function (item, key) {
return <option key={ key } value={ String(item) }>{ item }</option>
return <option key={ key } value={ String(item) }>{ String(item) }</option>
})
}
</select>


+ 2
- 2
src/core/json-schema-components.js Visa fil

@@ -189,8 +189,8 @@ export class JsonSchema_boolean extends Component {
return (<Select className={ errors.length ? "invalid" : ""}
title={ errors.length ? errors : ""}
value={ String(value) }
allowedValues={ fromJS(["true", "false"]) }
allowEmptyValue={ true }
allowedValues={ fromJS(schema.enum || ["true", "false"]) }
allowEmptyValue={ !this.props.required }
onChange={ this.onEnumChange }/>)
}
}

+ 2
- 2
test/components/json-schema-form.js Visa fil

@@ -85,7 +85,7 @@ describe("<JsonSchemaForm/>", function(){
expect(wrapper.find("select option").eq(1).text()).toEqual("true")
expect(wrapper.find("select option").eq(2).text()).toEqual("false")
})
it("should render the correct options for a required enum boolean parameter", function(){

let props = {
@@ -105,7 +105,7 @@ describe("<JsonSchemaForm/>", function(){

expect(wrapper.find("select").length).toEqual(1)
expect(wrapper.find("select option").length).toEqual(1)
expect(wrapper.find("select option").eq(1).text()).toEqual("true")
expect(wrapper.find("select option").first().text()).toEqual("true")
})
})
})

Laddar…
Avbryt
Spara