diaspora/spec/javascripts/rails-spec.js
zhitomirskiyi abbf949fe1 publishing from a person profile page wip
mentioning a person from their profile page, added js & jasmine, still need to add the mention style, and prevent deselecting the last one

a tiny sass add

publishing from the profile works, need js translation

added the translation

made the hover state consistant

need to fix the cucumber spec

specs are green need to add a button

added the buttion to mention people

moved the publisher to the facebox

fixed the cucumbers for the modal window
2011-03-16 16:35:30 -07:00

32 lines
1.3 KiB
JavaScript

describe("rails", function() {
describe("remote forms", function() {
beforeEach(function() {
$("#jasmine_content").html(
'<form accept-charset="UTF-8" id="form" action="/status_messages" data-remote="true" method="post">' +
'<textarea id="status_message_text" name="status_message[text]">Some status message</textarea>' +
'<input type="submit">' +
'<input id="standard_hidden" type="hidden" value="keep this value">' +
'<input id="clearable_hidden" type="hidden" class="clear_on_submit" value="clear this value">' +
'</form>'
);
});
it("should retain form values if ajax fails", function() {
$('#form').trigger('ajax:failure');
expect($('#status_message_text').val()).not.toEqual("");
});
it("should clear form on ajax:success", function() {
$('#form').trigger('ajax:success');
expect($('#status_message_text').val()).toEqual("");
});
it('should not clear normal hidden fields', function(){
$('#form').trigger('ajax:success');
expect($('#standard_hidden').val()).toEqual("keep this value");
})
it('should clear hidden fields marked clear_on_submit', function(){
$('#form').trigger('ajax:success');
expect($('#clearable_hidden').val()).toEqual("");
})
});
});