Created
September 28, 2011 13:11
-
-
Save padi/1247893 to your computer and use it in GitHub Desktop.
where do i put the function that runs the same tests? (lines 42-52 and 62-72)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe("jQuery validate remote option", function() { | |
| var body, form; | |
| beforeEach(function() { | |
| body = $('body'); | |
| spyOnEvent(body, 'signup:timeout'); | |
| spyOnEvent(body, 'signup:connecting'); | |
| spyOnEvent(body, 'signup:timeoutRecovery'); | |
| loadFixtures('sign-up-form.fixture.html'); | |
| form = $('#jasmine-fixtures form'); | |
| form.tdSignUpForm({ debug: true }); | |
| }); | |
| describe("when there is no response on focus out", function() { | |
| beforeEach(function() { | |
| form.find('input#user_email').val('first@trafficdito.com'); | |
| form.find('input#user_email').focusout(); | |
| mostRecentAjaxRequest().response({}); //disconnected, so there is no response. We'll simulate it like this for now | |
| }); | |
| it("should not show check icon", function() { | |
| expect(form).not.toContain('input#user_email + .icon.valid'); | |
| }); | |
| it("should not show error icon", function() { | |
| expect(form).not.toContain('input#user_email + .icon.error'); | |
| }); | |
| it("should trigger signup:timeout event", function() { | |
| expect('signup:timeout').toHaveBeenTriggeredOn(body); | |
| }); | |
| describe("on focus out", function() { | |
| beforeEach(function() { | |
| form.find('input#user_email').val('second@trafficdito.com'); | |
| form.find('input#user_email').focusout(); | |
| mostRecentAjaxRequest().response({ status: 200 }); | |
| }); | |
| it("should revalidate", function() { | |
| expect(mostRecentAjaxRequest().url).toMatch(/second%40trafficdito.com/); | |
| }); | |
| it("should trigger signup:connecting event", function() { | |
| expect('signup:connecting').toHaveBeenTriggeredOn(body); | |
| }); | |
| it("should trigger signup:timeoutRecovery event", function() { | |
| expect('signup:timeoutRecovery').toHaveBeenTriggeredOn(body); | |
| }); | |
| }); | |
| describe("on submit", function() { | |
| beforeEach(function() { | |
| form.find('input#user_email').val('second@trafficdito.com'); | |
| form.submit(); | |
| mostRecentAjaxRequest().response({ status: 200 }); | |
| }); | |
| it("should revalidate", function() { | |
| expect(mostRecentAjaxRequest().url).toMatch(/second%40trafficdito.com/); | |
| }); | |
| it("should trigger signup:connecting event", function() { | |
| expect('signup:connecting').toHaveBeenTriggeredOn(body); | |
| }); | |
| it("should trigger signup:timeoutRecovery event", function() { | |
| expect('signup:timeoutRecovery').toHaveBeenTriggeredOn(body); | |
| }); | |
| }); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment