Warn about unsaved settings using jquery.areyousure

This commit is contained in:
Stefan Parviainen
2015-01-01 12:32:15 +01:00
parent 93b9470487
commit 9557908875
15 changed files with 1442 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
<form>
<input type="text" name="a">
<input type="submit">
</form>

View File

@@ -0,0 +1,28 @@
'use strict';
// Karma adds 'base/' to the default path
jasmine.getFixtures().fixturesPath = 'base/spec/javascripts/fixtures';
describe("A form's", function() {
var $form = undefined;
describe('text input', function() {
var $textInput = undefined;
beforeEach(function() {
loadFixtures('input-text.html');
$form = $('form');
$textInput = $('input[type=text]');
$form.areYouSure();
});
it('should cause dirtyness after its value changes', function(done) {
expect($form.hasClass('dirty')).toBe(false);
$textInput.val('new').change();
setTimeout(function() {
expect($form.hasClass('dirty')).toBe(true);
done();
}, 0);
});
});
});