aboutsummaryrefslogtreecommitdiffstats
path: root/library/jquery.AreYouSure/spec/javascripts/jquery.are-you-sure_spec.js
blob: 5e02f7cb02483b4041da8a57d9b97e1137144b0f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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);
    });
  });
});