Improve profile header jasmine test

* append html to spec.content() instead of body
* don't append the unused conversations modal fixture
* actually test that showModal has been called
This commit is contained in:
Steffen van Bergerem 2016-11-13 16:06:07 +01:00 committed by Benjamin Neff
parent cbe3ca5cf6
commit 8983554f94

View file

@ -33,16 +33,16 @@ describe("app.views.ProfileHeader", function() {
describe("showMessageModal", function() {
beforeEach(function() {
$("body").append("<div id='conversationModal'/>").append(spec.readFixture("conversations_modal"));
spec.content().append("<div id='conversationModal'/>");
});
it("calls app.helpers.showModal", function() {
spyOn(app.helpers, "showModal");
this.view.showMessageModal();
expect(app.helpers.showModal);
expect(app.helpers.showModal).toHaveBeenCalled();
});
it("app.views.ConversationsForm with correct parameterswhen modal is loaded", function() {
it("initializes app.views.ConversationsForm with correct parameters when modal is loaded", function() {
gon.conversationPrefill = [
{id: 1, name: "diaspora user", handle: "diaspora-user@pod.tld"},
{id: 2, name: "other diaspora user", handle: "other-diaspora-user@pod.tld"},