{"action":"created","comment":{"url":"https://api.github.com/repos/angular/material2/pulls/comments/185124445","pull_request_review_id":116452380,"id":185124445,"diff_hunk":"@@ -523,24 +563,97 @@ describe('CdkTable', () => {\n     });\n \n     it('should error if there is row data that does not have a matching row template',\n-      fakeAsync(() => {\n-        expect(() => {\n-          try {\n-            createComponent(WhenRowWithoutDefaultCdkTableApp).detectChanges();\n-            flush();\n-          } catch {\n-            flush();\n-          }\n-        }).toThrowError(getTableMissingMatchingRowDefError().message);\n-    }));\n-\n-    it('should error if there are multiple rows that do not have a when function', fakeAsync(() => {\n+        fakeAsync(() => {\n+          const whenRowWithoutDefaultFixture = createComponent(WhenRowWithoutDefaultCdkTableApp);\n+          const data = whenRowWithoutDefaultFixture.componentInstance.dataSource.data;\n+          expect(() => {\n+            try {\n+              whenRowWithoutDefaultFixture.detectChanges();\n+              flush();\n+            } catch {\n+              flush();\n+            }\n+          }).toThrowError(getTableMissingMatchingRowDefError(data[0]).message);\n+        }));\n+\n+    it('should fail when multiple rows match data without multiTemplateDataRows', fakeAsync(() => {\n       let whenFixture = createComponent(WhenRowMultipleDefaultsCdkTableApp);\n       expect(() => {\n         whenFixture.detectChanges();\n         flush();\n       }).toThrowError(getTableMultipleDefaultRowDefsError().message);\n     }));\n+\n+    describe('with multiTemplateDataRows', () => {\n+      it('should be able to render multiple rows per data object', () => {\n+        setupTableTestApp(WhenRowCdkTableApp);\n+        component.multiTemplateDataRows = true;\n+        fixture.detectChanges();\n+\n+        const data = component.dataSource.data;\n+        expectTableToMatchContent(tableElement, [\n+          ['Column A', 'Column B', 'Column C'],\n+          [data[0].a, data[0].b, data[0].c],\n+          [data[1].a, data[1].b, data[1].c],\n+          ['index_1_special_row'],\n+          [data[2].a, data[2].b, data[2].c],\n+          ['c3_special_row'],\n+          [data[3].a, data[3].b, data[3].c],\n+        ]);\n+      });\n+\n+      it('should have the correct data and row indicies', () => {\n+        setupTableTestApp(WhenRowCdkTableApp);\n+        component.multiTemplateDataRows = true;\n+        component.showIndexColumns();\n+        fixture.detectChanges();\n+\n+        expectTableToMatchContent(tableElement, [\n+          ['Index', 'Data Index', 'Render Index'],\n+          ['', '0', '0'],\n+          ['', '1', '1'],\n+          ['', '1', '2'],\n+          ['', '2', '3'],\n+          ['', '2', '4'],\n+          ['', '3', '5'],\n+        ]);\n+      });\n+\n+      it('should have the correct data and row indicies when data is homogeneous', () => {","path":"src/cdk/table/table.spec.ts","position":201,"original_position":201,"commit_id":"373bfa973570fc34b53e6f2ea88f0cc31da659b6","original_commit_id":"373bfa973570fc34b53e6f2ea88f0cc31da659b6","user":{"login":"jelbourn","id":838736,"avatar_url":"https://avatars3.githubusercontent.com/u/838736?v=4","gravatar_id":"","url":"https://api.github.com/users/jelbourn","html_url":"https://github.com/jelbourn","followers_url":"https://api.github.com/users/jelbourn/followers","following_url":"https://api.github.com/users/jelbourn/following{/other_user}","gists_url":"https://api.github.com/users/jelbourn/gists{/gist_id}","starred_url":"https://api.github.com/users/jelbourn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jelbourn/subscriptions","organizations_url":"https://api.github.com/users/jelbourn/orgs","repos_url":"https://api.github.com/users/jelbourn/repos","events_url":"https://api.github.com/users/jelbourn/events{/privacy}","received_events_url":"https://api.github.com/users/jelbourn/received_events","type":"User","site_admin":false},"body":"\"Homogeneous\" doesn't really communicate the same thing as \"Data contains multiple occurrences of the same object instance\"","created_at":"2018-04-30T22:07:41Z","updated_at":"2018-04-30T22:07:49Z","html_url":"https://github.com/angular/material2/pull/10964#discussion_r185124445","pull_request_url":"https://api.github.com/repos/angular/material2/pulls/10964","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/angular/material2/pulls/comments/185124445"},"html":{"href":"https://github.com/angular/material2/pull/10964#discussion_r185124445"},"pull_request":{"href":"https://api.github.com/repos/angular/material2/pulls/10964"}}},"pull_request":{"url":"https://api.github.com/repos/angular/material2/pulls/10964","id":183488857,"html_url":"https://github.com/angular/material2/pull/10964","diff_url":"https://github.com/angular/material2/pull/10964.diff","patch_url":"https://github.com/angular/material2/pull/10964.patch","issue_url":"https://api.github.com/repos/angular/material2/issues/10964","number":10964,"state":"open","locked":false,"title":"feat(table): enable multiple data rows","user":{"login":"andrewseguin","id":22898577,"avatar_url":"https://avatars3.githubusercontent.com/u/22898577?v=4","gravatar_id":"","url":"https://api.github.com/users/andrewseguin","html_url":"https://github.com/andrewseguin","followers_url":"https://api.github.com/users/andrewseguin/followers","following_url":"https://api.github.com/users/andrewseguin/following{/other_user}","gists_url":"https://api.github.com/users/andrewseguin/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewseguin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewseguin/subscriptions","organizations_url":"https://api.github.com/users/andrewseguin/orgs","repos_url":"https://api.github.com/users/andrewseguin/repos","events_url":"https://api.github.com/users/andrewseguin/events{/privacy}","received_events_url":"https://api.github.com/users/andrewseguin/received_events","type":"User","site_admin":false},"body":"Introduces a new table input `enableRowMultiplex` which allows the table to have multiple data rows per data object.\r\n\r\n**Old paradigm**\r\n\r\nEach data object passed to the table is rendered as a data row. Since the mapping is 1:1, the data array itself can be used with the `IterableDiffer` to determine which rows need to change.\r\n\r\n**New paradigm**\r\n\r\nEach data object passed to the table may be rendered by one or more rows. The `IterableDiffer` cannot use the data array itself anymore since it will not correctly understand add/remove/move operations in the rows. \r\n\r\nInstead, the `IterableDiffer` will be diffed with a `DataRow` object that represents a pair containing a data object and row template. When the data changes, the list of `DataRow` objects will be constructed and diffed to get the list of changes.\r\n\r\n**Caveats for discussion**\r\n\r\n1. The row context previously contained an `index` value that represented both the row index and data object index (they were the same. Now, that `index` value represents the index of the data. To get the row index, there is an additional context property called `rowIndex`.\r\n\r\n_Should it be swapped such that `index` is the row index and the data index can be stored in `dataIndex`?_ \r\n\r\n2. Similarly, the `trackBy` function receives an index value. Previously the index matched both the data and row. Now, its explicitly the data index.\r\n\r\n_Should `trackBy` receive the row index?_ \r\n\r\n","created_at":"2018-04-23T16:24:00Z","updated_at":"2018-04-30T22:07:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"867d2a2fba5e56c93ed8f613f453fd7591807127","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":627454545,"url":"https://api.github.com/repos/angular/material2/labels/caretaker%20note","name":"caretaker note","color":"006b75","default":false},{"id":308798701,"url":"https://api.github.com/repos/angular/material2/labels/cla:%20yes","name":"cla: yes","color":"009800","default":false},{"id":311422524,"url":"https://api.github.com/repos/angular/material2/labels/pr:%20needs%20review","name":"pr: needs review","color":"fbca04","default":false},{"id":770558815,"url":"https://api.github.com/repos/angular/material2/labels/target:%20minor","name":"target: minor","color":"35b7ce","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/angular/material2/pulls/10964/commits","review_comments_url":"https://api.github.com/repos/angular/material2/pulls/10964/comments","review_comment_url":"https://api.github.com/repos/angular/material2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/angular/material2/issues/10964/comments","statuses_url":"https://api.github.com/repos/angular/material2/statuses/373bfa973570fc34b53e6f2ea88f0cc31da659b6","head":{"label":"andrewseguin:table-eval-when-each-emit","ref":"table-eval-when-each-emit","sha":"373bfa973570fc34b53e6f2ea88f0cc31da659b6","user":{"login":"andrewseguin","id":22898577,"avatar_url":"https://avatars3.githubusercontent.com/u/22898577?v=4","gravatar_id":"","url":"https://api.github.com/users/andrewseguin","html_url":"https://github.com/andrewseguin","followers_url":"https://api.github.com/users/andrewseguin/followers","following_url":"https://api.github.com/users/andrewseguin/following{/other_user}","gists_url":"https://api.github.com/users/andrewseguin/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewseguin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewseguin/subscriptions","organizations_url":"https://api.github.com/users/andrewseguin/orgs","repos_url":"https://api.github.com/users/andrewseguin/repos","events_url":"https://api.github.com/users/andrewseguin/events{/privacy}","received_events_url":"https://api.github.com/users/andrewseguin/received_events","type":"User","site_admin":false},"repo":{"id":71389449,"name":"material2","full_name":"andrewseguin/material2","owner":{"login":"andrewseguin","id":22898577,"avatar_url":"https://avatars3.githubusercontent.com/u/22898577?v=4","gravatar_id":"","url":"https://api.github.com/users/andrewseguin","html_url":"https://github.com/andrewseguin","followers_url":"https://api.github.com/users/andrewseguin/followers","following_url":"https://api.github.com/users/andrewseguin/following{/other_user}","gists_url":"https://api.github.com/users/andrewseguin/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewseguin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewseguin/subscriptions","organizations_url":"https://api.github.com/users/andrewseguin/orgs","repos_url":"https://api.github.com/users/andrewseguin/repos","events_url":"https://api.github.com/users/andrewseguin/events{/privacy}","received_events_url":"https://api.github.com/users/andrewseguin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andrewseguin/material2","description":"Material Design components for Angular 2","fork":true,"url":"https://api.github.com/repos/andrewseguin/material2","forks_url":"https://api.github.com/repos/andrewseguin/material2/forks","keys_url":"https://api.github.com/repos/andrewseguin/material2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andrewseguin/material2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andrewseguin/material2/teams","hooks_url":"https://api.github.com/repos/andrewseguin/material2/hooks","issue_events_url":"https://api.github.com/repos/andrewseguin/material2/issues/events{/number}","events_url":"https://api.github.com/repos/andrewseguin/material2/events","assignees_url":"https://api.github.com/repos/andrewseguin/material2/assignees{/user}","branches_url":"https://api.github.com/repos/andrewseguin/material2/branches{/branch}","tags_url":"https://api.github.com/repos/andrewseguin/material2/tags","blobs_url":"https://api.github.com/repos/andrewseguin/material2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andrewseguin/material2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andrewseguin/material2/git/refs{/sha}","trees_url":"https://api.github.com/repos/andrewseguin/material2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andrewseguin/material2/statuses/{sha}","languages_url":"https://api.github.com/repos/andrewseguin/material2/languages","stargazers_url":"https://api.github.com/repos/andrewseguin/material2/stargazers","contributors_url":"https://api.github.com/repos/andrewseguin/material2/contributors","subscribers_url":"https://api.github.com/repos/andrewseguin/material2/subscribers","subscription_url":"https://api.github.com/repos/andrewseguin/material2/subscription","commits_url":"https://api.github.com/repos/andrewseguin/material2/commits{/sha}","git_commits_url":"https://api.github.com/repos/andrewseguin/material2/git/commits{/sha}","comments_url":"https://api.github.com/repos/andrewseguin/material2/comments{/number}","issue_comment_url":"https://api.github.com/repos/andrewseguin/material2/issues/comments{/number}","contents_url":"https://api.github.com/repos/andrewseguin/material2/contents/{+path}","compare_url":"https://api.github.com/repos/andrewseguin/material2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andrewseguin/material2/merges","archive_url":"https://api.github.com/repos/andrewseguin/material2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andrewseguin/material2/downloads","issues_url":"https://api.github.com/repos/andrewseguin/material2/issues{/number}","pulls_url":"https://api.github.com/repos/andrewseguin/material2/pulls{/number}","milestones_url":"https://api.github.com/repos/andrewseguin/material2/milestones{/number}","notifications_url":"https://api.github.com/repos/andrewseguin/material2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andrewseguin/material2/labels{/name}","releases_url":"https://api.github.com/repos/andrewseguin/material2/releases{/id}","deployments_url":"https://api.github.com/repos/andrewseguin/material2/deployments","created_at":"2016-10-19T18:54:25Z","updated_at":"2018-04-30T20:06:19Z","pushed_at":"2018-04-30T20:21:28Z","git_url":"git://github.com/andrewseguin/material2.git","ssh_url":"git@github.com:andrewseguin/material2.git","clone_url":"https://github.com/andrewseguin/material2.git","svn_url":"https://github.com/andrewseguin/material2","homepage":"https://material.angular.io/","size":14638,"stargazers_count":4,"watchers_count":4,"language":"TypeScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":2,"open_issues":0,"watchers":4,"default_branch":"master"}},"base":{"label":"angular:master","ref":"master","sha":"ff0cc7ad7950deee8d255ba47a4ebc73f13064fa","user":{"login":"angular","id":139426,"avatar_url":"https://avatars3.githubusercontent.com/u/139426?v=4","gravatar_id":"","url":"https://api.github.com/users/angular","html_url":"https://github.com/angular","followers_url":"https://api.github.com/users/angular/followers","following_url":"https://api.github.com/users/angular/following{/other_user}","gists_url":"https://api.github.com/users/angular/gists{/gist_id}","starred_url":"https://api.github.com/users/angular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angular/subscriptions","organizations_url":"https://api.github.com/users/angular/orgs","repos_url":"https://api.github.com/users/angular/repos","events_url":"https://api.github.com/users/angular/events{/privacy}","received_events_url":"https://api.github.com/users/angular/received_events","type":"Organization","site_admin":false},"repo":{"id":49016322,"name":"material2","full_name":"angular/material2","owner":{"login":"angular","id":139426,"avatar_url":"https://avatars3.githubusercontent.com/u/139426?v=4","gravatar_id":"","url":"https://api.github.com/users/angular","html_url":"https://github.com/angular","followers_url":"https://api.github.com/users/angular/followers","following_url":"https://api.github.com/users/angular/following{/other_user}","gists_url":"https://api.github.com/users/angular/gists{/gist_id}","starred_url":"https://api.github.com/users/angular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angular/subscriptions","organizations_url":"https://api.github.com/users/angular/orgs","repos_url":"https://api.github.com/users/angular/repos","events_url":"https://api.github.com/users/angular/events{/privacy}","received_events_url":"https://api.github.com/users/angular/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/angular/material2","description":"Material Design components for Angular","fork":false,"url":"https://api.github.com/repos/angular/material2","forks_url":"https://api.github.com/repos/angular/material2/forks","keys_url":"https://api.github.com/repos/angular/material2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/angular/material2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/angular/material2/teams","hooks_url":"https://api.github.com/repos/angular/material2/hooks","issue_events_url":"https://api.github.com/repos/angular/material2/issues/events{/number}","events_url":"https://api.github.com/repos/angular/material2/events","assignees_url":"https://api.github.com/repos/angular/material2/assignees{/user}","branches_url":"https://api.github.com/repos/angular/material2/branches{/branch}","tags_url":"https://api.github.com/repos/angular/material2/tags","blobs_url":"https://api.github.com/repos/angular/material2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/angular/material2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/angular/material2/git/refs{/sha}","trees_url":"https://api.github.com/repos/angular/material2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/angular/material2/statuses/{sha}","languages_url":"https://api.github.com/repos/angular/material2/languages","stargazers_url":"https://api.github.com/repos/angular/material2/stargazers","contributors_url":"https://api.github.com/repos/angular/material2/contributors","subscribers_url":"https://api.github.com/repos/angular/material2/subscribers","subscription_url":"https://api.github.com/repos/angular/material2/subscription","commits_url":"https://api.github.com/repos/angular/material2/commits{/sha}","git_commits_url":"https://api.github.com/repos/angular/material2/git/commits{/sha}","comments_url":"https://api.github.com/repos/angular/material2/comments{/number}","issue_comment_url":"https://api.github.com/repos/angular/material2/issues/comments{/number}","contents_url":"https://api.github.com/repos/angular/material2/contents/{+path}","compare_url":"https://api.github.com/repos/angular/material2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/angular/material2/merges","archive_url":"https://api.github.com/repos/angular/material2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/angular/material2/downloads","issues_url":"https://api.github.com/repos/angular/material2/issues{/number}","pulls_url":"https://api.github.com/repos/angular/material2/pulls{/number}","milestones_url":"https://api.github.com/repos/angular/material2/milestones{/number}","notifications_url":"https://api.github.com/repos/angular/material2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/angular/material2/labels{/name}","releases_url":"https://api.github.com/repos/angular/material2/releases{/id}","deployments_url":"https://api.github.com/repos/angular/material2/deployments","created_at":"2016-01-04T18:50:02Z","updated_at":"2018-04-30T20:25:48Z","pushed_at":"2018-04-30T21:53:17Z","git_url":"git://github.com/angular/material2.git","ssh_url":"git@github.com:angular/material2.git","clone_url":"https://github.com/angular/material2.git","svn_url":"https://github.com/angular/material2","homepage":"https://material.angular.io","size":15123,"stargazers_count":14113,"watchers_count":14113,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3487,"mirror_url":null,"archived":false,"open_issues_count":967,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":3487,"open_issues":967,"watchers":14113,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/angular/material2/pulls/10964"},"html":{"href":"https://github.com/angular/material2/pull/10964"},"issue":{"href":"https://api.github.com/repos/angular/material2/issues/10964"},"comments":{"href":"https://api.github.com/repos/angular/material2/issues/10964/comments"},"review_comments":{"href":"https://api.github.com/repos/angular/material2/pulls/10964/comments"},"review_comment":{"href":"https://api.github.com/repos/angular/material2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/angular/material2/pulls/10964/commits"},"statuses":{"href":"https://api.github.com/repos/angular/material2/statuses/373bfa973570fc34b53e6f2ea88f0cc31da659b6"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jelbourn"}}