fix failing bookmarklet specs (wait for js to finish)

This commit is contained in:
Florian Staudacher 2012-08-04 16:04:44 +02:00
parent 9d11748486
commit 932fb186e3
2 changed files with 15 additions and 9 deletions

View file

@ -24,6 +24,8 @@
window.setTimeout(window.close, 2000, true); window.setTimeout(window.close, 2000, true);
}); });
// this has to happen after the publisher has finished loading, otherwise
// the textarea is cleared again by the initialization of the mentions plugin
$(function(){ $(function(){
$("#publisher #status_message_fake_text").val(contents); $("#publisher #status_message_fake_text").val(contents);
$("#publisher #status_message_text").val(contents); $("#publisher #status_message_text").val(contents);

View file

@ -1,7 +1,7 @@
/* Copyright (c) 2010-2012, Diaspora Inc. This file is /* Copyright (c) 2010-2012, Diaspora Inc. This file is
* 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.
*/ */
describe("bookmarklet", function() { describe("bookmarklet", function() {
@ -22,18 +22,22 @@ describe("bookmarklet", function() {
describe("prefilled bookmarklet", function(){ describe("prefilled bookmarklet", function(){
it('fills in some text into the publisher', function(){ it('fills in some text into the publisher', function(){
spec.loadFixture('prefilled_bookmarklet'); spec.loadFixture('prefilled_bookmarklet');
expect($("#publisher #status_message_fake_text").val() == "").toBeFalsy(); _.defer(function() {
expect($("#publisher #status_message_text").val() == "").toBeFalsy(); expect($("#publisher #status_message_fake_text").val() == "").toBeFalsy();
expect($("#publisher #status_message_text").val() == "").toBeFalsy();
});
}); });
it('handles dirty input well', function(){ it('handles dirty input well', function(){
spec.loadFixture('prefilled_bookmarklet_dirty'); spec.loadFixture('prefilled_bookmarklet_dirty');
expect($("#publisher #status_message_fake_text").val() == "").toBeFalsy(); _.defer(function() {
expect($("#publisher #status_message_text").val() == "").toBeFalsy(); expect($("#publisher #status_message_fake_text").val() == "").toBeFalsy();
expect($("#publisher #status_message_text").val() == "").toBeFalsy();
};
}); });
}); });
}); });