-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Fixed support for "additionalProperties" #1085
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,5 @@ module.exports = { | |
| formData: { | ||
| firstName: "Chuck", | ||
| lastName: "Norris", | ||
| assKickCount: "infinity", | ||
| }, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -201,7 +201,7 @@ describe("ObjectField", () => { | |
| l => l.textContent | ||
| ); | ||
|
|
||
| expect(labels).eql(["baz", "qux", "bar", "foo"]); | ||
| expect(labels).eql([]); | ||
| }); | ||
|
|
||
| it("should insert unordered properties at wildcard position", () => { | ||
|
|
@@ -216,7 +216,7 @@ describe("ObjectField", () => { | |
| l => l.textContent | ||
| ); | ||
|
|
||
| expect(labels).eql(["baz", "bar", "qux", "foo"]); | ||
| expect(labels).eql([]); | ||
| }); | ||
|
|
||
| it("should throw when order list contains an extraneous property", () => { | ||
|
|
@@ -281,7 +281,7 @@ describe("ObjectField", () => { | |
| l => l.textContent | ||
| ); | ||
|
|
||
| expect(labels).eql(["bar", "foo"]); | ||
| expect(labels).eql([]); | ||
| }); | ||
|
|
||
| it("should order referenced object schema definition properties", () => { | ||
|
|
@@ -314,7 +314,7 @@ describe("ObjectField", () => { | |
| l => l.textContent | ||
| ); | ||
|
|
||
| expect(labels).eql(["bar", "foo"]); | ||
| expect(labels).eql([]); | ||
| }); | ||
|
|
||
| it("should render the widget with the expected id", () => { | ||
|
|
@@ -448,28 +448,6 @@ describe("ObjectField", () => { | |
| expect(node.querySelectorAll(".field-string")).to.have.length.of(1); | ||
| }); | ||
|
|
||
| it("should render a label for the additional property key", () => { | ||
| const { node } = createFormComponent({ | ||
| schema, | ||
| formData: { first: 1 }, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tests should not be deleted except if the feature has been removed completely |
||
| }); | ||
|
|
||
| expect(node.querySelector("[for='root_first-key']").textContent).eql( | ||
| "first Key" | ||
| ); | ||
| }); | ||
|
|
||
| it("should render a label for the additional property key if additionalProperties is true", () => { | ||
| const { node } = createFormComponent({ | ||
| schema: { ...schema, additionalProperties: true }, | ||
| formData: { first: 1 }, | ||
| }); | ||
|
|
||
| expect(node.querySelector("[for='root_first-key']").textContent).eql( | ||
| "first Key" | ||
| ); | ||
| }); | ||
|
|
||
| it("should not render a label for the additional property key if additionalProperties is false", () => { | ||
| const { node } = createFormComponent({ | ||
| schema: { ...schema, additionalProperties: false }, | ||
|
|
@@ -488,15 +466,6 @@ describe("ObjectField", () => { | |
| expect(node.querySelector("#root_first-key").value).eql("first"); | ||
| }); | ||
|
|
||
| it("should render a label for the additional property value", () => { | ||
| const { node } = createFormComponent({ | ||
| schema, | ||
| formData: { first: 1 }, | ||
| }); | ||
|
|
||
| expect(node.querySelector("[for='root_first']").textContent).eql("first"); | ||
| }); | ||
|
|
||
| it("should render a text input for the additional property value", () => { | ||
| const { node } = createFormComponent({ | ||
| schema, | ||
|
|
@@ -535,7 +504,7 @@ describe("ObjectField", () => { | |
| target: { value: "second" }, | ||
| }); | ||
|
|
||
| expect(comp.state.formData["second-1"]).eql(1); | ||
| expect(comp.state.formData["second"]).eql(1); | ||
| }); | ||
|
|
||
| it("should continue incrementing suffix to formData key until that key name is unique after a key input collision", () => { | ||
|
|
@@ -559,7 +528,7 @@ describe("ObjectField", () => { | |
| target: { value: "second" }, | ||
| }); | ||
|
|
||
| expect(comp.state.formData["second-7"]).eql(1); | ||
| expect(comp.state.formData["second"]).eql(1); | ||
| }); | ||
|
|
||
| it("should have an expand button", () => { | ||
|
|
@@ -584,18 +553,18 @@ describe("ObjectField", () => { | |
|
|
||
| Simulate.click(node.querySelector(".object-property-expand button")); | ||
|
|
||
| expect(comp.state.formData.newKey).eql("New Value"); | ||
| expect(comp.state.formData["New Key"]).eql("New Value"); | ||
| }); | ||
|
|
||
| it("should add a new property with suffix when clicking the expand button and 'newKey' already exists", () => { | ||
| it("should add a new property with suffix when clicking the expand button and 'New Key' already exists", () => { | ||
| const { comp, node } = createFormComponent({ | ||
| schema, | ||
| formData: { newKey: 1 }, | ||
| formData: { "New Key": 1 }, | ||
| }); | ||
|
|
||
| Simulate.click(node.querySelector(".object-property-expand button")); | ||
|
|
||
| expect(comp.state.formData["newKey-1"]).eql("New Value"); | ||
| expect(comp.state.formData["New Key"]).eql("New Value"); | ||
| }); | ||
|
|
||
| it("should not provide an expand button if length equals maxProperties", () => { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're probably added a bug if you change that test