{"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/comments/22456568","id":22456568,"diff_hunk":"@@ -0,0 +1,147 @@\n+define([\n+    'jquery', 'underscore', 'js/common_helpers/ajax_helpers', 'js/edxnotes/views/search_box',\n+    'js/edxnotes/collections/notes', 'js/spec/edxnotes/custom_matchers', 'jasmine-jquery'\n+], function($, _, AjaxHelpers, SearchBoxView, NotesCollection, customMatchers) {\n+    'use strict';\n+    describe('EdxNotes SearchBoxView', function() {\n+        var getSearchBox, submitForm, assertBoxIsEnabled, assertBoxIsDisabled;\n+\n+        getSearchBox = function (options) {\n+            options = _.defaults(options || {}, {\n+                el: $('#search-notes-form').get(0),\n+                beforeSearchStart: jasmine.createSpy(),\n+                search: jasmine.createSpy(),\n+                error: jasmine.createSpy(),\n+                complete: jasmine.createSpy()\n+            });\n+\n+            return new SearchBoxView(options);\n+        };\n+\n+        submitForm = function (searchBox, text) {\n+            searchBox.$('.search-notes-input').val(text);\n+            searchBox.$('.search-notes-submit').click();\n+        };\n+\n+        assertBoxIsEnabled = function (searchBox) {\n+            expect(searchBox.$el).not.toHaveClass('is-looking');\n+            expect(searchBox.$('.search-notes-submit')).not.toHaveClass('is-disabled');\n+            expect(searchBox.isDisabled).toBeFalsy();\n+        };\n+\n+        assertBoxIsDisabled = function (searchBox) {\n+            expect(searchBox.$el).toHaveClass('is-looking');\n+            expect(searchBox.$('.search-notes-submit')).toHaveClass('is-disabled');\n+            expect(searchBox.isDisabled).toBeTruthy();\n+        };\n+\n+        beforeEach(function () {\n+            customMatchers(this);\n+            loadFixtures('js/fixtures/edxnotes/edxnotes.html');\n+            this.searchBox = getSearchBox();\n+        });\n+\n+        it('sends a request with proper information on submit the form', function () {\n+            var requests = AjaxHelpers.requests(this),\n+                form = this.searchBox.el,\n+                request;\n+\n+            submitForm(this.searchBox, 'test_text');\n+            request = requests[0];\n+            expect(request.method).toBe(form.method.toUpperCase());\n+            expect(request.url).toBe(form.action + '?' + $.param({text: 'test_text'}));\n+        });\n+\n+        it('returns success result', function () {\n+            var requests = AjaxHelpers.requests(this);\n+            submitForm(this.searchBox, 'test_text');\n+            expect(this.searchBox.options.beforeSearchStart).toHaveBeenCalledWith(\n+                'test_text'\n+            );\n+            assertBoxIsDisabled(this.searchBox);\n+            AjaxHelpers.respondWithJson(requests, {\n+                total: 2,\n+                rows: [null, null]\n+            });\n+            assertBoxIsEnabled(this.searchBox);\n+            expect(this.searchBox.options.search).toHaveBeenCalledWith(\n+                jasmine.any(NotesCollection), 2, 'test_text'\n+            );\n+            expect(this.searchBox.options.complete).toHaveBeenCalledWith(\n+                'test_text'\n+            );\n+        });\n+\n+        it('returns default error message if received data structure is wrong', function () {\n+            var requests = AjaxHelpers.requests(this);\n+            submitForm(this.searchBox, 'test_text');\n+            AjaxHelpers.respondWithJson(requests, {});\n+            expect(this.searchBox.options.error).toHaveBeenCalledWith(\n+                'This may be happening because of an error with our server or your internet connection. Try refreshing the page or making sure you are online.',","path":"lms/static/js/spec/edxnotes/views/search_box_spec.js","position":80,"original_position":80,"commit_id":"871ecd7861c86b594a2099ad0ee1a93c0c214cf6","original_commit_id":"2aa3667948f2ab8c64752a7c8864dfc11171cf2b","user":{"login":"jmclaus","id":1427382,"avatar_url":"https://avatars.githubusercontent.com/u/1427382?v=3","gravatar_id":"","url":"https://api.github.com/users/jmclaus","html_url":"https://github.com/jmclaus","followers_url":"https://api.github.com/users/jmclaus/followers","following_url":"https://api.github.com/users/jmclaus/following{/other_user}","gists_url":"https://api.github.com/users/jmclaus/gists{/gist_id}","starred_url":"https://api.github.com/users/jmclaus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmclaus/subscriptions","organizations_url":"https://api.github.com/users/jmclaus/orgs","repos_url":"https://api.github.com/users/jmclaus/repos","events_url":"https://api.github.com/users/jmclaus/events{/privacy}","received_events_url":"https://api.github.com/users/jmclaus/received_events","type":"User","site_admin":false},"body":"@srpearce \r\n> An error has occurred. Make sure that you are connected to the Internet, and then try refreshing the page.\r\n\r\nDone.","created_at":"2015-01-05T11:28:06Z","updated_at":"2015-01-05T11:28:06Z","html_url":"https://github.com/edx/edx-platform/pull/6321#discussion_r22456568","pull_request_url":"https://api.github.com/repos/edx/edx-platform/pulls/6321","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments/22456568"},"html":{"href":"https://github.com/edx/edx-platform/pull/6321#discussion_r22456568"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/6321"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/6321","id":26359046,"html_url":"https://github.com/edx/edx-platform/pull/6321","diff_url":"https://github.com/edx/edx-platform/pull/6321.diff","patch_url":"https://github.com/edx/edx-platform/pull/6321.patch","issue_url":"https://api.github.com/repos/edx/edx-platform/issues/6321","number":6321,"state":"open","locked":false,"title":"TNL-213: Student Notes","user":{"login":"polesye","id":1247491,"avatar_url":"https://avatars.githubusercontent.com/u/1247491?v=3","gravatar_id":"","url":"https://api.github.com/users/polesye","html_url":"https://github.com/polesye","followers_url":"https://api.github.com/users/polesye/followers","following_url":"https://api.github.com/users/polesye/following{/other_user}","gists_url":"https://api.github.com/users/polesye/gists{/gist_id}","starred_url":"https://api.github.com/users/polesye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/polesye/subscriptions","organizations_url":"https://api.github.com/users/polesye/orgs","repos_url":"https://api.github.com/users/polesye/repos","events_url":"https://api.github.com/users/polesye/events{/privacy}","received_events_url":"https://api.github.com/users/polesye/received_events","type":"User","site_admin":false},"body":"**Description**\r\nAdds the ability to make highlights and notes in courseware (only in html components at the moment) and to refer back to later.\r\n[Student Notes](https://openedx.atlassian.net/wiki/display/TNL/Student+Notes)\r\n[Student Notes Testing](https://openedx.atlassian.net/wiki/display/TNL/Student+Notes+Testing)\r\n**sandbox**: http://edxnotes.m.sandbox.edx.org/\r\n\r\n* Platform team review of the XBlock wrapper implementation. XBlock Asides is in the process of merging and we'd planned earlier to use this feature for notes when ready. The scope of the review would be to ensure that the overall implementation from XBlock perspective is still aligned with that goal, and to identify any other concerns related to current/future work on XBlock APIs.\r\n@dmitchell please review\r\n\r\n* TNL overall review - this would be simply to socialize the new functionality and provide an opportunity to identify any conflicts or major questions - NOT a detailed line-for-line review.\r\n@jimabramson , @andy-armstrong , @cahrens, @srpearce please review.\r\n\r\n**TBD:**\r\n* Ensure Harvard Annotations and Student Notes can't be turned on at the same time [TNL-930](https://openedx.atlassian.net/browse/TNL-930) #6340\r\n* Eventing for Student Notes [TNL-931](https://openedx.atlassian.net/browse/TNL-931) #6358 \r\n* Highlight the searched-for text [TNL-973](https://openedx.atlassian.net/browse/TNL-973)\r\n* [UI/UX improvements](https://openedx.atlassian.net/secure/RapidBoard.jspa?rapidView=27&view=planning&quickFilter=255&epics=visible&selectedEpic=UX-955).\r\n\r\n@olmar , @tymofij , @jmclaus  FYI.","created_at":"2014-12-19T09:14:51Z","updated_at":"2015-01-05T11:28:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6839ef8dd61e52a9641ce89f2d2d5fd84571aa08","assignee":{"login":"andy-armstrong","id":5985072,"avatar_url":"https://avatars.githubusercontent.com/u/5985072?v=3","gravatar_id":"","url":"https://api.github.com/users/andy-armstrong","html_url":"https://github.com/andy-armstrong","followers_url":"https://api.github.com/users/andy-armstrong/followers","following_url":"https://api.github.com/users/andy-armstrong/following{/other_user}","gists_url":"https://api.github.com/users/andy-armstrong/gists{/gist_id}","starred_url":"https://api.github.com/users/andy-armstrong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andy-armstrong/subscriptions","organizations_url":"https://api.github.com/users/andy-armstrong/orgs","repos_url":"https://api.github.com/users/andy-armstrong/repos","events_url":"https://api.github.com/users/andy-armstrong/events{/privacy}","received_events_url":"https://api.github.com/users/andy-armstrong/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-platform/pulls/6321/commits","review_comments_url":"https://api.github.com/repos/edx/edx-platform/pulls/6321/comments","review_comment_url":"https://api.github.com/repos/edx/edx-platform/pulls/comments/{number}","comments_url":"https://api.github.com/repos/edx/edx-platform/issues/6321/comments","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/871ecd7861c86b594a2099ad0ee1a93c0c214cf6","head":{"label":"edx:feature/edxnotes","ref":"feature/edxnotes","sha":"871ecd7861c86b594a2099ad0ee1a93c0c214cf6","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":10391073,"name":"edx-platform","full_name":"edx/edx-platform","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-platform","description":"Open edX, the edX platform that powers http://edx.org","fork":false,"url":"https://api.github.com/repos/edx/edx-platform","forks_url":"https://api.github.com/repos/edx/edx-platform/forks","keys_url":"https://api.github.com/repos/edx/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-platform/teams","hooks_url":"https://api.github.com/repos/edx/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-platform/events","assignees_url":"https://api.github.com/repos/edx/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-platform/tags","blobs_url":"https://api.github.com/repos/edx/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-platform/languages","stargazers_url":"https://api.github.com/repos/edx/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-platform/subscription","commits_url":"https://api.github.com/repos/edx/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-platform/issues/comments/{number}","contents_url":"https://api.github.com/repos/edx/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-platform/merges","archive_url":"https://api.github.com/repos/edx/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-platform/downloads","issues_url":"https://api.github.com/repos/edx/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-platform/releases{/id}","created_at":"2013-05-30T20:20:38Z","updated_at":"2015-01-05T06:54:25Z","pushed_at":"2015-01-05T10:59:33Z","git_url":"git://github.com/edx/edx-platform.git","ssh_url":"git@github.com:edx/edx-platform.git","clone_url":"https://github.com/edx/edx-platform.git","svn_url":"https://github.com/edx/edx-platform","homepage":"http://openedx.org/","size":1558933,"stargazers_count":1648,"watchers_count":1648,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":948,"mirror_url":null,"open_issues_count":150,"forks":948,"open_issues":150,"watchers":1648,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"6846e25bbbf4ba27d9292743b3ef599210175524","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":10391073,"name":"edx-platform","full_name":"edx/edx-platform","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-platform","description":"Open edX, the edX platform that powers http://edx.org","fork":false,"url":"https://api.github.com/repos/edx/edx-platform","forks_url":"https://api.github.com/repos/edx/edx-platform/forks","keys_url":"https://api.github.com/repos/edx/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-platform/teams","hooks_url":"https://api.github.com/repos/edx/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-platform/events","assignees_url":"https://api.github.com/repos/edx/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-platform/tags","blobs_url":"https://api.github.com/repos/edx/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-platform/languages","stargazers_url":"https://api.github.com/repos/edx/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-platform/subscription","commits_url":"https://api.github.com/repos/edx/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-platform/issues/comments/{number}","contents_url":"https://api.github.com/repos/edx/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-platform/merges","archive_url":"https://api.github.com/repos/edx/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-platform/downloads","issues_url":"https://api.github.com/repos/edx/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-platform/releases{/id}","created_at":"2013-05-30T20:20:38Z","updated_at":"2015-01-05T06:54:25Z","pushed_at":"2015-01-05T10:59:33Z","git_url":"git://github.com/edx/edx-platform.git","ssh_url":"git@github.com:edx/edx-platform.git","clone_url":"https://github.com/edx/edx-platform.git","svn_url":"https://github.com/edx/edx-platform","homepage":"http://openedx.org/","size":1558933,"stargazers_count":1648,"watchers_count":1648,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":948,"mirror_url":null,"open_issues_count":150,"forks":948,"open_issues":150,"watchers":1648,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/6321"},"html":{"href":"https://github.com/edx/edx-platform/pull/6321"},"issue":{"href":"https://api.github.com/repos/edx/edx-platform/issues/6321"},"comments":{"href":"https://api.github.com/repos/edx/edx-platform/issues/6321/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/6321/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/6321/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-platform/statuses/871ecd7861c86b594a2099ad0ee1a93c0c214cf6"}}}}