Skip to content
Extraits de code Groupes Projets
Valider 0222e4b2 rédigé par Florian Staudacher's avatar Florian Staudacher Validation de Maxwell Salzberg
Parcourir les fichiers

added intentionally failing specs, because dirty input breaks bookmarklet

see also #2741 #2751 #2800
parent 84f5561c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -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
......
/* 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();
});
});
});
\ No newline at end of file
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter