From 5d31a24e9edf460c7b89c5306a2fcc24a3df2e49 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 2 Dec 2010 02:54:38 +0300 Subject: [PATCH] fixed spec, jquery event binding doesnt call the function itself, but a 'clone' of the function --- public/javascripts/validation.js | 4 ++++ spec/javascripts/validation-spec.js | 13 +------------ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/public/javascripts/validation.js b/public/javascripts/validation.js index 937e03544..0a7279444 100644 --- a/public/javascripts/validation.js +++ b/public/javascripts/validation.js @@ -1,3 +1,7 @@ +/* Copyright (c) 2010, Diaspora Inc. This file is + * licensed under the Affero General Public License version 3 or later. See + * the COPYRIGHT file. + */ var Validation = { rules: { username: { diff --git a/spec/javascripts/validation-spec.js b/spec/javascripts/validation-spec.js index efca241de..0b9f4f197 100644 --- a/spec/javascripts/validation-spec.js +++ b/spec/javascripts/validation-spec.js @@ -11,23 +11,12 @@ describe("Validation", function() { describe("events", function() { it("contains all the events that use validation methods"); describe("usernameKeypress", function() { - beforeEach(function() { - $("#jasmine_content").html( - ' ' - ); - }); it("doesn't allow the user to type anything but letters, numbers and underscores", function() { expect(Validation.rules.username.characters.test("*")).toBeFalsy(); expect(Validation.rules.username.characters.test("Aa_")).toBeTruthy(); expect(Validation.rules.username.characters.test("ffffffffffffffffffffffffffffffffff")).toBeFalsy(); - }); - - it("is called when the user presses a key on #user_username") { - spyOn(Validation.events, "usernameKeypress"); - $("#user_username").keypress(); - expect(Validation.events.usernameKeypress).toHaveBeenCalled(); - }); + }); }); }); });