{"action":"created","comment":{"url":"https://api.github.com/repos/angular/angular/pulls/comments/27159558","id":27159558,"diff_hunk":"@@ -0,0 +1,86 @@\n+import {DOM} from 'angular2/src/dom/dom_adapter';\n+import {Map, MapWrapper, List, ListWrapper} from 'angular2/src/facade/collection';\n+import {StringWrapper, isBlank, BaseException} from 'angular2/src/facade/lang';\n+import * as getTestabilityModule from 'angular2/src/core/testability/get_testability';\n+\n+\n+/**\n+ * The Testability service provides testing hooks that can be accessed from\n+ * the browser and by services such as Protractor. Each bootstrapped Angular\n+ * application on the page will have an instance of Testability.\n+ */\n+export class Testability {\n+  _pendingCount: number;\n+  _callbacks: List;\n+\n+  constructor() {\n+    this._pendingCount = 0;\n+    this._callbacks = ListWrapper.create();\n+  }\n+\n+  increaseCount(delta: number) {\n+    if (isBlank(delta)) {\n+      delta = 1;\n+    }\n+    this._pendingCount += delta;\n+    if (this._pendingCount < 0) {\n+      throw new BaseException('pending async requests below zero');\n+    } else if (this._pendingCount == 0) {\n+      this._runCallbacks();\n+    }\n+    return this._pendingCount;\n+  }\n+\n+  _runCallbacks() {\n+    while (this._callbacks.length !== 0) {\n+      ListWrapper.removeLast(this._callbacks)();\n+    }\n+  }\n+\n+  whenStable(callback: Function) {\n+    ListWrapper.push(this._callbacks, callback);\n+\n+    if (this._pendingCount === 0) {\n+      this._runCallbacks();\n+    }\n+    // TODO(juliemr) - hook into the zone api.\n+  }\n+\n+  findBindings(using, binding: string, exactMatch: boolean) {\n+    // TODO(juliemr): implement.\n+    return [];\n+  }\n+\n+  findModels(using, binding: string, exactMatch: boolean) {\n+    // TODO(juliemr): When forms are finalized, decide if something belongs\n+    // here.\n+    return [];\n+  }\n+}\n+\n+export class TestabilityRegistry {\n+  _applications: Map;\n+\n+  constructor() {\n+    this._applications = new Map();\n+\n+    getTestabilityModule.GetTestability.addToWindow(this);\n+  }\n+\n+  registerApplication(token, testability) {","path":"modules/angular2/src/core/testability/testability.js","position":70,"original_position":70,"commit_id":"e6153cca1e60e191840b82528a1514e3c7fa3434","original_commit_id":"e6153cca1e60e191840b82528a1514e3c7fa3434","user":{"login":"juliemr","id":2081709,"avatar_url":"https://avatars.githubusercontent.com/u/2081709?v=3","gravatar_id":"","url":"https://api.github.com/users/juliemr","html_url":"https://github.com/juliemr","followers_url":"https://api.github.com/users/juliemr/followers","following_url":"https://api.github.com/users/juliemr/following{/other_user}","gists_url":"https://api.github.com/users/juliemr/gists{/gist_id}","starred_url":"https://api.github.com/users/juliemr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juliemr/subscriptions","organizations_url":"https://api.github.com/users/juliemr/orgs","repos_url":"https://api.github.com/users/juliemr/repos","events_url":"https://api.github.com/users/juliemr/events{/privacy}","received_events_url":"https://api.github.com/users/juliemr/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2015-03-25T20:00:34Z","updated_at":"2015-03-25T20:00:34Z","html_url":"https://github.com/angular/angular/pull/1086#discussion_r27159558","pull_request_url":"https://api.github.com/repos/angular/angular/pulls/1086","_links":{"self":{"href":"https://api.github.com/repos/angular/angular/pulls/comments/27159558"},"html":{"href":"https://github.com/angular/angular/pull/1086#discussion_r27159558"},"pull_request":{"href":"https://api.github.com/repos/angular/angular/pulls/1086"}}},"pull_request":{"url":"https://api.github.com/repos/angular/angular/pulls/1086","id":31876829,"html_url":"https://github.com/angular/angular/pull/1086","diff_url":"https://github.com/angular/angular/pull/1086.diff","patch_url":"https://github.com/angular/angular/pull/1086.patch","issue_url":"https://api.github.com/repos/angular/angular/issues/1086","number":1086,"state":"open","locked":false,"title":"feat(testability): add an initial scaffold for the testability api","user":{"login":"juliemr","id":2081709,"avatar_url":"https://avatars.githubusercontent.com/u/2081709?v=3","gravatar_id":"","url":"https://api.github.com/users/juliemr","html_url":"https://github.com/juliemr","followers_url":"https://api.github.com/users/juliemr/followers","following_url":"https://api.github.com/users/juliemr/following{/other_user}","gists_url":"https://api.github.com/users/juliemr/gists{/gist_id}","starred_url":"https://api.github.com/users/juliemr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juliemr/subscriptions","organizations_url":"https://api.github.com/users/juliemr/orgs","repos_url":"https://api.github.com/users/juliemr/repos","events_url":"https://api.github.com/users/juliemr/events{/privacy}","received_events_url":"https://api.github.com/users/juliemr/received_events","type":"User","site_admin":false},"body":"Make each application component register itself onto the testability\r\nAPI and exports the API onto the window object.\r\n\r\nThis is currently a work in progress - JS is working great, needs to fix up the Dart stuff.","created_at":"2015-03-24T22:29:51Z","updated_at":"2015-03-25T20:00:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/angular/angular/pulls/1086/commits","review_comments_url":"https://api.github.com/repos/angular/angular/pulls/1086/comments","review_comment_url":"https://api.github.com/repos/angular/angular/pulls/comments{/number}","comments_url":"https://api.github.com/repos/angular/angular/issues/1086/comments","statuses_url":"https://api.github.com/repos/angular/angular/statuses/e6153cca1e60e191840b82528a1514e3c7fa3434","head":{"label":"juliemr:testabilitywindow","ref":"testabilitywindow","sha":"e6153cca1e60e191840b82528a1514e3c7fa3434","user":{"login":"juliemr","id":2081709,"avatar_url":"https://avatars.githubusercontent.com/u/2081709?v=3","gravatar_id":"","url":"https://api.github.com/users/juliemr","html_url":"https://github.com/juliemr","followers_url":"https://api.github.com/users/juliemr/followers","following_url":"https://api.github.com/users/juliemr/following{/other_user}","gists_url":"https://api.github.com/users/juliemr/gists{/gist_id}","starred_url":"https://api.github.com/users/juliemr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juliemr/subscriptions","organizations_url":"https://api.github.com/users/juliemr/orgs","repos_url":"https://api.github.com/users/juliemr/repos","events_url":"https://api.github.com/users/juliemr/events{/privacy}","received_events_url":"https://api.github.com/users/juliemr/received_events","type":"User","site_admin":false},"repo":{"id":28985296,"name":"angular","full_name":"juliemr/angular","owner":{"login":"juliemr","id":2081709,"avatar_url":"https://avatars.githubusercontent.com/u/2081709?v=3","gravatar_id":"","url":"https://api.github.com/users/juliemr","html_url":"https://github.com/juliemr","followers_url":"https://api.github.com/users/juliemr/followers","following_url":"https://api.github.com/users/juliemr/following{/other_user}","gists_url":"https://api.github.com/users/juliemr/gists{/gist_id}","starred_url":"https://api.github.com/users/juliemr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juliemr/subscriptions","organizations_url":"https://api.github.com/users/juliemr/orgs","repos_url":"https://api.github.com/users/juliemr/repos","events_url":"https://api.github.com/users/juliemr/events{/privacy}","received_events_url":"https://api.github.com/users/juliemr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/juliemr/angular","description":"","fork":true,"url":"https://api.github.com/repos/juliemr/angular","forks_url":"https://api.github.com/repos/juliemr/angular/forks","keys_url":"https://api.github.com/repos/juliemr/angular/keys{/key_id}","collaborators_url":"https://api.github.com/repos/juliemr/angular/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/juliemr/angular/teams","hooks_url":"https://api.github.com/repos/juliemr/angular/hooks","issue_events_url":"https://api.github.com/repos/juliemr/angular/issues/events{/number}","events_url":"https://api.github.com/repos/juliemr/angular/events","assignees_url":"https://api.github.com/repos/juliemr/angular/assignees{/user}","branches_url":"https://api.github.com/repos/juliemr/angular/branches{/branch}","tags_url":"https://api.github.com/repos/juliemr/angular/tags","blobs_url":"https://api.github.com/repos/juliemr/angular/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/juliemr/angular/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/juliemr/angular/git/refs{/sha}","trees_url":"https://api.github.com/repos/juliemr/angular/git/trees{/sha}","statuses_url":"https://api.github.com/repos/juliemr/angular/statuses/{sha}","languages_url":"https://api.github.com/repos/juliemr/angular/languages","stargazers_url":"https://api.github.com/repos/juliemr/angular/stargazers","contributors_url":"https://api.github.com/repos/juliemr/angular/contributors","subscribers_url":"https://api.github.com/repos/juliemr/angular/subscribers","subscription_url":"https://api.github.com/repos/juliemr/angular/subscription","commits_url":"https://api.github.com/repos/juliemr/angular/commits{/sha}","git_commits_url":"https://api.github.com/repos/juliemr/angular/git/commits{/sha}","comments_url":"https://api.github.com/repos/juliemr/angular/comments{/number}","issue_comment_url":"https://api.github.com/repos/juliemr/angular/issues/comments{/number}","contents_url":"https://api.github.com/repos/juliemr/angular/contents/{+path}","compare_url":"https://api.github.com/repos/juliemr/angular/compare/{base}...{head}","merges_url":"https://api.github.com/repos/juliemr/angular/merges","archive_url":"https://api.github.com/repos/juliemr/angular/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/juliemr/angular/downloads","issues_url":"https://api.github.com/repos/juliemr/angular/issues{/number}","pulls_url":"https://api.github.com/repos/juliemr/angular/pulls{/number}","milestones_url":"https://api.github.com/repos/juliemr/angular/milestones{/number}","notifications_url":"https://api.github.com/repos/juliemr/angular/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/juliemr/angular/labels{/name}","releases_url":"https://api.github.com/repos/juliemr/angular/releases{/id}","created_at":"2015-01-08T20:46:47Z","updated_at":"2015-01-08T20:46:47Z","pushed_at":"2015-03-25T00:24:45Z","git_url":"git://github.com/juliemr/angular.git","ssh_url":"git@github.com:juliemr/angular.git","clone_url":"https://github.com/juliemr/angular.git","svn_url":"https://github.com/juliemr/angular","homepage":null,"size":3197,"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":"angular:master","ref":"master","sha":"f995b07876bfa61245eba237cc36bf9890683bf6","user":{"login":"angular","id":139426,"avatar_url":"https://avatars.githubusercontent.com/u/139426?v=3","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":24195339,"name":"angular","full_name":"angular/angular","owner":{"login":"angular","id":139426,"avatar_url":"https://avatars.githubusercontent.com/u/139426?v=3","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/angular","description":"","fork":false,"url":"https://api.github.com/repos/angular/angular","forks_url":"https://api.github.com/repos/angular/angular/forks","keys_url":"https://api.github.com/repos/angular/angular/keys{/key_id}","collaborators_url":"https://api.github.com/repos/angular/angular/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/angular/angular/teams","hooks_url":"https://api.github.com/repos/angular/angular/hooks","issue_events_url":"https://api.github.com/repos/angular/angular/issues/events{/number}","events_url":"https://api.github.com/repos/angular/angular/events","assignees_url":"https://api.github.com/repos/angular/angular/assignees{/user}","branches_url":"https://api.github.com/repos/angular/angular/branches{/branch}","tags_url":"https://api.github.com/repos/angular/angular/tags","blobs_url":"https://api.github.com/repos/angular/angular/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/angular/angular/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/angular/angular/git/refs{/sha}","trees_url":"https://api.github.com/repos/angular/angular/git/trees{/sha}","statuses_url":"https://api.github.com/repos/angular/angular/statuses/{sha}","languages_url":"https://api.github.com/repos/angular/angular/languages","stargazers_url":"https://api.github.com/repos/angular/angular/stargazers","contributors_url":"https://api.github.com/repos/angular/angular/contributors","subscribers_url":"https://api.github.com/repos/angular/angular/subscribers","subscription_url":"https://api.github.com/repos/angular/angular/subscription","commits_url":"https://api.github.com/repos/angular/angular/commits{/sha}","git_commits_url":"https://api.github.com/repos/angular/angular/git/commits{/sha}","comments_url":"https://api.github.com/repos/angular/angular/comments{/number}","issue_comment_url":"https://api.github.com/repos/angular/angular/issues/comments{/number}","contents_url":"https://api.github.com/repos/angular/angular/contents/{+path}","compare_url":"https://api.github.com/repos/angular/angular/compare/{base}...{head}","merges_url":"https://api.github.com/repos/angular/angular/merges","archive_url":"https://api.github.com/repos/angular/angular/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/angular/angular/downloads","issues_url":"https://api.github.com/repos/angular/angular/issues{/number}","pulls_url":"https://api.github.com/repos/angular/angular/pulls{/number}","milestones_url":"https://api.github.com/repos/angular/angular/milestones{/number}","notifications_url":"https://api.github.com/repos/angular/angular/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/angular/angular/labels{/name}","releases_url":"https://api.github.com/repos/angular/angular/releases{/id}","created_at":"2014-09-18T16:12:01Z","updated_at":"2015-03-25T19:59:02Z","pushed_at":"2015-03-25T18:42:00Z","git_url":"git://github.com/angular/angular.git","ssh_url":"git@github.com:angular/angular.git","clone_url":"https://github.com/angular/angular.git","svn_url":"https://github.com/angular/angular","homepage":null,"size":12876,"stargazers_count":2073,"watchers_count":2073,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":470,"mirror_url":null,"open_issues_count":223,"forks":470,"open_issues":223,"watchers":2073,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/angular/angular/pulls/1086"},"html":{"href":"https://github.com/angular/angular/pull/1086"},"issue":{"href":"https://api.github.com/repos/angular/angular/issues/1086"},"comments":{"href":"https://api.github.com/repos/angular/angular/issues/1086/comments"},"review_comments":{"href":"https://api.github.com/repos/angular/angular/pulls/1086/comments"},"review_comment":{"href":"https://api.github.com/repos/angular/angular/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/angular/angular/pulls/1086/commits"},"statuses":{"href":"https://api.github.com/repos/angular/angular/statuses/e6153cca1e60e191840b82528a1514e3c7fa3434"}}}}