{"action":"created","comment":{"url":"https://api.github.com/repos/unbxd/js-sdk/pulls/comments/77948846","id":77948846,"diff_hunk":"@@ -0,0 +1,200 @@\n+describe('Facets', function () {\n+  var expect = window.expect;\n+\n+  before(function(){\n+    fixture.setBase('mock');\n+    var searchTest = fixture.load('searchTestResponse.json');\n+\n+    //setup document to hold search results\n+    document.body.innerHTML = __html__['index.html'];\n+\n+    //initialize search\n+    window.searchobj = new window.Unbxd.setSearch(window.config);\n+\n+    //stub search ajax call with mock response\n+    this.stub = sinon.stub(jQuery, 'ajax').yieldsTo('success', searchTest);\n+\n+    this.spyOnFacetLoad = sinon.spy(window.searchobj.options, 'onFacetLoad');\n+    this.spyFacetOnSelect = sinon\n+      .spy(window.searchobj.options, 'facetOnSelect');\n+    this.spyFacetOnDeselect = sinon\n+      .spy(window.searchobj.options, 'facetOnDeselect');\n+    this.spyRemoveFilter = sinon.spy(window.searchobj, 'removeFilter');\n+    this.spyClearFilters = sinon.spy(window.searchobj, 'clearFilters');\n+\n+  });\n+\n+  after(function(){\n+    this.stub.restore();\n+  });\n+\n+  beforeEach(function(){\n+    //reset filters applied\n+    window.searchobj.clearFilters(true);\n+    window.searchobj.callResults(window.searchobj.paintResultSet,true);\n+  });\n+\n+  it('Should call onFacetLoad on selecting facet', function(done){\n+    var beforeCallCount = this.spyOnFacetLoad.callCount;\n+    var afterCallCount;\n+    jQuery(window.searchobj.options.facetContainerSelector +' label')[0]\n+      .click();\n+    afterCallCount = this.spyOnFacetLoad.callCount;\n+    expect(beforeCallCount + 1).to.be.equal(afterCallCount);\n+    done();\n+  });\n+\n+  it('Should call facetOnSelect with element as args on facet select',\n+    function(done){\n+      var facetElement = jQuery(window.searchobj.options\n+        .facetContainerSelector + ' label').first();\n+      //apply facet\n+      facetElement.click();\n+      expect(jQuery(this.spyFacetOnSelect.args[0][0][0]).text())\n+      .to.be.equal(jQuery(window.searchobj.options.facetContainerSelector +\n+       ' label').first().text());\n+      done();\n+    }\n+  );\n+\n+  it('Should call facetOnDeselect with element as args on deselecting facet',\n+    function(done){\n+      var facetElement = jQuery(window.searchobj.options\n+        .facetContainerSelector +' label').first();\n+      //apply facet\n+      facetElement.click();\n+      //remove facet\n+      facetElement.click();\n+      expect(jQuery(this.spyFacetOnDeselect.args[0][0][0]).text())\n+        .to.be.equal(jQuery(window.searchobj.options\n+          .facetContainerSelector +' label').first().text());\n+      done();\n+    }\n+  );\n+\n+  it('addFilter - Should add filters to search params', function(done){\n+    var field = 'color_fq';\n+    var value = 'Black';\n+    window.searchobj.addFilter(field,value);\n+    expect(window.searchobj.params.filters[field][value]).to.exist;\n+    done();\n+  });\n+\n+  it('removeFilter - Should remove filters from search params', function(done){\n+    var field = 'color_fq';\n+    var value = 'Black';\n+    window.searchobj.addFilter(field,value);\n+    window.searchobj.removeFilter(field,value);\n+    expect(window.searchobj.params.filters[field]).to.not.exist;\n+    done();\n+  });\n+\n+  it('clearFilter - Should clear search param filters',function(done){\n+    var field = 'color_fq';\n+    var value = 'Black';\n+    window.searchobj.addFilter(field,value);\n+    window.searchobj.clearFilters();\n+    expect(window.searchobj.params.filters).to.be.empty;\n+    done();\n+  });\n+\n+  it('clearFilter(including range) -Should clear filters and rangeFilters',\n+    function(done){\n+      var field = 'color_fq';\n+      var value = 'Black';\n+      var rangeField = \"price_fq\";\n+      var start = \"30\";","path":"test/search/facets.spec.js","position":106,"original_position":106,"commit_id":"a4c325a400fb3426fc2426b6fafc9adb908f3983","original_commit_id":"a4c325a400fb3426fc2426b6fafc9adb908f3983","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Mixed double and single quotes.","created_at":"2016-09-08T05:44:17Z","updated_at":"2016-09-08T05:44:17Z","html_url":"https://github.com/unbxd/js-sdk/pull/34#discussion_r77948846","pull_request_url":"https://api.github.com/repos/unbxd/js-sdk/pulls/34","_links":{"self":{"href":"https://api.github.com/repos/unbxd/js-sdk/pulls/comments/77948846"},"html":{"href":"https://github.com/unbxd/js-sdk/pull/34#discussion_r77948846"},"pull_request":{"href":"https://api.github.com/repos/unbxd/js-sdk/pulls/34"}}},"pull_request":{"url":"https://api.github.com/repos/unbxd/js-sdk/pulls/34","id":84275318,"html_url":"https://github.com/unbxd/js-sdk/pull/34","diff_url":"https://github.com/unbxd/js-sdk/pull/34.diff","patch_url":"https://github.com/unbxd/js-sdk/pull/34.patch","issue_url":"https://api.github.com/repos/unbxd/js-sdk/issues/34","number":34,"state":"open","locked":false,"title":"Test cases - search functionalities","user":{"login":"santosh1994","id":7022342,"avatar_url":"https://avatars.githubusercontent.com/u/7022342?v=3","gravatar_id":"","url":"https://api.github.com/users/santosh1994","html_url":"https://github.com/santosh1994","followers_url":"https://api.github.com/users/santosh1994/followers","following_url":"https://api.github.com/users/santosh1994/following{/other_user}","gists_url":"https://api.github.com/users/santosh1994/gists{/gist_id}","starred_url":"https://api.github.com/users/santosh1994/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/santosh1994/subscriptions","organizations_url":"https://api.github.com/users/santosh1994/orgs","repos_url":"https://api.github.com/users/santosh1994/repos","events_url":"https://api.github.com/users/santosh1994/events{/privacy}","received_events_url":"https://api.github.com/users/santosh1994/received_events","type":"User","site_admin":false},"body":"@rahulcs @floydpraveen @amarts  Please review","created_at":"2016-09-07T10:31:31Z","updated_at":"2016-09-08T05:44:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d0fcafb080924d0be73f15879e9885a5cf93735a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/unbxd/js-sdk/pulls/34/commits","review_comments_url":"https://api.github.com/repos/unbxd/js-sdk/pulls/34/comments","review_comment_url":"https://api.github.com/repos/unbxd/js-sdk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/unbxd/js-sdk/issues/34/comments","statuses_url":"https://api.github.com/repos/unbxd/js-sdk/statuses/a4c325a400fb3426fc2426b6fafc9adb908f3983","head":{"label":"santosh1994:test-cases","ref":"test-cases","sha":"a4c325a400fb3426fc2426b6fafc9adb908f3983","user":{"login":"santosh1994","id":7022342,"avatar_url":"https://avatars.githubusercontent.com/u/7022342?v=3","gravatar_id":"","url":"https://api.github.com/users/santosh1994","html_url":"https://github.com/santosh1994","followers_url":"https://api.github.com/users/santosh1994/followers","following_url":"https://api.github.com/users/santosh1994/following{/other_user}","gists_url":"https://api.github.com/users/santosh1994/gists{/gist_id}","starred_url":"https://api.github.com/users/santosh1994/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/santosh1994/subscriptions","organizations_url":"https://api.github.com/users/santosh1994/orgs","repos_url":"https://api.github.com/users/santosh1994/repos","events_url":"https://api.github.com/users/santosh1994/events{/privacy}","received_events_url":"https://api.github.com/users/santosh1994/received_events","type":"User","site_admin":false},"repo":{"id":41662484,"name":"js-sdk","full_name":"santosh1994/js-sdk","owner":{"login":"santosh1994","id":7022342,"avatar_url":"https://avatars.githubusercontent.com/u/7022342?v=3","gravatar_id":"","url":"https://api.github.com/users/santosh1994","html_url":"https://github.com/santosh1994","followers_url":"https://api.github.com/users/santosh1994/followers","following_url":"https://api.github.com/users/santosh1994/following{/other_user}","gists_url":"https://api.github.com/users/santosh1994/gists{/gist_id}","starred_url":"https://api.github.com/users/santosh1994/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/santosh1994/subscriptions","organizations_url":"https://api.github.com/users/santosh1994/orgs","repos_url":"https://api.github.com/users/santosh1994/repos","events_url":"https://api.github.com/users/santosh1994/events{/privacy}","received_events_url":"https://api.github.com/users/santosh1994/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/santosh1994/js-sdk","description":"Javascript SDK to call Unbxd APIs","fork":true,"url":"https://api.github.com/repos/santosh1994/js-sdk","forks_url":"https://api.github.com/repos/santosh1994/js-sdk/forks","keys_url":"https://api.github.com/repos/santosh1994/js-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/santosh1994/js-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/santosh1994/js-sdk/teams","hooks_url":"https://api.github.com/repos/santosh1994/js-sdk/hooks","issue_events_url":"https://api.github.com/repos/santosh1994/js-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/santosh1994/js-sdk/events","assignees_url":"https://api.github.com/repos/santosh1994/js-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/santosh1994/js-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/santosh1994/js-sdk/tags","blobs_url":"https://api.github.com/repos/santosh1994/js-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/santosh1994/js-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/santosh1994/js-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/santosh1994/js-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/santosh1994/js-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/santosh1994/js-sdk/languages","stargazers_url":"https://api.github.com/repos/santosh1994/js-sdk/stargazers","contributors_url":"https://api.github.com/repos/santosh1994/js-sdk/contributors","subscribers_url":"https://api.github.com/repos/santosh1994/js-sdk/subscribers","subscription_url":"https://api.github.com/repos/santosh1994/js-sdk/subscription","commits_url":"https://api.github.com/repos/santosh1994/js-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/santosh1994/js-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/santosh1994/js-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/santosh1994/js-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/santosh1994/js-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/santosh1994/js-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/santosh1994/js-sdk/merges","archive_url":"https://api.github.com/repos/santosh1994/js-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/santosh1994/js-sdk/downloads","issues_url":"https://api.github.com/repos/santosh1994/js-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/santosh1994/js-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/santosh1994/js-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/santosh1994/js-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/santosh1994/js-sdk/labels{/name}","releases_url":"https://api.github.com/repos/santosh1994/js-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/santosh1994/js-sdk/deployments","created_at":"2015-08-31T07:43:12Z","updated_at":"2015-08-31T07:43:12Z","pushed_at":"2016-09-08T05:44:05Z","git_url":"git://github.com/santosh1994/js-sdk.git","ssh_url":"git@github.com:santosh1994/js-sdk.git","clone_url":"https://github.com/santosh1994/js-sdk.git","svn_url":"https://github.com/santosh1994/js-sdk","homepage":null,"size":562,"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":"unbxd:master","ref":"master","sha":"2be2a572db7b628e0b42393872490a0c050e30c5","user":{"login":"unbxd","id":2639993,"avatar_url":"https://avatars.githubusercontent.com/u/2639993?v=3","gravatar_id":"","url":"https://api.github.com/users/unbxd","html_url":"https://github.com/unbxd","followers_url":"https://api.github.com/users/unbxd/followers","following_url":"https://api.github.com/users/unbxd/following{/other_user}","gists_url":"https://api.github.com/users/unbxd/gists{/gist_id}","starred_url":"https://api.github.com/users/unbxd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unbxd/subscriptions","organizations_url":"https://api.github.com/users/unbxd/orgs","repos_url":"https://api.github.com/users/unbxd/repos","events_url":"https://api.github.com/users/unbxd/events{/privacy}","received_events_url":"https://api.github.com/users/unbxd/received_events","type":"Organization","site_admin":false},"repo":{"id":18238781,"name":"js-sdk","full_name":"unbxd/js-sdk","owner":{"login":"unbxd","id":2639993,"avatar_url":"https://avatars.githubusercontent.com/u/2639993?v=3","gravatar_id":"","url":"https://api.github.com/users/unbxd","html_url":"https://github.com/unbxd","followers_url":"https://api.github.com/users/unbxd/followers","following_url":"https://api.github.com/users/unbxd/following{/other_user}","gists_url":"https://api.github.com/users/unbxd/gists{/gist_id}","starred_url":"https://api.github.com/users/unbxd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unbxd/subscriptions","organizations_url":"https://api.github.com/users/unbxd/orgs","repos_url":"https://api.github.com/users/unbxd/repos","events_url":"https://api.github.com/users/unbxd/events{/privacy}","received_events_url":"https://api.github.com/users/unbxd/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/unbxd/js-sdk","description":"Javascript SDK to call Unbxd APIs","fork":false,"url":"https://api.github.com/repos/unbxd/js-sdk","forks_url":"https://api.github.com/repos/unbxd/js-sdk/forks","keys_url":"https://api.github.com/repos/unbxd/js-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/unbxd/js-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/unbxd/js-sdk/teams","hooks_url":"https://api.github.com/repos/unbxd/js-sdk/hooks","issue_events_url":"https://api.github.com/repos/unbxd/js-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/unbxd/js-sdk/events","assignees_url":"https://api.github.com/repos/unbxd/js-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/unbxd/js-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/unbxd/js-sdk/tags","blobs_url":"https://api.github.com/repos/unbxd/js-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/unbxd/js-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/unbxd/js-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/unbxd/js-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/unbxd/js-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/unbxd/js-sdk/languages","stargazers_url":"https://api.github.com/repos/unbxd/js-sdk/stargazers","contributors_url":"https://api.github.com/repos/unbxd/js-sdk/contributors","subscribers_url":"https://api.github.com/repos/unbxd/js-sdk/subscribers","subscription_url":"https://api.github.com/repos/unbxd/js-sdk/subscription","commits_url":"https://api.github.com/repos/unbxd/js-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/unbxd/js-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/unbxd/js-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/unbxd/js-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/unbxd/js-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/unbxd/js-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/unbxd/js-sdk/merges","archive_url":"https://api.github.com/repos/unbxd/js-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/unbxd/js-sdk/downloads","issues_url":"https://api.github.com/repos/unbxd/js-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/unbxd/js-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/unbxd/js-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/unbxd/js-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/unbxd/js-sdk/labels{/name}","releases_url":"https://api.github.com/repos/unbxd/js-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/unbxd/js-sdk/deployments","created_at":"2014-03-29T10:09:19Z","updated_at":"2016-07-12T14:20:42Z","pushed_at":"2016-09-08T05:44:06Z","git_url":"git://github.com/unbxd/js-sdk.git","ssh_url":"git@github.com:unbxd/js-sdk.git","clone_url":"https://github.com/unbxd/js-sdk.git","svn_url":"https://github.com/unbxd/js-sdk","homepage":null,"size":591,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":4,"forks":13,"open_issues":4,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/unbxd/js-sdk/pulls/34"},"html":{"href":"https://github.com/unbxd/js-sdk/pull/34"},"issue":{"href":"https://api.github.com/repos/unbxd/js-sdk/issues/34"},"comments":{"href":"https://api.github.com/repos/unbxd/js-sdk/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/unbxd/js-sdk/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/unbxd/js-sdk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/unbxd/js-sdk/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/unbxd/js-sdk/statuses/a4c325a400fb3426fc2426b6fafc9adb908f3983"}}}}
{"actor":{"display_login":"houndci-bot"}}