added intentionally failing specs, because dirty input breaks bookmarklet

see also #2741 #2751 #2800
This commit is contained in:
Florian Staudacher 2012-02-07 21:47:53 +01:00 committed by Maxwell Salzberg
parent 84f5561c77
commit 0222e4b2ee
2 changed files with 65 additions and 0 deletions

View file

@ -16,9 +16,35 @@ describe StatusMessagesController do
end
describe '#bookmarklet' do
def pass_test_args(text='cute kitty')
get :bookmarklet, {:url => 'https://www.youtube.com/watch?v=0Bmhjf0rKe8',
:title => 'Surprised Kitty',
:notes => text}
end
it 'succeeds' do
get :bookmarklet
response.should be_success
#TODO replace response.body with html_for('body') as soon as there is a <body>
save_fixture(response.body, 'empty_bookmarklet')
end
it 'accepts get params' do
pass_test_args
response.should be_success
#TODO replace response.body with html_for('body') as soon as there is a <body>
save_fixture(response.body, 'prefilled_bookmarklet')
end
it 'correctly deals with dirty input' do
test_text = "**love** This is such a\n\n great \"cute kitty\" '''blabla'''"
pass_test_args(test_text)
response.should be_success
#TODO replace response.body with html_for('body') as soon as there is a <body>
save_fixture(response.body, 'prefilled_bookmarklet_dirty')
end
end

View file

@ -0,0 +1,39 @@
/* Copyright (c) 2010-2012, Diaspora Inc. This file is
* licensed under the Affero General Public License version 3 or later. See
* the COPYRIGHT file.
*/
describe("bookmarklet", function() {
describe("base functionality", function(){
beforeEach( function(){
spec.loadFixture('empty_bookmarklet');
});
it('verifies the publisher is loaded', function(){
expect(typeof Publisher === "object").toBeTruthy();
});
it('verifies we are using the bookmarklet', function(){
expect(Publisher.bookmarklet).toBeTruthy();
});
});
describe("prefilled bookmarklet", function(){
it('fills in some text into the publisher', function(){
spec.loadFixture('prefilled_bookmarklet');
expect($("#publisher #status_message_fake_text").val() == "").toBeFalsy();
expect($("#publisher #status_message_text").val() == "").toBeFalsy();
});
it('handles dirty input well', function(){
spec.loadFixture('prefilled_bookmarklet_dirty');
expect($("#publisher #status_message_fake_text").val() == "").toBeFalsy();
expect($("#publisher #status_message_text").val() == "").toBeFalsy();
});
});
});