Update jasmine tests for the stream element widget.
This commit is contained in:
parent
e1cfd59dce
commit
36e32ba497
2 changed files with 27 additions and 27 deletions
|
|
@ -1,27 +0,0 @@
|
|||
/* Copyright (c) 2010, Diaspora Inc. This file is
|
||||
* licensed under the Affero General Public License version 3 or later. See
|
||||
* the COPYRIGHT file.
|
||||
*/
|
||||
|
||||
describe("Stream", function() {
|
||||
beforeEach(function() {
|
||||
jasmine.Clock.useMock();
|
||||
spec.loadFixture('aspects_index_with_posts');
|
||||
Diaspora.I18n.locale = { };
|
||||
});
|
||||
|
||||
describe("streamElement", function() {
|
||||
it("makes sure that ajax spinner appears when hiding a post", function() {
|
||||
Stream.initializeLives();
|
||||
link = $("a.stream_element_delete.vis_hide");
|
||||
spinner = link.next("img.hide_loader");
|
||||
expect(link).not.toHaveClass("hidden");
|
||||
expect(spinner).toHaveClass("hidden");
|
||||
spyOn($, "ajax");
|
||||
link.click();
|
||||
expect($.ajax).toHaveBeenCalled();
|
||||
expect(link).toHaveClass("hidden");
|
||||
expect(spinner).not.toHaveClass("hidden");
|
||||
});
|
||||
});
|
||||
});
|
||||
27
spec/javascripts/widgets/stream-element-spec.js
Normal file
27
spec/javascripts/widgets/stream-element-spec.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/* Copyright (c) 2010, Diaspora Inc. This file is
|
||||
* licensed under the Affero General Public License version 3 or later. See
|
||||
* the COPYRIGHT file.
|
||||
*/
|
||||
|
||||
describe("Diaspora.Widgets.StreamElement", function() {
|
||||
var streamElement;
|
||||
|
||||
beforeEach(function() {
|
||||
jasmine.Clock.useMock();
|
||||
spec.loadFixture("aspects_index_with_posts");
|
||||
streamElement = Diaspora.BaseWidget.instantiate("StreamElement", $(".stream_element:has(a.stream_element_delete.vis_hide)"));
|
||||
});
|
||||
|
||||
describe("hidePost", function() {
|
||||
it("makes sure that ajax spinner appears when hiding a post", function() {
|
||||
expect(streamElement.deletePostLink).not.toHaveClass("hidden");
|
||||
expect(streamElement.hidePostLoader).toHaveClass("hidden");
|
||||
spyOn($, "ajax");
|
||||
streamElement.deletePostLink.click();
|
||||
jasmine.Clock.tick(200);
|
||||
expect($.ajax).toHaveBeenCalled();
|
||||
expect(streamElement.deletePostLink).toHaveClass("hidden");
|
||||
expect(streamElement.hidePostLoader).not.toHaveClass("hidden");
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue