{"action":"created","comment":{"url":"https://api.github.com/repos/palantir/plottable/pulls/comments/39239688","id":39239688,"diff_hunk":"@@ -1,115 +1,166 @@\n ///<reference path=\"../testReference.ts\" />\n \n-function assertComponentXY(component: Plottable.Component, x: number, y: number, message: string) {\n-  // use <any> to examine the private variables\n-  let translate = d3.transform((<any> component)._element.attr(\"transform\")).translate;\n-  let xActual = translate[0];\n-  let yActual = translate[1];\n-  assert.strictEqual(xActual, x, \"X: \" + message);\n-  assert.strictEqual(yActual, y, \"Y: \" + message);\n-}\n-\n-describe(\"Component behavior\", () => {\n-  let svg: d3.Selection<void>;\n+describe(\"Component\", () => {\n   let c: Plottable.Component;\n   let SVG_WIDTH = 400;\n   let SVG_HEIGHT = 300;\n+  let svg: d3.Selection<void>;\n   beforeEach(() => {\n-    svg = TestMethods.generateSVG(SVG_WIDTH, SVG_HEIGHT);\n     c = new Plottable.Component();\n+    svg = TestMethods.generateSVG(SVG_WIDTH, SVG_HEIGHT);\n   });\n \n-  describe(\"anchor()\", () => {\n-    it(\"anchor()-ing works as expected\", () => {\n+  describe(\"anchoring\", () => {\n+    it(\"adds itself as a child element of the input selection\", () => {\n+      assert.strictEqual(c.anchor(svg), c, \"setter returns calling object\");\n+      assert.strictEqual(Plottable.Utils.DOM.boundingSVG(<SVGElement> c.content().node()),\n+        svg.node(), \"component DOM elements are children of svg element\");\n+      c.destroy();\n+      svg.remove();\n+    });\n+\n+    it(\"adds default selections in the correct order\", () => {\n+      c.anchor(svg);\n+      assert.isFalse(c.foreground().empty(), \"foreground exists in the DOM\");\n+      assert.isFalse(c.background().empty(), \"background exists in the DOM\");\n+      assert.isFalse(c.content().empty(), \"content exists in the DOM\");\n+      assert.isFalse(c.background().select(\".background-fill\").empty(), \"background fill container exists in the DOM\");\n+\n+      let componentElement = svg.select(\".component\");\n+      let containers = componentElement.selectAll(\"g\");\n+      assert.strictEqual(containers[0][0], c.background().node(), \"background at the back\");\n+      assert.strictEqual(containers[0][1], c.content().node(), \"content at the middle\");\n+      assert.strictEqual(containers[0][2], c.foreground().node(), \"foreground at the front\");\n+      assert.strictEqual(containers[0][3], componentElement.select(\".box-container\").node(), \"boxes at front of foreground\");\n+      c.destroy();\n+      svg.remove();\n+    });\n+\n+    it(\"classes the input with 'plottable' if it is an svg\", () => {\n       c.anchor(svg);\n-      assert.strictEqual((<any> c)._element.node(), svg.select(\"g\").node(), \"the component anchored to a <g> beneath the <svg>\");\n       assert.isTrue(svg.classed(\"plottable\"), \"<svg> was given \\\"plottable\\\" CSS class\");\n-      const computedStyle = window.getComputedStyle(<Element>svg.node());\n+      c.destroy();\n+      svg.remove();\n+    });\n+\n+    it(\"allows mouse events to operate if the component is visible\", () => {\n+      c.anchor(svg);\n+      let computedStyle = window.getComputedStyle(<Element>svg.node());\n       assert.strictEqual(computedStyle.pointerEvents.toLowerCase(), \"visiblefill\",\n         \"\\\"pointer-events\\\" style set to \\\"visiblefill\\\"\");\n+      c.destroy();\n       svg.remove();\n     });\n \n-    it(\"can re-anchor() to a different element\", () => {\n+    it(\"can switch which element it is anchored to\", () => {\n       c.anchor(svg);\n \n       let svg2 = TestMethods.generateSVG(SVG_WIDTH, SVG_HEIGHT);\n       c.anchor(svg2);\n-      assert.strictEqual((<any> c)._element.node(), svg2.select(\"g\").node(), \"the component re-achored under the second <svg>\");\n-      assert.isTrue(svg2.classed(\"plottable\"), \"second <svg> was given \\\"plottable\\\" CSS class\");\n-      const computedStyle = window.getComputedStyle(<Element>svg2.node());\n-      assert.strictEqual(computedStyle.pointerEvents.toLowerCase(), \"visiblefill\",\n-        \"second <svg>'s \\\"pointer-events\\\" style set to \\\"visiblefill\\\"\");\n-\n-      svg.remove();\n+      assert.notStrictEqual(Plottable.Utils.DOM.boundingSVG(<SVGElement> c.content().node()),\n+        svg.node(), \"component DOM elements are not children of svg element\");\n+      assert.strictEqual(Plottable.Utils.DOM.boundingSVG(<SVGElement> c.content().node()),\n+        svg2.node(), \"component DOM elements are children of second svg element\");\n+      c.destroy();\n       svg2.remove();\n+      svg.remove();\n     });\n \n-    describe(\"anchor() callbacks\", () => {\n-      it(\"callbacks called on anchor()-ing\", () => {\n+      it(\"can undergo set behavior upon anchoring\", () => {","path":"test/components/componentTests.ts","position":95,"original_position":95,"commit_id":"319f776ec1befc60a78af6b426ab386e01abc7eb","original_commit_id":"319f776ec1befc60a78af6b426ab386e01abc7eb","user":{"login":"ztsai","id":1817638,"avatar_url":"https://avatars.githubusercontent.com/u/1817638?v=3","gravatar_id":"","url":"https://api.github.com/users/ztsai","html_url":"https://github.com/ztsai","followers_url":"https://api.github.com/users/ztsai/followers","following_url":"https://api.github.com/users/ztsai/following{/other_user}","gists_url":"https://api.github.com/users/ztsai/gists{/gist_id}","starred_url":"https://api.github.com/users/ztsai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ztsai/subscriptions","organizations_url":"https://api.github.com/users/ztsai/orgs","repos_url":"https://api.github.com/users/ztsai/repos","events_url":"https://api.github.com/users/ztsai/events{/privacy}","received_events_url":"https://api.github.com/users/ztsai/received_events","type":"User","site_admin":false},"body":"indent","created_at":"2015-09-11T03:59:22Z","updated_at":"2015-09-11T03:59:22Z","html_url":"https://github.com/palantir/plottable/pull/2722#discussion_r39239688","pull_request_url":"https://api.github.com/repos/palantir/plottable/pulls/2722","_links":{"self":{"href":"https://api.github.com/repos/palantir/plottable/pulls/comments/39239688"},"html":{"href":"https://github.com/palantir/plottable/pull/2722#discussion_r39239688"},"pull_request":{"href":"https://api.github.com/repos/palantir/plottable/pulls/2722"}}},"pull_request":{"url":"https://api.github.com/repos/palantir/plottable/pulls/2722","id":44192779,"html_url":"https://github.com/palantir/plottable/pull/2722","diff_url":"https://github.com/palantir/plottable/pull/2722.diff","patch_url":"https://github.com/palantir/plottable/pull/2722.patch","issue_url":"https://api.github.com/repos/palantir/plottable/issues/2722","number":2722,"state":"open","locked":false,"title":"[Component Tests] - revamping","user":{"login":"bluong","id":1448299,"avatar_url":"https://avatars.githubusercontent.com/u/1448299?v=3","gravatar_id":"","url":"https://api.github.com/users/bluong","html_url":"https://github.com/bluong","followers_url":"https://api.github.com/users/bluong/followers","following_url":"https://api.github.com/users/bluong/following{/other_user}","gists_url":"https://api.github.com/users/bluong/gists{/gist_id}","starred_url":"https://api.github.com/users/bluong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluong/subscriptions","organizations_url":"https://api.github.com/users/bluong/orgs","repos_url":"https://api.github.com/users/bluong/repos","events_url":"https://api.github.com/users/bluong/events{/privacy}","received_events_url":"https://api.github.com/users/bluong/received_events","type":"User","site_admin":false},"body":"Fixes #2626 ","created_at":"2015-09-04T08:15:25Z","updated_at":"2015-09-11T03:59:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"08b74db221ee1fa61b644c4a67c3c22057174f34","assignee":{"login":"bluong","id":1448299,"avatar_url":"https://avatars.githubusercontent.com/u/1448299?v=3","gravatar_id":"","url":"https://api.github.com/users/bluong","html_url":"https://github.com/bluong","followers_url":"https://api.github.com/users/bluong/followers","following_url":"https://api.github.com/users/bluong/following{/other_user}","gists_url":"https://api.github.com/users/bluong/gists{/gist_id}","starred_url":"https://api.github.com/users/bluong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluong/subscriptions","organizations_url":"https://api.github.com/users/bluong/orgs","repos_url":"https://api.github.com/users/bluong/repos","events_url":"https://api.github.com/users/bluong/events{/privacy}","received_events_url":"https://api.github.com/users/bluong/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/palantir/plottable/milestones/50","html_url":"https://github.com/palantir/plottable/milestones/v1.11.0","labels_url":"https://api.github.com/repos/palantir/plottable/milestones/50/labels","id":1270446,"number":50,"title":"v1.11.0","description":"","creator":{"login":"christinaforney","id":1559622,"avatar_url":"https://avatars.githubusercontent.com/u/1559622?v=3","gravatar_id":"","url":"https://api.github.com/users/christinaforney","html_url":"https://github.com/christinaforney","followers_url":"https://api.github.com/users/christinaforney/followers","following_url":"https://api.github.com/users/christinaforney/following{/other_user}","gists_url":"https://api.github.com/users/christinaforney/gists{/gist_id}","starred_url":"https://api.github.com/users/christinaforney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christinaforney/subscriptions","organizations_url":"https://api.github.com/users/christinaforney/orgs","repos_url":"https://api.github.com/users/christinaforney/repos","events_url":"https://api.github.com/users/christinaforney/events{/privacy}","received_events_url":"https://api.github.com/users/christinaforney/received_events","type":"User","site_admin":false},"open_issues":13,"closed_issues":2,"state":"open","created_at":"2015-08-24T21:48:10Z","updated_at":"2015-09-11T01:41:07Z","due_on":"2015-09-11T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/palantir/plottable/pulls/2722/commits","review_comments_url":"https://api.github.com/repos/palantir/plottable/pulls/2722/comments","review_comment_url":"https://api.github.com/repos/palantir/plottable/pulls/comments{/number}","comments_url":"https://api.github.com/repos/palantir/plottable/issues/2722/comments","statuses_url":"https://api.github.com/repos/palantir/plottable/statuses/319f776ec1befc60a78af6b426ab386e01abc7eb","head":{"label":"palantir:componentTests","ref":"componentTests","sha":"319f776ec1befc60a78af6b426ab386e01abc7eb","user":{"login":"palantir","id":303157,"avatar_url":"https://avatars.githubusercontent.com/u/303157?v=3","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"repo":{"id":16149854,"name":"plottable","full_name":"palantir/plottable","owner":{"login":"palantir","id":303157,"avatar_url":"https://avatars.githubusercontent.com/u/303157?v=3","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/palantir/plottable","description":"A library of modular chart components, built on D3","fork":false,"url":"https://api.github.com/repos/palantir/plottable","forks_url":"https://api.github.com/repos/palantir/plottable/forks","keys_url":"https://api.github.com/repos/palantir/plottable/keys{/key_id}","collaborators_url":"https://api.github.com/repos/palantir/plottable/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/palantir/plottable/teams","hooks_url":"https://api.github.com/repos/palantir/plottable/hooks","issue_events_url":"https://api.github.com/repos/palantir/plottable/issues/events{/number}","events_url":"https://api.github.com/repos/palantir/plottable/events","assignees_url":"https://api.github.com/repos/palantir/plottable/assignees{/user}","branches_url":"https://api.github.com/repos/palantir/plottable/branches{/branch}","tags_url":"https://api.github.com/repos/palantir/plottable/tags","blobs_url":"https://api.github.com/repos/palantir/plottable/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/palantir/plottable/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/palantir/plottable/git/refs{/sha}","trees_url":"https://api.github.com/repos/palantir/plottable/git/trees{/sha}","statuses_url":"https://api.github.com/repos/palantir/plottable/statuses/{sha}","languages_url":"https://api.github.com/repos/palantir/plottable/languages","stargazers_url":"https://api.github.com/repos/palantir/plottable/stargazers","contributors_url":"https://api.github.com/repos/palantir/plottable/contributors","subscribers_url":"https://api.github.com/repos/palantir/plottable/subscribers","subscription_url":"https://api.github.com/repos/palantir/plottable/subscription","commits_url":"https://api.github.com/repos/palantir/plottable/commits{/sha}","git_commits_url":"https://api.github.com/repos/palantir/plottable/git/commits{/sha}","comments_url":"https://api.github.com/repos/palantir/plottable/comments{/number}","issue_comment_url":"https://api.github.com/repos/palantir/plottable/issues/comments{/number}","contents_url":"https://api.github.com/repos/palantir/plottable/contents/{+path}","compare_url":"https://api.github.com/repos/palantir/plottable/compare/{base}...{head}","merges_url":"https://api.github.com/repos/palantir/plottable/merges","archive_url":"https://api.github.com/repos/palantir/plottable/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/palantir/plottable/downloads","issues_url":"https://api.github.com/repos/palantir/plottable/issues{/number}","pulls_url":"https://api.github.com/repos/palantir/plottable/pulls{/number}","milestones_url":"https://api.github.com/repos/palantir/plottable/milestones{/number}","notifications_url":"https://api.github.com/repos/palantir/plottable/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/palantir/plottable/labels{/name}","releases_url":"https://api.github.com/repos/palantir/plottable/releases{/id}","created_at":"2014-01-22T19:29:19Z","updated_at":"2015-09-10T18:18:33Z","pushed_at":"2015-09-11T02:04:23Z","git_url":"git://github.com/palantir/plottable.git","ssh_url":"git@github.com:palantir/plottable.git","clone_url":"https://github.com/palantir/plottable.git","svn_url":"https://github.com/palantir/plottable","homepage":"plottablejs.org","size":133559,"stargazers_count":715,"watchers_count":715,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":74,"mirror_url":null,"open_issues_count":195,"forks":74,"open_issues":195,"watchers":715,"default_branch":"develop"}},"base":{"label":"palantir:develop","ref":"develop","sha":"069f165e37b862953d1dd34e4b4d45b652b29c3d","user":{"login":"palantir","id":303157,"avatar_url":"https://avatars.githubusercontent.com/u/303157?v=3","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"repo":{"id":16149854,"name":"plottable","full_name":"palantir/plottable","owner":{"login":"palantir","id":303157,"avatar_url":"https://avatars.githubusercontent.com/u/303157?v=3","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/palantir/plottable","description":"A library of modular chart components, built on D3","fork":false,"url":"https://api.github.com/repos/palantir/plottable","forks_url":"https://api.github.com/repos/palantir/plottable/forks","keys_url":"https://api.github.com/repos/palantir/plottable/keys{/key_id}","collaborators_url":"https://api.github.com/repos/palantir/plottable/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/palantir/plottable/teams","hooks_url":"https://api.github.com/repos/palantir/plottable/hooks","issue_events_url":"https://api.github.com/repos/palantir/plottable/issues/events{/number}","events_url":"https://api.github.com/repos/palantir/plottable/events","assignees_url":"https://api.github.com/repos/palantir/plottable/assignees{/user}","branches_url":"https://api.github.com/repos/palantir/plottable/branches{/branch}","tags_url":"https://api.github.com/repos/palantir/plottable/tags","blobs_url":"https://api.github.com/repos/palantir/plottable/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/palantir/plottable/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/palantir/plottable/git/refs{/sha}","trees_url":"https://api.github.com/repos/palantir/plottable/git/trees{/sha}","statuses_url":"https://api.github.com/repos/palantir/plottable/statuses/{sha}","languages_url":"https://api.github.com/repos/palantir/plottable/languages","stargazers_url":"https://api.github.com/repos/palantir/plottable/stargazers","contributors_url":"https://api.github.com/repos/palantir/plottable/contributors","subscribers_url":"https://api.github.com/repos/palantir/plottable/subscribers","subscription_url":"https://api.github.com/repos/palantir/plottable/subscription","commits_url":"https://api.github.com/repos/palantir/plottable/commits{/sha}","git_commits_url":"https://api.github.com/repos/palantir/plottable/git/commits{/sha}","comments_url":"https://api.github.com/repos/palantir/plottable/comments{/number}","issue_comment_url":"https://api.github.com/repos/palantir/plottable/issues/comments{/number}","contents_url":"https://api.github.com/repos/palantir/plottable/contents/{+path}","compare_url":"https://api.github.com/repos/palantir/plottable/compare/{base}...{head}","merges_url":"https://api.github.com/repos/palantir/plottable/merges","archive_url":"https://api.github.com/repos/palantir/plottable/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/palantir/plottable/downloads","issues_url":"https://api.github.com/repos/palantir/plottable/issues{/number}","pulls_url":"https://api.github.com/repos/palantir/plottable/pulls{/number}","milestones_url":"https://api.github.com/repos/palantir/plottable/milestones{/number}","notifications_url":"https://api.github.com/repos/palantir/plottable/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/palantir/plottable/labels{/name}","releases_url":"https://api.github.com/repos/palantir/plottable/releases{/id}","created_at":"2014-01-22T19:29:19Z","updated_at":"2015-09-10T18:18:33Z","pushed_at":"2015-09-11T02:04:23Z","git_url":"git://github.com/palantir/plottable.git","ssh_url":"git@github.com:palantir/plottable.git","clone_url":"https://github.com/palantir/plottable.git","svn_url":"https://github.com/palantir/plottable","homepage":"plottablejs.org","size":133559,"stargazers_count":715,"watchers_count":715,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":74,"mirror_url":null,"open_issues_count":195,"forks":74,"open_issues":195,"watchers":715,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/palantir/plottable/pulls/2722"},"html":{"href":"https://github.com/palantir/plottable/pull/2722"},"issue":{"href":"https://api.github.com/repos/palantir/plottable/issues/2722"},"comments":{"href":"https://api.github.com/repos/palantir/plottable/issues/2722/comments"},"review_comments":{"href":"https://api.github.com/repos/palantir/plottable/pulls/2722/comments"},"review_comment":{"href":"https://api.github.com/repos/palantir/plottable/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/palantir/plottable/pulls/2722/commits"},"statuses":{"href":"https://api.github.com/repos/palantir/plottable/statuses/319f776ec1befc60a78af6b426ab386e01abc7eb"}}}}