From 22ab62e95a79dd5806d443c6fe9acd990eae1f30 Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Tue, 10 Sep 2019 21:30:11 -0700 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20pass=20`disabled`=20through=20JsonSc?= =?UTF-8?q?hemaForm=20=E2=80=93=20JsonSchema=5Fstring=20=E2=80=93=20Select?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/json-schema-components.jsx | 1 + test/mocha/components/json-schema-form.jsx | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/core/json-schema-components.jsx b/src/core/json-schema-components.jsx index bf88ebea06b..c5f1181dad3 100644 --- a/src/core/json-schema-components.jsx +++ b/src/core/json-schema-components.jsx @@ -78,6 +78,7 @@ export class JsonSchema_string extends Component { allowedValues={ enumValue } value={ value } allowEmptyValue={ !required } + disabled={disabled} onChange={ this.onEnumChange }/>) } diff --git a/test/mocha/components/json-schema-form.jsx b/test/mocha/components/json-schema-form.jsx index d8554007089..36843f545d3 100644 --- a/test/mocha/components/json-schema-form.jsx +++ b/test/mocha/components/json-schema-form.jsx @@ -40,6 +40,27 @@ describe("", function(){ expect(wrapper.find("select option").eq(2).text()).toEqual("two") }) + it("should render a string enum as disabled when JsonSchemaForm is disabled", function(){ + + let props = { + getComponent: getComponentStub, + value: "", + onChange: () => {}, + keyName: "", + fn: {}, + schema: { + type: "string", + enum: ["one", "two"] + }, + disabled: true + } + + let wrapper = render() + + expect(wrapper.find("select").attr("disabled")).toEqual("disabled") + }) + + it("should render the correct options for a required string enum parameter", function(){ let props = { From 4f7fd465dbf722f866c539c987622b9778c67942 Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Tue, 10 Sep 2019 21:59:42 -0700 Subject: [PATCH 2/2] migrate 5452 regression test --- test/e2e-cypress/tests/bugs/5452.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/e2e-cypress/tests/bugs/5452.js b/test/e2e-cypress/tests/bugs/5452.js index b0a1f5e9038..909b04a6c2b 100644 --- a/test/e2e-cypress/tests/bugs/5452.js +++ b/test/e2e-cypress/tests/bugs/5452.js @@ -8,6 +8,8 @@ describe("#5452: crashing in Parameters", function() { cy.visit("http://localhost:3230/?url=/documents/bugs/5452/swagger.yaml") .get("#operations-default-get_endpoint") .click() + .get(".try-out__btn") + .click() .get(".parameters > tbody > tr > .parameters-col_description > select") .select("") .get(".parameters > tbody > tr > .parameters-col_description > select")