Fix jasmine specs so that they fail when they're supposed to.
This commit is contained in:
parent
f2719e4c94
commit
7cd8e0f16b
3 changed files with 16 additions and 11 deletions
|
|
@ -17,7 +17,9 @@ describe("Stream", function() {
|
||||||
describe("toggleComments", function() {
|
describe("toggleComments", function() {
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
|
jasmine.Clock.useMock();
|
||||||
$('#jasmine_content').html(
|
$('#jasmine_content').html(
|
||||||
|
'<div class="stream">' +
|
||||||
'<li class="message" data-guid="4ceef7ba2367bc2e4d0001e9">' +
|
'<li class="message" data-guid="4ceef7ba2367bc2e4d0001e9">' +
|
||||||
'<div class="content">' +
|
'<div class="content">' +
|
||||||
'<div class="info">' +
|
'<div class="info">' +
|
||||||
|
|
@ -38,21 +40,23 @@ describe("Stream", function() {
|
||||||
'</li>' +
|
'</li>' +
|
||||||
'</ul>' +
|
'</ul>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'</li>'
|
'</li>' +
|
||||||
|
'</div>'
|
||||||
);
|
);
|
||||||
|
Stream.initialize();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("toggles class hidden on the comment block", function () {
|
it("toggles class hidden on the comment block", function () {
|
||||||
expect($('ul.comments')).toHaveClass("hidden");
|
expect($('ul.comments')).toHaveClass("hidden");
|
||||||
$("a.show_post_comments").click();
|
$("a.show_post_comments").click();
|
||||||
setTimeout(function() {
|
jasmine.Clock.tick(200);
|
||||||
expect($('ul.comments')).not.toHaveClass("hidden");
|
expect($('ul.comments')).not.toHaveClass("hidden");
|
||||||
}, 250);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("changes the text on the show comments link", function() {
|
it("changes the text on the show comments link", function() {
|
||||||
$("a.show_post_comments").click();
|
$("a.show_post_comments").click();
|
||||||
setTimeout(function() {
|
jasmine.Clock.tick(200);
|
||||||
expect($("a.show_post_comments").text()).toEqual("hide comments (0)");
|
expect($("a.show_post_comments").text()).toEqual("hide comments (0)");
|
||||||
}, 250);
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ src_files:
|
||||||
- public/javascripts/vendor/jquery-ui-1.8.6.custom.min.js
|
- public/javascripts/vendor/jquery-ui-1.8.6.custom.min.js
|
||||||
- public/javascripts/vendor/jquery.tipsy.js
|
- public/javascripts/vendor/jquery.tipsy.js
|
||||||
- public/javascripts/vendor/jquery.infieldlabel.js
|
- public/javascripts/vendor/jquery.infieldlabel.js
|
||||||
|
- public/javascripts/vendor/jquery.autoresize.min.js
|
||||||
- public/javascripts/vendor/fancybox/jquery.fancybox-1.3.1.pack.js
|
- public/javascripts/vendor/fancybox/jquery.fancybox-1.3.1.pack.js
|
||||||
- public/javascripts/diaspora.js
|
- public/javascripts/diaspora.js
|
||||||
- public/javascripts/mobile.js
|
- public/javascripts/mobile.js
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ describe("View", function() {
|
||||||
describe("debug", function() {
|
describe("debug", function() {
|
||||||
describe("click", function() {
|
describe("click", function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
|
jasmine.Clock.useMock();
|
||||||
$("#jasmine_content").html(
|
$("#jasmine_content").html(
|
||||||
'<div id="debug_info">' +
|
'<div id="debug_info">' +
|
||||||
'<h5>DEBUG INFO</h5>' +
|
'<h5>DEBUG INFO</h5>' +
|
||||||
|
|
@ -37,10 +38,9 @@ describe("View", function() {
|
||||||
spyOn(View.debug, "click");
|
spyOn(View.debug, "click");
|
||||||
View.initialize();
|
View.initialize();
|
||||||
$(View.debug.selector).click();
|
$(View.debug.selector).click();
|
||||||
|
jasmine.Clock.tick(200);
|
||||||
expect(View.debug.click).toHaveBeenCalled();
|
expect(View.debug.click).toHaveBeenCalled();
|
||||||
setTimeout(function() {
|
expect($(View.debug.selector).css("display")).toEqual("block");
|
||||||
expect($(View.debug.selector).css("display")).toEqual("block");
|
|
||||||
}, 500);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -115,7 +115,7 @@ describe("View", function() {
|
||||||
View.initialize();
|
View.initialize();
|
||||||
$(View.publisher.selector).focus();
|
$(View.publisher.selector).focus();
|
||||||
var event = $.Event("keydown");
|
var event = $.Event("keydown");
|
||||||
var event.ShiftKey = true;
|
event.ShiftKey = true;
|
||||||
event.keyCode = 13;
|
event.keyCode = 13;
|
||||||
$(View.publisher.selector).trigger(event);
|
$(View.publisher.selector).trigger(event);
|
||||||
expect($.fn.submit).toHaveBeenCalled();
|
expect($.fn.submit).toHaveBeenCalled();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue