diff --git a/Changelog.md b/Changelog.md index 0fab04f66..e03fc4704 100644 --- a/Changelog.md +++ b/Changelog.md @@ -91,6 +91,7 @@ With the port to Bootstrap 3, app/views/terms/default.haml has a new structure. * Normalize new followed tags and insert them alphabetically [#6454](https://github.com/diaspora/diaspora/pull/6454) * Add avatar fallback for notification dropdown [#6463](https://github.com/diaspora/diaspora/pull/6463) * Improve handling of j/k hotkeys [#6462](https://github.com/diaspora/diaspora/pull/6462) +* Fix JS error caused by hovercards [6480](https://github.com/diaspora/diaspora/pull/6480) ## Features * Show spinner on initial stream load [#6384](https://github.com/diaspora/diaspora/pull/6384) diff --git a/app/assets/javascripts/app/views/hovercard_view.js b/app/assets/javascripts/app/views/hovercard_view.js index 1d070096e..643fb771c 100644 --- a/app/assets/javascripts/app/views/hovercard_view.js +++ b/app/assets/javascripts/app/views/hovercard_view.js @@ -147,6 +147,7 @@ app.views.Hovercard = app.views.Base.extend({ }, mouseIsOverElement: function(element, event) { + if(!element) { return false; } var elPos = element.offset(); return event.pageX >= elPos.left && event.pageX <= elPos.left + element.width() && diff --git a/spec/javascripts/app/views/hovercard_view_spec.js b/spec/javascripts/app/views/hovercard_view_spec.js new file mode 100644 index 000000000..a003e24b2 --- /dev/null +++ b/spec/javascripts/app/views/hovercard_view_spec.js @@ -0,0 +1,11 @@ +describe("app.views.Hovercard", function() { + beforeEach(function() { + this.view = new app.views.Hovercard(); + }); + + describe("mouseIsOverElement", function() { + it("returns false if the element is undefined", function() { + expect(this.view.mouseIsOverElement(undefined, $.Event())).toBeFalsy(); + }); + }); +});