Fix the thing that I broke in the build, fix syntax error in the build that disabled stream-spec
This commit is contained in:
parent
5676fdc73e
commit
cfd077a90d
3 changed files with 39 additions and 51 deletions
|
|
@ -64,8 +64,8 @@ describe AspectsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'generates a jasmine fixture with posts', :fixture => 'jasmine' do
|
it 'generates a jasmine fixture with posts', :fixture => 'jasmine' do
|
||||||
message = alice.post(:status_message, :text => "hello", :to => @alices_aspect_2.id)
|
message = alice.post(:status_message, :text => "hello "*800, :to => @alices_aspect_2.id)
|
||||||
bob.comment("what", :on => message)
|
4.times { bob.comment("what", :on => message) }
|
||||||
get :index
|
get :index
|
||||||
save_fixture(html_for("body"), "aspects_index_with_posts")
|
save_fixture(html_for("body"), "aspects_index_with_posts")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,20 +2,12 @@
|
||||||
* licensed under the Affero General Public License version 3 or later. See
|
* licensed under the Affero General Public License version 3 or later. See
|
||||||
* the COPYRIGHT file.
|
* the COPYRIGHT file.
|
||||||
*/
|
*/
|
||||||
function randomString(string_length) {
|
|
||||||
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz ";
|
|
||||||
var randomstring = '';
|
|
||||||
for (var i=0; i<string_length; i++) {
|
|
||||||
var rnum = Math.floor(Math.random() * chars.length);
|
|
||||||
randomstring += chars.substring(rnum,rnum+1);
|
|
||||||
}
|
|
||||||
return randomstring;
|
|
||||||
}
|
|
||||||
|
|
||||||
describe("Stream", function() {
|
describe("Stream", function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
jasmine.Clock.useMock();
|
jasmine.Clock.useMock();
|
||||||
spec.loadFixture('aspects_index_with_posts');
|
spec.loadFixture('aspects_index_with_posts');
|
||||||
|
Diaspora.widgets.i18n.locale = { };
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("initialize", function() {
|
describe("initialize", function() {
|
||||||
|
|
@ -27,44 +19,40 @@ describe("Stream", function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("adds a 'show more' links to long posts", function() {
|
it("adds a 'show more' links to long posts", function() {
|
||||||
$("#jasmine_content").html(
|
Diaspora.widgets.i18n.loadLocale(
|
||||||
'<li class="stream_element">' +
|
{show_more: 'Placeholder'}, 'en');
|
||||||
'<div class="content">' +
|
|
||||||
'<p id="text">' +
|
|
||||||
randomString(1000) +
|
|
||||||
'</p>' +
|
|
||||||
'</div>' +
|
|
||||||
'</li>'
|
|
||||||
);
|
|
||||||
Stream.initialize();
|
Stream.initialize();
|
||||||
expect($(".details").css('display')).toEqual('none');
|
stream_element = $('#main_stream .stream_element:first');
|
||||||
expect($(".read-more a").css('display').toEqual('inline');
|
expect(stream_element.find(".details").css('display')).toEqual('none');
|
||||||
expect($(".re-collapse a").css('display')).toEqual('none');
|
expect(stream_element.find(".read-more a").css('display')).toEqual('inline');
|
||||||
$(".read-more a").click();
|
stream_element.find(".read-more a").click();
|
||||||
jasmine.Clock.tick(200);
|
jasmine.Clock.tick(200);
|
||||||
expect($(".read-more a").css('display').toEqual('none');
|
expect(stream_element.find(".read-more").css('display')).toEqual('none');
|
||||||
expect($(".re-collapse a").css('display')).toEqual('inline');
|
expect(stream_element.find(".details").css('display')).toEqual('inline');
|
||||||
expect($(".details").css('display')).toEqual('inline');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("toggleComments", function() {
|
describe("toggleComments", function() {
|
||||||
beforeEach(function(){
|
|
||||||
jQuery('#main_stream a.show_post_comments:not(.show)').die();
|
|
||||||
Stream.initialize();
|
|
||||||
});
|
|
||||||
it("toggles class hidden on the comment block", function () {
|
it("toggles class hidden on the comment block", function () {
|
||||||
expect(jQuery('ul.comments')).not.toHaveClass("hidden");
|
link = $("a.show_post_comments");
|
||||||
$("a.show_post_comments").click();
|
expect(jQuery('ul.comments .older_comments')).toHaveClass("hidden");
|
||||||
|
Stream.toggleComments.call(
|
||||||
|
link, {preventDefault: function(){} }
|
||||||
|
);
|
||||||
jasmine.Clock.tick(200);
|
jasmine.Clock.tick(200);
|
||||||
expect(jQuery('ul.comments')).toHaveClass("hidden");
|
expect(jQuery('ul.comments .older_comments')).not.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)");
|
link = $("a.show_post_comments");
|
||||||
$("a.show_post_comments").click();
|
Diaspora.widgets.i18n.loadLocale(
|
||||||
|
{'comments.hide': 'comments.hide pl'}, 'en');
|
||||||
|
expect(link.text()).toEqual("show all comments");
|
||||||
|
Stream.toggleComments.call(
|
||||||
|
link, {preventDefault: function(){} }
|
||||||
|
);
|
||||||
jasmine.Clock.tick(200);
|
jasmine.Clock.tick(200);
|
||||||
expect($("a.show_post_comments").text()).toEqual("show comments (1)");
|
expect(link.text()).toEqual("comments.hide pl");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue