From fb06d03f493b09d0488f684a24b53e0e2dc77966 Mon Sep 17 00:00:00 2001 From: Steffen van Bergerem Date: Fri, 9 Dec 2016 20:28:52 +0100 Subject: [PATCH] Close modals at the end of each jasmine spec closes #7246 --- Changelog.md | 1 + spec/javascripts/app/views/profile_header_view_spec.js | 4 ++-- spec/javascripts/jasmine_helpers/SpecHelper.js | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index c4232da02..e532fb476 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,6 +6,7 @@ ## Bug fixes * Fix background color of year on notifications page with dark theme [#7263](https://github.com/diaspora/diaspora/pull/7263) +* Fix jasmine tests in firefox [#7246](https://github.com/diaspora/diaspora/pull/7246) ## Features * Add links to the aspects and followed tags pages on mobile [#7265](https://github.com/diaspora/diaspora/pull/7265) diff --git a/spec/javascripts/app/views/profile_header_view_spec.js b/spec/javascripts/app/views/profile_header_view_spec.js index ebd4ecde1..999d56cd6 100644 --- a/spec/javascripts/app/views/profile_header_view_spec.js +++ b/spec/javascripts/app/views/profile_header_view_spec.js @@ -61,7 +61,7 @@ describe("app.views.ProfileHeader", function() { describe("showMessageModal", function() { beforeEach(function() { - spec.content().append("
"); + spec.content().append(""); }); it("calls app.helpers.showModal", function() { @@ -78,8 +78,8 @@ describe("app.views.ProfileHeader", function() { ]; spyOn(app.views.ConversationsForm.prototype, "initialize"); + spyOn($.fn, "load").and.callFake(function(url, callback) { callback(); }); this.view.showMessageModal(); - $("#conversationModal").trigger("modal:loaded"); expect(app.views.ConversationsForm.prototype.initialize) .toHaveBeenCalledWith({prefill: gon.conversationPrefill}); }); diff --git a/spec/javascripts/jasmine_helpers/SpecHelper.js b/spec/javascripts/jasmine_helpers/SpecHelper.js index 7fa076858..67d167c16 100644 --- a/spec/javascripts/jasmine_helpers/SpecHelper.js +++ b/spec/javascripts/jasmine_helpers/SpecHelper.js @@ -78,8 +78,11 @@ afterEach(function() { jasmine.clock().uninstall(); jasmine.Ajax.uninstall(); + $(".modal").removeClass("fade").modal("hide"); $("#jasmine_content").empty(); expect(spec.loadFixtureCount).toBeLessThan(2); + expect($(".modal-backdrop").length).toBe(0); + $(".modal-backdrop").remove(); spec.loadFixtureCount = 0; });