forked from diaspora/diaspora
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable hovercards for logged out users and prevent redirect to sign …
…in page closes diaspora#6587
- Loading branch information
Showing
3 changed files
with
53 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,54 @@ | ||
describe("app.views.Hovercard", function() { | ||
beforeEach(function() { | ||
this.view = new app.views.Hovercard(); | ||
context("user not signed in", function() { | ||
beforeEach(function() { | ||
logout(); | ||
this.view = new app.views.Hovercard(); | ||
}); | ||
|
||
describe("initialize", function() { | ||
it("deactivates hovercards", function() { | ||
expect(this.view.active).toBeFalsy(); | ||
}); | ||
}); | ||
}); | ||
|
||
describe("mouseIsOverElement", function() { | ||
it("returns false if the element is undefined", function() { | ||
expect(this.view.mouseIsOverElement(undefined, $.Event())).toBeFalsy(); | ||
context("user signed in", function() { | ||
beforeEach(function() { | ||
loginAs(factory.userAttrs()); | ||
this.view = new app.views.Hovercard(); | ||
}); | ||
|
||
describe("initialize", function() { | ||
it("activates hovercards", function() { | ||
expect(this.view.active).toBeTruthy(); | ||
}); | ||
}); | ||
|
||
describe("mouseIsOverElement", function() { | ||
it("returns false if the element is undefined", function() { | ||
expect(this.view.mouseIsOverElement(undefined, $.Event())).toBeFalsy(); | ||
}); | ||
}); | ||
|
||
describe("_populateHovercard", function() { | ||
it("prevents global error handling for the ajax call", function() { | ||
spyOn(jQuery, "ajax").and.callThrough(); | ||
this.view.parent = spec.content(); | ||
this.view._populateHovercard(); | ||
expect(jQuery.ajax).toHaveBeenCalledWith("undefined/hovercard.json", {preventGlobalErrorHandling: true}); | ||
}); | ||
}); | ||
|
||
describe("_populateHovercardWith", function() { | ||
it("prevents global error handling for the ajax call", function() { | ||
spyOn(jQuery, "ajax").and.callThrough(); | ||
this.view.parent = spec.content(); | ||
this.view._populateHovercardWith({}); | ||
expect(jQuery.ajax).toHaveBeenCalledWith( | ||
"undefined/aspect_membership_button", | ||
{preventGlobalErrorHandling: true} | ||
); | ||
}); | ||
}); | ||
}); | ||
}); |