{"action":"created","comment":{"url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/pulls/comments/31531006","id":31531006,"diff_hunk":"@@ -1,115 +1,196 @@\n-// Mock Data\n-var mockData = [{\n-    name: 'name1'\n+(function() {\n+  var mockData = [{\n+    name: 'child1',\n+    nbChildren: 0\n   }, {\n-    name: 'name2'\n+    name: 'child2'\n+  }];\n+\n+  var multiLvlData = [{\n+    name: 'some folder',\n+    nbSubFiles: 3,\n+    children: [{\n+      name: 'other folder',\n+      nbSubFiles: 3,\n+      children: [{\n+        name: 'other folder'\n+      }, {\n+        name: 'SOP.docx',\n+        nbSubFiles: 0\n+      },  {\n+        name: 'display.png'\n+      }]\n+    }, {\n+      name: 'status.docx',\n+      nbSubFiles: 0\n+    },  {\n+      name: 'image.png'\n+    }]\n   }, {\n-    name: 'name3'\n+    name: 'report.docx',\n+    nbSubFiles: 0\n+  },  {\n+    name: 'logo.png'\n   }];\n \n // Custom classes definition\n-var CustomNodeView = Marionette.NodeView.extend({\n-    template: _.template('<a data-toggle=\"node\" class=\"collapsed\"><i class=\"fa fa-pie-chart\"></i> <%=name%><div class=\"icon-group\"><i class=\"fa fa-exclamation-triangle icon-error pull-right hide\"></i><i class=\"fa fa-plus icon-expand pull-right\"></i><i class=\"fa fa-minus icon-collapse hide pull-right\"></i><i class=\"fa fa-spinner hide icon-loading fa-pulse\"></i></div></a><div class=\"children\"></div>')\n-  }),\n-  CustomNodeSuccessModel = Backbone.Model.extend({\n-    fetchChildren: function(options) {\n-      this.set('children', new Backbone.Collection(mockData));\n-    }\n-  }),\n-  CustomNodeSuccessCollection = Backbone.Collection.extend({\n-    model: CustomNodeSuccessModel\n-  });\n-\n-// Create object\n-var model = new CustomNodeSuccessModel({ name: 'Jean' }),\n-    customNodeView;\n-\n-describe(\"Node View\", function() {\n-\n-  beforeEach(function() {\n-    customNodeView = new CustomNodeView({ collectionType: CustomNodeSuccessCollection, model: model });\n-    customNodeView.render();\n-  });\n-\n-  it(\"View is rendered well\", function() {\n-    expect(customNodeView.$el.html()).toContain('Jean');\n-    expect(customNodeView.ui.iconError.hasClass('hide')).toBeTruthy();\n-    expect(customNodeView.ui.iconLoading.hasClass('hide')).toBeTruthy();\n-    expect(customNodeView.ui.iconCollapse.hasClass('hide')).toBeTruthy();\n-    expect(customNodeView.ui.iconExpand.hasClass('hide')).toBeFalsy();\n-  });\n-\n-  it(\"Node is expanding\", function() {\n-    var clickEvent = $.Event('click');\n-\n-    spyOn(customNodeView, 'onExpand');\n-\n-    customNodeView.delegateEvents();\n-    customNodeView.$('a.collapsed[data-toggle=node] i').trigger(clickEvent);\n-\n-    expect(customNodeView.onExpand).toHaveBeenCalled();\n-  });\n+  var CustomNodeView = Marionette.NodeView.extend({\n+        template: _.template('<a data-toggle=\"node\" class=\"collapsed\"><i class=\"fa fa-pie-chart\"></i> <%=name%><div class=\"icon-group\"><i class=\"fa fa-exclamation-triangle icon-error pull-right hide\"></i><i class=\"fa fa-plus icon-expand pull-right\"></i><i class=\"fa fa-minus icon-collapse hide pull-right\"></i><i class=\"fa fa-spinner hide icon-loading fa-pulse\"></i></div></a><div class=\"children\"></div>')\n+      }),\n+      CustomNodeSuccessModel = Backbone.Model.extend({\n+        fetchChildren: function (options) {\n+          if (!options.err){\n+            if (options.multiLvl){\n+              this.set('children', new Backbone.Collection(multiLvlData));\n+            } else {\n+              this.set('children', new Backbone.Collection(mockData));\n+            }\n+          } else {\n+            this.trigger('error');\n+          }\n+        },\n+        deleteChildren: function () {\n+          this.unset('children', {silent: true});\n+          this.trigger('delete:children');\n+        }\n+      }),\n+      CustomNodeSuccessCollection = Backbone.Collection.extend({\n+        model: CustomNodeSuccessModel\n+      });\n+\n+  var controller = {\n+    reactOnExpand: function () {},\n+    reactOnCollapse: function () {},\n+    reactOnSelect: function () {}\n+  };\n+\n+// Tests\n+  describe(\"NodeView\", function () {\n+\n+    beforeEach(function () {\n+      // Create object\n+      var model = new CustomNodeSuccessModel({name: 'Root'});","path":"test/unit/spec/node.js","position":118,"original_position":118,"commit_id":"9958da4df20fa584118a5f118f31d4483ba1de17","original_commit_id":"9958da4df20fa584118a5f118f31d4483ba1de17","user":{"login":"Nelrohd","id":1664480,"avatar_url":"https://avatars.githubusercontent.com/u/1664480?v=3","gravatar_id":"","url":"https://api.github.com/users/Nelrohd","html_url":"https://github.com/Nelrohd","followers_url":"https://api.github.com/users/Nelrohd/followers","following_url":"https://api.github.com/users/Nelrohd/following{/other_user}","gists_url":"https://api.github.com/users/Nelrohd/gists{/gist_id}","starred_url":"https://api.github.com/users/Nelrohd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nelrohd/subscriptions","organizations_url":"https://api.github.com/users/Nelrohd/orgs","repos_url":"https://api.github.com/users/Nelrohd/repos","events_url":"https://api.github.com/users/Nelrohd/events{/privacy}","received_events_url":"https://api.github.com/users/Nelrohd/received_events","type":"User","site_admin":false},"body":"space before name","created_at":"2015-06-02T14:53:21Z","updated_at":"2015-06-02T14:53:21Z","html_url":"https://github.com/Interfacing/backbone-marionette-tree-view/pull/1#discussion_r31531006","pull_request_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/pulls/comments/31531006"},"html":{"href":"https://github.com/Interfacing/backbone-marionette-tree-view/pull/1#discussion_r31531006"},"pull_request":{"href":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/pulls/1","id":36664932,"html_url":"https://github.com/Interfacing/backbone-marionette-tree-view/pull/1","diff_url":"https://github.com/Interfacing/backbone-marionette-tree-view/pull/1.diff","patch_url":"https://github.com/Interfacing/backbone-marionette-tree-view/pull/1.patch","issue_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/issues/1","number":1,"state":"open","locked":false,"title":"Refactoring and tests","user":{"login":"FredFaust","id":4367222,"avatar_url":"https://avatars.githubusercontent.com/u/4367222?v=3","gravatar_id":"","url":"https://api.github.com/users/FredFaust","html_url":"https://github.com/FredFaust","followers_url":"https://api.github.com/users/FredFaust/followers","following_url":"https://api.github.com/users/FredFaust/following{/other_user}","gists_url":"https://api.github.com/users/FredFaust/gists{/gist_id}","starred_url":"https://api.github.com/users/FredFaust/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FredFaust/subscriptions","organizations_url":"https://api.github.com/users/FredFaust/orgs","repos_url":"https://api.github.com/users/FredFaust/repos","events_url":"https://api.github.com/users/FredFaust/events{/privacy}","received_events_url":"https://api.github.com/users/FredFaust/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-06-01T20:02:49Z","updated_at":"2015-06-02T14:53:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fcf28ad5a7bb093ca85e8686f66facd9fd9c6dbd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/pulls/1/commits","review_comments_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/pulls/1/comments","review_comment_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/issues/1/comments","statuses_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/statuses/9958da4df20fa584118a5f118f31d4483ba1de17","head":{"label":"Interfacing:fred-refactoring","ref":"fred-refactoring","sha":"9958da4df20fa584118a5f118f31d4483ba1de17","user":{"login":"Interfacing","id":11445894,"avatar_url":"https://avatars.githubusercontent.com/u/11445894?v=3","gravatar_id":"","url":"https://api.github.com/users/Interfacing","html_url":"https://github.com/Interfacing","followers_url":"https://api.github.com/users/Interfacing/followers","following_url":"https://api.github.com/users/Interfacing/following{/other_user}","gists_url":"https://api.github.com/users/Interfacing/gists{/gist_id}","starred_url":"https://api.github.com/users/Interfacing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Interfacing/subscriptions","organizations_url":"https://api.github.com/users/Interfacing/orgs","repos_url":"https://api.github.com/users/Interfacing/repos","events_url":"https://api.github.com/users/Interfacing/events{/privacy}","received_events_url":"https://api.github.com/users/Interfacing/received_events","type":"Organization","site_admin":false},"repo":{"id":33569996,"name":"backbone-marionette-tree-view","full_name":"Interfacing/backbone-marionette-tree-view","owner":{"login":"Interfacing","id":11445894,"avatar_url":"https://avatars.githubusercontent.com/u/11445894?v=3","gravatar_id":"","url":"https://api.github.com/users/Interfacing","html_url":"https://github.com/Interfacing","followers_url":"https://api.github.com/users/Interfacing/followers","following_url":"https://api.github.com/users/Interfacing/following{/other_user}","gists_url":"https://api.github.com/users/Interfacing/gists{/gist_id}","starred_url":"https://api.github.com/users/Interfacing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Interfacing/subscriptions","organizations_url":"https://api.github.com/users/Interfacing/orgs","repos_url":"https://api.github.com/users/Interfacing/repos","events_url":"https://api.github.com/users/Interfacing/events{/privacy}","received_events_url":"https://api.github.com/users/Interfacing/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Interfacing/backbone-marionette-tree-view","description":"Simple Tree View with lazy loading based on Backbone Marionette JS","fork":false,"url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view","forks_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/forks","keys_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/teams","hooks_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/hooks","issue_events_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/issues/events{/number}","events_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/events","assignees_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/assignees{/user}","branches_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/branches{/branch}","tags_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/tags","blobs_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/git/refs{/sha}","trees_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/statuses/{sha}","languages_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/languages","stargazers_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/stargazers","contributors_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/contributors","subscribers_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/subscribers","subscription_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/subscription","commits_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/commits{/sha}","git_commits_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/git/commits{/sha}","comments_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/comments{/number}","issue_comment_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/issues/comments{/number}","contents_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/contents/{+path}","compare_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/merges","archive_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/downloads","issues_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/issues{/number}","pulls_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/pulls{/number}","milestones_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/milestones{/number}","notifications_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/labels{/name}","releases_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/releases{/id}","created_at":"2015-04-07T21:46:28Z","updated_at":"2015-05-05T18:52:55Z","pushed_at":"2015-06-02T14:28:07Z","git_url":"git://github.com/Interfacing/backbone-marionette-tree-view.git","ssh_url":"git@github.com:Interfacing/backbone-marionette-tree-view.git","clone_url":"https://github.com/Interfacing/backbone-marionette-tree-view.git","svn_url":"https://github.com/Interfacing/backbone-marionette-tree-view","homepage":"","size":244,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"Interfacing:master","ref":"master","sha":"2ea0bfd38e1b0c0783459eb913d31871f0a60dad","user":{"login":"Interfacing","id":11445894,"avatar_url":"https://avatars.githubusercontent.com/u/11445894?v=3","gravatar_id":"","url":"https://api.github.com/users/Interfacing","html_url":"https://github.com/Interfacing","followers_url":"https://api.github.com/users/Interfacing/followers","following_url":"https://api.github.com/users/Interfacing/following{/other_user}","gists_url":"https://api.github.com/users/Interfacing/gists{/gist_id}","starred_url":"https://api.github.com/users/Interfacing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Interfacing/subscriptions","organizations_url":"https://api.github.com/users/Interfacing/orgs","repos_url":"https://api.github.com/users/Interfacing/repos","events_url":"https://api.github.com/users/Interfacing/events{/privacy}","received_events_url":"https://api.github.com/users/Interfacing/received_events","type":"Organization","site_admin":false},"repo":{"id":33569996,"name":"backbone-marionette-tree-view","full_name":"Interfacing/backbone-marionette-tree-view","owner":{"login":"Interfacing","id":11445894,"avatar_url":"https://avatars.githubusercontent.com/u/11445894?v=3","gravatar_id":"","url":"https://api.github.com/users/Interfacing","html_url":"https://github.com/Interfacing","followers_url":"https://api.github.com/users/Interfacing/followers","following_url":"https://api.github.com/users/Interfacing/following{/other_user}","gists_url":"https://api.github.com/users/Interfacing/gists{/gist_id}","starred_url":"https://api.github.com/users/Interfacing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Interfacing/subscriptions","organizations_url":"https://api.github.com/users/Interfacing/orgs","repos_url":"https://api.github.com/users/Interfacing/repos","events_url":"https://api.github.com/users/Interfacing/events{/privacy}","received_events_url":"https://api.github.com/users/Interfacing/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Interfacing/backbone-marionette-tree-view","description":"Simple Tree View with lazy loading based on Backbone Marionette JS","fork":false,"url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view","forks_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/forks","keys_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/teams","hooks_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/hooks","issue_events_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/issues/events{/number}","events_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/events","assignees_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/assignees{/user}","branches_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/branches{/branch}","tags_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/tags","blobs_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/git/refs{/sha}","trees_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/statuses/{sha}","languages_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/languages","stargazers_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/stargazers","contributors_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/contributors","subscribers_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/subscribers","subscription_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/subscription","commits_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/commits{/sha}","git_commits_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/git/commits{/sha}","comments_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/comments{/number}","issue_comment_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/issues/comments{/number}","contents_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/contents/{+path}","compare_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/merges","archive_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/downloads","issues_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/issues{/number}","pulls_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/pulls{/number}","milestones_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/milestones{/number}","notifications_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/labels{/name}","releases_url":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/releases{/id}","created_at":"2015-04-07T21:46:28Z","updated_at":"2015-05-05T18:52:55Z","pushed_at":"2015-06-02T14:28:07Z","git_url":"git://github.com/Interfacing/backbone-marionette-tree-view.git","ssh_url":"git@github.com:Interfacing/backbone-marionette-tree-view.git","clone_url":"https://github.com/Interfacing/backbone-marionette-tree-view.git","svn_url":"https://github.com/Interfacing/backbone-marionette-tree-view","homepage":"","size":244,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/pulls/1"},"html":{"href":"https://github.com/Interfacing/backbone-marionette-tree-view/pull/1"},"issue":{"href":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/issues/1"},"comments":{"href":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/Interfacing/backbone-marionette-tree-view/statuses/9958da4df20fa584118a5f118f31d4483ba1de17"}}}}