{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/pulls/comments/59208854","id":59208854,"diff_hunk":"@@ -203,4 +203,116 @@ describe(\"ArrayField\", () => {\n       expect(node.querySelectorAll(\"fieldset fieldset\")).to.have.length.of(1);\n     });\n   });\n+\n+  describe(\"Fixed items lists\", () => {\n+    const schema = {\n+      type: \"array\",\n+      title: \"List of fixed items\",\n+      items: [\n+        {\n+          type: \"string\",\n+          title: \"Some text\"\n+        },\n+        {\n+          type: \"number\",\n+          title: \"A number\"\n+        }\n+      ]\n+    };\n+    const schemaAdditional = {\n+      type: \"array\",\n+      title: \"List of fixed items\",\n+      items: [\n+        {\n+          type: \"number\",\n+          title: \"A number\"\n+        },\n+        {\n+          type: \"number\",\n+          title: \"Another number\"\n+        }\n+      ],\n+      additionalItems: {\n+        type: \"string\",\n+        title: \"Additional item\"\n+      }\n+    };\n+    it(\"should render a fieldset\", () => {\n+      const {node} = createFormComponent({schema});\n+\n+      expect(node.querySelectorAll(\"fieldset\"))\n+          .to.have.length.of(1);\n+    });\n+\n+    it(\"should render a fieldset legend\", () => {\n+      const {node} = createFormComponent({schema});\n+\n+      expect(node.querySelector(\"fieldset > legend\").textContent)\n+          .eql(\"List of fixed items\");\n+    });\n+\n+    it(\"should render field widgets\", () => {\n+      const {node} = createFormComponent({schema});\n+      const strInput = node.querySelector(\"fieldset .field-string input[type=text]\");\n+      const numInput = node.querySelector(\"fieldset .field-number input[type=text]\");\n+      expect(strInput.id).eql(\"root_0\");\n+      expect(numInput.id).eql(\"root_1\");\n+    });\n+\n+    it(\"should fill fields with data\", () => {\n+      const {node} = createFormComponent({schema, formData: [\"foo\", 42]});\n+      const strInput = node.querySelector(\"fieldset .field-string input[type=text]\");\n+      const numInput = node.querySelector(\"fieldset .field-number input[type=text]\");\n+      expect(strInput.value).eql(\"foo\");\n+      expect(numInput.value).eql(\"42\");\n+    });\n+\n+    it(\"should handle change events\", () => {\n+      const {comp, node} = createFormComponent({schema});\n+      const strInput = node.querySelector(\"fieldset .field-string input[type=text]\");\n+      const numInput = node.querySelector(\"fieldset .field-number input[type=text]\");\n+\n+      Simulate.change(strInput, {\n+        target: { value: \"bar\" }\n+      });\n+      Simulate.change(numInput, {\n+        target: { value: \"101\" }\n+      });\n+\n+      expect(comp.state.formData).eql([\"bar\", 101]);\n+    });\n+\n+    it(\"should generate additional fields and fill data\", () => {\n+      const {node} = createFormComponent({schema: schemaAdditional, formData: [1, 2, \"bar\"]});\n+      const addInput = node.querySelector(\"fieldset .field-string input[type=text]\");\n+      expect(addInput.id).eql(\"root_2\");\n+      expect(addInput.value).eql(\"bar\");\n+    });\n+\n+    it(\"add, remove, change for additional items\", () => {\n+      const {comp, node} = createFormComponent({schema: schemaAdditional, formData: [1, 2, \"foo\"]});\n+\n+      const addBtn = node.querySelector(\".array-item-add button\");\n+\n+      Simulate.click(addBtn);\n+      expect(node.querySelectorAll('.field-string')).to.have.length.of(2);\n+      expect(comp.state.formData).eql([1, 2, \"foo\", \"\"]);\n+\n+      const inputs = node.querySelectorAll(\".field-string input[type=text]\");\n+      Simulate.change(inputs[0], {target: {value: \"bar\"}});\n+      Simulate.change(inputs[1], {target: {value: \"baz\"}});\n+      expect(comp.state.formData).eql([1, 2, \"bar\", \"baz\"]);\n+\n+      let dropBtns = node.querySelectorAll(\".array-item-remove button\");\n+      Simulate.click(dropBtns[0]);\n+      expect(node.querySelectorAll('.field-string')).to.have.length.of(1);\n+      expect(comp.state.formData).eql([1, 2, \"baz\"]);\n+\n+      dropBtns = node.querySelectorAll(\".array-item-remove button\");\n+      Simulate.click(dropBtns[0]);\n+      expect(node.querySelectorAll('.field-string')).to.be.empty;\n+      expect(comp.state.formData).eql([1, 2]);\n+    });\n+","path":"test/ArrayField_test.js","position":114,"original_position":114,"commit_id":"62abc246c9d839ff2378c59470d979301ac1283a","original_commit_id":"62abc246c9d839ff2378c59470d979301ac1283a","user":{"login":"n1k0","id":41547,"avatar_url":"https://avatars.githubusercontent.com/u/41547?v=3","gravatar_id":"","url":"https://api.github.com/users/n1k0","html_url":"https://github.com/n1k0","followers_url":"https://api.github.com/users/n1k0/followers","following_url":"https://api.github.com/users/n1k0/following{/other_user}","gists_url":"https://api.github.com/users/n1k0/gists{/gist_id}","starred_url":"https://api.github.com/users/n1k0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n1k0/subscriptions","organizations_url":"https://api.github.com/users/n1k0/orgs","repos_url":"https://api.github.com/users/n1k0/repos","events_url":"https://api.github.com/users/n1k0/events{/privacy}","received_events_url":"https://api.github.com/users/n1k0/received_events","type":"User","site_admin":false},"body":"Nit: remove empty line","created_at":"2016-04-11T14:04:03Z","updated_at":"2016-04-11T14:04:03Z","html_url":"https://github.com/mozilla-services/react-jsonschema-form/pull/132#discussion_r59208854","pull_request_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/pulls/132","_links":{"self":{"href":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/pulls/comments/59208854"},"html":{"href":"https://github.com/mozilla-services/react-jsonschema-form/pull/132#discussion_r59208854"},"pull_request":{"href":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/pulls/132"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/pulls/132","id":65944962,"html_url":"https://github.com/mozilla-services/react-jsonschema-form/pull/132","diff_url":"https://github.com/mozilla-services/react-jsonschema-form/pull/132.diff","patch_url":"https://github.com/mozilla-services/react-jsonschema-form/pull/132.patch","issue_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/issues/132","number":132,"state":"open","locked":false,"title":"Handle fixed items arrays","user":{"login":"rhgb","id":1477085,"avatar_url":"https://avatars.githubusercontent.com/u/1477085?v=3","gravatar_id":"","url":"https://api.github.com/users/rhgb","html_url":"https://github.com/rhgb","followers_url":"https://api.github.com/users/rhgb/followers","following_url":"https://api.github.com/users/rhgb/following{/other_user}","gists_url":"https://api.github.com/users/rhgb/gists{/gist_id}","starred_url":"https://api.github.com/users/rhgb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhgb/subscriptions","organizations_url":"https://api.github.com/users/rhgb/orgs","repos_url":"https://api.github.com/users/rhgb/repos","events_url":"https://api.github.com/users/rhgb/events{/privacy}","received_events_url":"https://api.github.com/users/rhgb/received_events","type":"User","site_admin":false},"body":"fixed #76 \r\nhandle fixed items arrays:\r\n```json\r\n{\r\n  \"type\": \"array\",\r\n  \"title\": \"List of fixed items\",\r\n  \"items\": [\r\n    {\r\n      \"type\": \"string\",\r\n      \"title\": \"Some text\"\r\n    },\r\n    {\r\n      \"type\": \"number\",\r\n      \"title\": \"A number\"\r\n    }\r\n  ]\r\n}\r\n```\r\nNOTE: According to the [spec](http://json-schema.org/latest/json-schema-validation.html#anchor131), it should be **valid** that form data has less items in fixed array than the schema defined, but it seems hard to find an appropriate UI for this. I'm glad to implement it if there's any reasonable suggestion. \r\n\r\n","created_at":"2016-04-11T06:21:27Z","updated_at":"2016-04-11T14:04:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b18726a9462e0bf81691edb59e1ffa1231ded402","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/pulls/132/commits","review_comments_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/pulls/132/comments","review_comment_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/issues/132/comments","statuses_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/statuses/62abc246c9d839ff2378c59470d979301ac1283a","head":{"label":"rhgb:array-tuple","ref":"array-tuple","sha":"62abc246c9d839ff2378c59470d979301ac1283a","user":{"login":"rhgb","id":1477085,"avatar_url":"https://avatars.githubusercontent.com/u/1477085?v=3","gravatar_id":"","url":"https://api.github.com/users/rhgb","html_url":"https://github.com/rhgb","followers_url":"https://api.github.com/users/rhgb/followers","following_url":"https://api.github.com/users/rhgb/following{/other_user}","gists_url":"https://api.github.com/users/rhgb/gists{/gist_id}","starred_url":"https://api.github.com/users/rhgb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhgb/subscriptions","organizations_url":"https://api.github.com/users/rhgb/orgs","repos_url":"https://api.github.com/users/rhgb/repos","events_url":"https://api.github.com/users/rhgb/events{/privacy}","received_events_url":"https://api.github.com/users/rhgb/received_events","type":"User","site_admin":false},"repo":{"id":55139497,"name":"react-jsonschema-form","full_name":"rhgb/react-jsonschema-form","owner":{"login":"rhgb","id":1477085,"avatar_url":"https://avatars.githubusercontent.com/u/1477085?v=3","gravatar_id":"","url":"https://api.github.com/users/rhgb","html_url":"https://github.com/rhgb","followers_url":"https://api.github.com/users/rhgb/followers","following_url":"https://api.github.com/users/rhgb/following{/other_user}","gists_url":"https://api.github.com/users/rhgb/gists{/gist_id}","starred_url":"https://api.github.com/users/rhgb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhgb/subscriptions","organizations_url":"https://api.github.com/users/rhgb/orgs","repos_url":"https://api.github.com/users/rhgb/repos","events_url":"https://api.github.com/users/rhgb/events{/privacy}","received_events_url":"https://api.github.com/users/rhgb/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rhgb/react-jsonschema-form","description":"A React component for building Web forms from JSONSchema.","fork":true,"url":"https://api.github.com/repos/rhgb/react-jsonschema-form","forks_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/forks","keys_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/teams","hooks_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/hooks","issue_events_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/issues/events{/number}","events_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/events","assignees_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/assignees{/user}","branches_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/branches{/branch}","tags_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/tags","blobs_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/git/refs{/sha}","trees_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/statuses/{sha}","languages_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/languages","stargazers_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/stargazers","contributors_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/contributors","subscribers_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/subscribers","subscription_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/subscription","commits_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/commits{/sha}","git_commits_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/git/commits{/sha}","comments_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/comments{/number}","issue_comment_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/issues/comments{/number}","contents_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/contents/{+path}","compare_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/merges","archive_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/downloads","issues_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/issues{/number}","pulls_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/pulls{/number}","milestones_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/milestones{/number}","notifications_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/labels{/name}","releases_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/releases{/id}","deployments_url":"https://api.github.com/repos/rhgb/react-jsonschema-form/deployments","created_at":"2016-03-31T09:54:00Z","updated_at":"2016-03-31T09:54:01Z","pushed_at":"2016-04-11T06:20:37Z","git_url":"git://github.com/rhgb/react-jsonschema-form.git","ssh_url":"git@github.com:rhgb/react-jsonschema-form.git","clone_url":"https://github.com/rhgb/react-jsonschema-form.git","svn_url":"https://github.com/rhgb/react-jsonschema-form","homepage":"http://mozilla-services.github.io/react-jsonschema-form/","size":1684,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla-services:master","ref":"master","sha":"7f6662524e59068db3b3c20c864bd7153f1a7d66","user":{"login":"mozilla-services","id":1066228,"avatar_url":"https://avatars.githubusercontent.com/u/1066228?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-services","html_url":"https://github.com/mozilla-services","followers_url":"https://api.github.com/users/mozilla-services/followers","following_url":"https://api.github.com/users/mozilla-services/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-services/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-services/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-services/subscriptions","organizations_url":"https://api.github.com/users/mozilla-services/orgs","repos_url":"https://api.github.com/users/mozilla-services/repos","events_url":"https://api.github.com/users/mozilla-services/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-services/received_events","type":"Organization","site_admin":false},"repo":{"id":48117679,"name":"react-jsonschema-form","full_name":"mozilla-services/react-jsonschema-form","owner":{"login":"mozilla-services","id":1066228,"avatar_url":"https://avatars.githubusercontent.com/u/1066228?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-services","html_url":"https://github.com/mozilla-services","followers_url":"https://api.github.com/users/mozilla-services/followers","following_url":"https://api.github.com/users/mozilla-services/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-services/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-services/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-services/subscriptions","organizations_url":"https://api.github.com/users/mozilla-services/orgs","repos_url":"https://api.github.com/users/mozilla-services/repos","events_url":"https://api.github.com/users/mozilla-services/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-services/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla-services/react-jsonschema-form","description":"A React component for building Web forms from JSONSchema.","fork":false,"url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form","forks_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/forks","keys_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/teams","hooks_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/hooks","issue_events_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/events","assignees_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/tags","blobs_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/languages","stargazers_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/stargazers","contributors_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/contributors","subscribers_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/subscribers","subscription_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/subscription","commits_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/merges","archive_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/downloads","issues_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/deployments","created_at":"2015-12-16T15:14:05Z","updated_at":"2016-04-11T13:25:17Z","pushed_at":"2016-04-11T13:07:28Z","git_url":"git://github.com/mozilla-services/react-jsonschema-form.git","ssh_url":"git@github.com:mozilla-services/react-jsonschema-form.git","clone_url":"https://github.com/mozilla-services/react-jsonschema-form.git","svn_url":"https://github.com/mozilla-services/react-jsonschema-form","homepage":"https://mozilla-services.github.io/react-jsonschema-form/","size":1878,"stargazers_count":138,"watchers_count":138,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":29,"mirror_url":null,"open_issues_count":17,"forks":29,"open_issues":17,"watchers":138,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/pulls/132"},"html":{"href":"https://github.com/mozilla-services/react-jsonschema-form/pull/132"},"issue":{"href":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/issues/132"},"comments":{"href":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/issues/132/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/pulls/132/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/pulls/132/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla-services/react-jsonschema-form/statuses/62abc246c9d839ff2378c59470d979301ac1283a"}}}}