Use a fixture in stream-spec
This commit is contained in:
parent
2c21608084
commit
aa4fbfbe1a
1 changed files with 5 additions and 28 deletions
|
|
@ -6,31 +6,7 @@
|
||||||
describe("Stream", function() {
|
describe("Stream", function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
jasmine.Clock.useMock();
|
jasmine.Clock.useMock();
|
||||||
$('#jasmine_content').html(
|
spec.loadFixture('aspects_index_with_posts');
|
||||||
'<div class="stream" id="main_stream">' +
|
|
||||||
'<li class="stream_element" data-guid="4ceef7ba2367bc2e4d0001e9">' +
|
|
||||||
'<div class="content">' +
|
|
||||||
'<div class="info">' +
|
|
||||||
'<a href="#" class="show_post_comments">show comments (0)</a>' +
|
|
||||||
'</div>' +
|
|
||||||
'<ul class="comments hidden" id="4ceef7ba2367bc2e4d0001e9">' +
|
|
||||||
'<li class="comment show">' +
|
|
||||||
'<form accept-charset="UTF-8" action="/comments" class="new_comment" data-remote="true" id="new_comment_on_4ceef7ba2367bc2e4d0001e9" method="post">' +
|
|
||||||
'<div style="margin:0;padding:0;display:inline">' +
|
|
||||||
'<p>' +
|
|
||||||
'<label for="comment_text_on_4ceef7ba2367bc2e4d0001e9">Comment</label>' +
|
|
||||||
'<textarea class="comment_box" id="comment_text_on_4ceef7ba2367bc2e4d0001e9" name="text" rows="1"></textarea>' +
|
|
||||||
'</p>' +
|
|
||||||
'<input id="post_id_on_4ceef7ba2367bc2e4d0001e9" name="post_id" type="hidden" value="4ceef7ba2367bc2e4d0001e9">' +
|
|
||||||
'<input class="comment_submit button" data-disable-with="Commenting..." id="comment_submit_4ceef7ba2367bc2e4d0001e9" name="commit" type="submit" value="Comment">' +
|
|
||||||
'</div>' +
|
|
||||||
'</form>' +
|
|
||||||
'</li>' +
|
|
||||||
'</ul>' +
|
|
||||||
'</div>' +
|
|
||||||
'</li>' +
|
|
||||||
'</div>'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("initialize", function() {
|
describe("initialize", function() {
|
||||||
|
|
@ -48,16 +24,17 @@ describe("Stream", function() {
|
||||||
Stream.initialize();
|
Stream.initialize();
|
||||||
});
|
});
|
||||||
it("toggles class hidden on the comment block", function () {
|
it("toggles class hidden on the comment block", function () {
|
||||||
expect(jQuery('ul.comments')).toHaveClass("hidden");
|
expect(jQuery('ul.comments')).not.toHaveClass("hidden");
|
||||||
$("a.show_post_comments").click();
|
$("a.show_post_comments").click();
|
||||||
jasmine.Clock.tick(200);
|
jasmine.Clock.tick(200);
|
||||||
expect(jQuery('ul.comments')).not.toHaveClass("hidden");
|
expect(jQuery('ul.comments')).toHaveClass("hidden");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("changes the text on the show comments link", function() {
|
it("changes the text on the show comments link", function() {
|
||||||
|
expect($("a.show_post_comments").text()).toEqual("hide comments (1)");
|
||||||
$("a.show_post_comments").click();
|
$("a.show_post_comments").click();
|
||||||
jasmine.Clock.tick(200);
|
jasmine.Clock.tick(200);
|
||||||
expect($("a.show_post_comments").text()).toEqual("hide comments (0)");
|
expect($("a.show_post_comments").text()).toEqual("show comments (1)");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue