{"action":"created","comment":{"url":"https://api.github.com/repos/san650/ember-cli-page-object/pulls/comments/51639508","id":51639508,"diff_hunk":"@@ -0,0 +1,84 @@\n+/**\n+ * Render a component's template in the context of a test.\n+ *\n+ * Throws an error if a test's context has not been set on the page.\n+ *\n+ * Returns the page object, which allows for method chaining.\n+ *\n+ * @example\n+ *\n+ * page.setContext(this)\n+ *   .render(hbs`{{my-component}}`)\n+ *   .clickOnText('Hi!');\n+ *\n+ * @param {Object} template - A compiled component template\n+ * @return {PageObject} - the page object\n+ */\n+function render(template) {\n+  if (!this.context) {\n+    const message = 'You must set a context on the page object before calling calling `render()`';\n+    const error = new Error(message);\n+\n+    throw error;\n+  }\n+\n+  this.context.render(template);\n+\n+  return this;\n+}\n+\n+/**\n+ * Sets the page's test context.\n+ *\n+ * Returns the page object, which allows for method chaining.\n+ *\n+ * @example\n+ *\n+ * page.setContext(this)\n+ *   .render(hbs`{{my-component}}`)\n+ *   .clickOnText('Hi!');\n+ *\n+ * @param {Object} context - A component integration test's `this` context\n+ * @return {PageObject} - the page object\n+ */\n+function setContext(context) {\n+  if (context) {\n+    this.context = context;\n+  }\n+\n+  return this;\n+}\n+\n+/**\n+ * Unsets the page's test context.\n+ *\n+ * Useful in a component test's `afterEach()` hook, to make sure the\n+ * context has been cleared after each test.\n+ *\n+ * @example\n+ *\n+ * page.removeContext();\n+ *\n+ * @return {PageObject} - the page object\n+ */\n+function removeContext() {\n+  if (this.context) {\n+    delete this.context;\n+  }\n+\n+  return this;\n+}\n+\n+const methods = {\n+  setContext,\n+  removeContext,\n+  render\n+};\n+\n+export function bindContextMethods(pageObject) {\n+  for (let methodName in methods) {\n+    pageObject[methodName] = function() {\n+      return methods[methodName].apply(pageObject, arguments);\n+    }\n+  }","path":"test-support/page-object/context.js","position":83,"original_position":83,"commit_id":"93eee60dada993594fa5be9c390770e02155b46b","original_commit_id":"93eee60dada993594fa5be9c390770e02155b46b","user":{"login":"san650","id":1234607,"avatar_url":"https://avatars.githubusercontent.com/u/1234607?v=3","gravatar_id":"","url":"https://api.github.com/users/san650","html_url":"https://github.com/san650","followers_url":"https://api.github.com/users/san650/followers","following_url":"https://api.github.com/users/san650/following{/other_user}","gists_url":"https://api.github.com/users/san650/gists{/gist_id}","starred_url":"https://api.github.com/users/san650/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/san650/subscriptions","organizations_url":"https://api.github.com/users/san650/orgs","repos_url":"https://api.github.com/users/san650/repos","events_url":"https://api.github.com/users/san650/events{/privacy}","received_events_url":"https://api.github.com/users/san650/received_events","type":"User","site_admin":false},"body":"![Codacy](https://www.codacy.com/versioned/images/favicon.png) Issue found: [Don't make functions within a loop.](https://www.codacy.com/app/san650/ember-cli-page-object/file/1957769436/issues/source?bid=2903707&fileBranchId=3076256#l83)","created_at":"2016-02-02T21:37:14Z","updated_at":"2016-02-02T21:37:14Z","html_url":"https://github.com/san650/ember-cli-page-object/pull/99#discussion_r51639508","pull_request_url":"https://api.github.com/repos/san650/ember-cli-page-object/pulls/99","_links":{"self":{"href":"https://api.github.com/repos/san650/ember-cli-page-object/pulls/comments/51639508"},"html":{"href":"https://github.com/san650/ember-cli-page-object/pull/99#discussion_r51639508"},"pull_request":{"href":"https://api.github.com/repos/san650/ember-cli-page-object/pulls/99"}}},"pull_request":{"url":"https://api.github.com/repos/san650/ember-cli-page-object/pulls/99","id":56390757,"html_url":"https://github.com/san650/ember-cli-page-object/pull/99","diff_url":"https://github.com/san650/ember-cli-page-object/pull/99.diff","patch_url":"https://github.com/san650/ember-cli-page-object/pull/99.patch","issue_url":"https://api.github.com/repos/san650/ember-cli-page-object/issues/99","number":99,"state":"open","locked":false,"title":"Component integration test support","user":{"login":"jeradg","id":1948799,"avatar_url":"https://avatars.githubusercontent.com/u/1948799?v=3","gravatar_id":"","url":"https://api.github.com/users/jeradg","html_url":"https://github.com/jeradg","followers_url":"https://api.github.com/users/jeradg/followers","following_url":"https://api.github.com/users/jeradg/following{/other_user}","gists_url":"https://api.github.com/users/jeradg/gists{/gist_id}","starred_url":"https://api.github.com/users/jeradg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeradg/subscriptions","organizations_url":"https://api.github.com/users/jeradg/orgs","repos_url":"https://api.github.com/users/jeradg/repos","events_url":"https://api.github.com/users/jeradg/events{/privacy}","received_events_url":"https://api.github.com/users/jeradg/received_events","type":"User","site_admin":false},"body":"(Work in progress.)\r\n\r\nAdds support for using ember-cli-page-object with component integration tests. Allows for passing a test's `this` context to the page object, which causes the page object to use context-specific versions of actions, queries, etc.\r\n\r\nThis feature is on the roadmap for ember-cli-page-object version 1.1.\r\n\r\nFor discussion see issue https://github.com/san650/ember-cli-page-object/issues/97.\r\n\r\n## Todo list\r\n\r\n- [x] Support passing test's `this` context to `create()`\r\n- [x] Use test context if available in `find()` and `findWithAssert()` helpers\r\n- [x] Use test context if available in action helpers (`clickable()`, etc.)\r\n- [x] Set page context with `page.setContext(this)`\r\n- [x] Remove page context with `page.removeContext()`\r\n- [x] Add a `render()` helper to call `context.render(hbs...)`\r\n- [ ] Make sure page contexts, `setContext()` and `removeContext()` work with pages created with `page.extend({})`\r\n- [ ] Update `findElementWithAssert()` when a context is present so that it asserts that the element is present (mirroring the acceptance test functionality)\r\n- [ ] Add component integration test documentation to README","created_at":"2016-01-18T21:00:17Z","updated_at":"2016-02-02T21:37:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d29a53fbaaab39090e3a89c9c1561e7a7f4562c7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/san650/ember-cli-page-object/pulls/99/commits","review_comments_url":"https://api.github.com/repos/san650/ember-cli-page-object/pulls/99/comments","review_comment_url":"https://api.github.com/repos/san650/ember-cli-page-object/pulls/comments{/number}","comments_url":"https://api.github.com/repos/san650/ember-cli-page-object/issues/99/comments","statuses_url":"https://api.github.com/repos/san650/ember-cli-page-object/statuses/93eee60dada993594fa5be9c390770e02155b46b","head":{"label":"jeradg:component-integration-test-ceibo","ref":"component-integration-test-ceibo","sha":"93eee60dada993594fa5be9c390770e02155b46b","user":{"login":"jeradg","id":1948799,"avatar_url":"https://avatars.githubusercontent.com/u/1948799?v=3","gravatar_id":"","url":"https://api.github.com/users/jeradg","html_url":"https://github.com/jeradg","followers_url":"https://api.github.com/users/jeradg/followers","following_url":"https://api.github.com/users/jeradg/following{/other_user}","gists_url":"https://api.github.com/users/jeradg/gists{/gist_id}","starred_url":"https://api.github.com/users/jeradg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeradg/subscriptions","organizations_url":"https://api.github.com/users/jeradg/orgs","repos_url":"https://api.github.com/users/jeradg/repos","events_url":"https://api.github.com/users/jeradg/events{/privacy}","received_events_url":"https://api.github.com/users/jeradg/received_events","type":"User","site_admin":false},"repo":{"id":49475788,"name":"ember-cli-page-object","full_name":"jeradg/ember-cli-page-object","owner":{"login":"jeradg","id":1948799,"avatar_url":"https://avatars.githubusercontent.com/u/1948799?v=3","gravatar_id":"","url":"https://api.github.com/users/jeradg","html_url":"https://github.com/jeradg","followers_url":"https://api.github.com/users/jeradg/followers","following_url":"https://api.github.com/users/jeradg/following{/other_user}","gists_url":"https://api.github.com/users/jeradg/gists{/gist_id}","starred_url":"https://api.github.com/users/jeradg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeradg/subscriptions","organizations_url":"https://api.github.com/users/jeradg/orgs","repos_url":"https://api.github.com/users/jeradg/repos","events_url":"https://api.github.com/users/jeradg/events{/privacy}","received_events_url":"https://api.github.com/users/jeradg/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jeradg/ember-cli-page-object","description":"Represent the screens of your web app as a series of objects. This ember-cli addon eases the construction of these objects on your acceptance tests.","fork":true,"url":"https://api.github.com/repos/jeradg/ember-cli-page-object","forks_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/forks","keys_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/teams","hooks_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/hooks","issue_events_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/issues/events{/number}","events_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/events","assignees_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/assignees{/user}","branches_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/branches{/branch}","tags_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/tags","blobs_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/git/refs{/sha}","trees_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/statuses/{sha}","languages_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/languages","stargazers_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/stargazers","contributors_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/contributors","subscribers_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/subscribers","subscription_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/subscription","commits_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/commits{/sha}","git_commits_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/git/commits{/sha}","comments_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/comments{/number}","issue_comment_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/issues/comments{/number}","contents_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/contents/{+path}","compare_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/merges","archive_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/downloads","issues_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/issues{/number}","pulls_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/pulls{/number}","milestones_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/milestones{/number}","notifications_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/labels{/name}","releases_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/releases{/id}","deployments_url":"https://api.github.com/repos/jeradg/ember-cli-page-object/deployments","created_at":"2016-01-12T04:51:23Z","updated_at":"2016-01-12T04:51:24Z","pushed_at":"2016-02-02T19:58:47Z","git_url":"git://github.com/jeradg/ember-cli-page-object.git","ssh_url":"git@github.com:jeradg/ember-cli-page-object.git","clone_url":"https://github.com/jeradg/ember-cli-page-object.git","svn_url":"https://github.com/jeradg/ember-cli-page-object","homepage":"http://ember-cli-page-object.js.org/","size":942,"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":"san650:master","ref":"master","sha":"78111050b89e064435ca2b2e2f254f43ba588f58","user":{"login":"san650","id":1234607,"avatar_url":"https://avatars.githubusercontent.com/u/1234607?v=3","gravatar_id":"","url":"https://api.github.com/users/san650","html_url":"https://github.com/san650","followers_url":"https://api.github.com/users/san650/followers","following_url":"https://api.github.com/users/san650/following{/other_user}","gists_url":"https://api.github.com/users/san650/gists{/gist_id}","starred_url":"https://api.github.com/users/san650/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/san650/subscriptions","organizations_url":"https://api.github.com/users/san650/orgs","repos_url":"https://api.github.com/users/san650/repos","events_url":"https://api.github.com/users/san650/events{/privacy}","received_events_url":"https://api.github.com/users/san650/received_events","type":"User","site_admin":false},"repo":{"id":34986469,"name":"ember-cli-page-object","full_name":"san650/ember-cli-page-object","owner":{"login":"san650","id":1234607,"avatar_url":"https://avatars.githubusercontent.com/u/1234607?v=3","gravatar_id":"","url":"https://api.github.com/users/san650","html_url":"https://github.com/san650","followers_url":"https://api.github.com/users/san650/followers","following_url":"https://api.github.com/users/san650/following{/other_user}","gists_url":"https://api.github.com/users/san650/gists{/gist_id}","starred_url":"https://api.github.com/users/san650/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/san650/subscriptions","organizations_url":"https://api.github.com/users/san650/orgs","repos_url":"https://api.github.com/users/san650/repos","events_url":"https://api.github.com/users/san650/events{/privacy}","received_events_url":"https://api.github.com/users/san650/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/san650/ember-cli-page-object","description":"Represent the screens of your web app as a series of objects. This ember-cli addon eases the construction of these objects on your acceptance tests.","fork":false,"url":"https://api.github.com/repos/san650/ember-cli-page-object","forks_url":"https://api.github.com/repos/san650/ember-cli-page-object/forks","keys_url":"https://api.github.com/repos/san650/ember-cli-page-object/keys{/key_id}","collaborators_url":"https://api.github.com/repos/san650/ember-cli-page-object/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/san650/ember-cli-page-object/teams","hooks_url":"https://api.github.com/repos/san650/ember-cli-page-object/hooks","issue_events_url":"https://api.github.com/repos/san650/ember-cli-page-object/issues/events{/number}","events_url":"https://api.github.com/repos/san650/ember-cli-page-object/events","assignees_url":"https://api.github.com/repos/san650/ember-cli-page-object/assignees{/user}","branches_url":"https://api.github.com/repos/san650/ember-cli-page-object/branches{/branch}","tags_url":"https://api.github.com/repos/san650/ember-cli-page-object/tags","blobs_url":"https://api.github.com/repos/san650/ember-cli-page-object/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/san650/ember-cli-page-object/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/san650/ember-cli-page-object/git/refs{/sha}","trees_url":"https://api.github.com/repos/san650/ember-cli-page-object/git/trees{/sha}","statuses_url":"https://api.github.com/repos/san650/ember-cli-page-object/statuses/{sha}","languages_url":"https://api.github.com/repos/san650/ember-cli-page-object/languages","stargazers_url":"https://api.github.com/repos/san650/ember-cli-page-object/stargazers","contributors_url":"https://api.github.com/repos/san650/ember-cli-page-object/contributors","subscribers_url":"https://api.github.com/repos/san650/ember-cli-page-object/subscribers","subscription_url":"https://api.github.com/repos/san650/ember-cli-page-object/subscription","commits_url":"https://api.github.com/repos/san650/ember-cli-page-object/commits{/sha}","git_commits_url":"https://api.github.com/repos/san650/ember-cli-page-object/git/commits{/sha}","comments_url":"https://api.github.com/repos/san650/ember-cli-page-object/comments{/number}","issue_comment_url":"https://api.github.com/repos/san650/ember-cli-page-object/issues/comments{/number}","contents_url":"https://api.github.com/repos/san650/ember-cli-page-object/contents/{+path}","compare_url":"https://api.github.com/repos/san650/ember-cli-page-object/compare/{base}...{head}","merges_url":"https://api.github.com/repos/san650/ember-cli-page-object/merges","archive_url":"https://api.github.com/repos/san650/ember-cli-page-object/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/san650/ember-cli-page-object/downloads","issues_url":"https://api.github.com/repos/san650/ember-cli-page-object/issues{/number}","pulls_url":"https://api.github.com/repos/san650/ember-cli-page-object/pulls{/number}","milestones_url":"https://api.github.com/repos/san650/ember-cli-page-object/milestones{/number}","notifications_url":"https://api.github.com/repos/san650/ember-cli-page-object/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/san650/ember-cli-page-object/labels{/name}","releases_url":"https://api.github.com/repos/san650/ember-cli-page-object/releases{/id}","deployments_url":"https://api.github.com/repos/san650/ember-cli-page-object/deployments","created_at":"2015-05-03T13:12:43Z","updated_at":"2016-02-02T03:43:29Z","pushed_at":"2016-02-02T19:58:49Z","git_url":"git://github.com/san650/ember-cli-page-object.git","ssh_url":"git@github.com:san650/ember-cli-page-object.git","clone_url":"https://github.com/san650/ember-cli-page-object.git","svn_url":"https://github.com/san650/ember-cli-page-object","homepage":"http://ember-cli-page-object.js.org/","size":966,"stargazers_count":118,"watchers_count":118,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":23,"mirror_url":null,"open_issues_count":20,"forks":23,"open_issues":20,"watchers":118,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/san650/ember-cli-page-object/pulls/99"},"html":{"href":"https://github.com/san650/ember-cli-page-object/pull/99"},"issue":{"href":"https://api.github.com/repos/san650/ember-cli-page-object/issues/99"},"comments":{"href":"https://api.github.com/repos/san650/ember-cli-page-object/issues/99/comments"},"review_comments":{"href":"https://api.github.com/repos/san650/ember-cli-page-object/pulls/99/comments"},"review_comment":{"href":"https://api.github.com/repos/san650/ember-cli-page-object/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/san650/ember-cli-page-object/pulls/99/commits"},"statuses":{"href":"https://api.github.com/repos/san650/ember-cli-page-object/statuses/93eee60dada993594fa5be9c390770e02155b46b"}}}}