From commits-return-638-apmail-climate-commits-archive=climate.apache.org@climate.incubator.apache.org Tue Aug 27 17:37:04 2013 Return-Path: X-Original-To: apmail-climate-commits-archive@minotaur.apache.org Delivered-To: apmail-climate-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1FDFB10989 for ; Tue, 27 Aug 2013 17:37:04 +0000 (UTC) Received: (qmail 50265 invoked by uid 500); 27 Aug 2013 17:37:03 -0000 Delivered-To: apmail-climate-commits-archive@climate.apache.org Received: (qmail 50179 invoked by uid 500); 27 Aug 2013 17:37:01 -0000 Mailing-List: contact commits-help@climate.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@climate.incubator.apache.org Delivered-To: mailing list commits@climate.incubator.apache.org Received: (qmail 50166 invoked by uid 99); 27 Aug 2013 17:37:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Aug 2013 17:37:00 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Aug 2013 17:36:59 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 544CB238889B; Tue, 27 Aug 2013 17:36:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1517893 - /incubator/climate/trunk/rcmet/src/main/ui/test/unit/directives/OnBlur.js Date: Tue, 27 Aug 2013 17:36:39 -0000 To: commits@climate.incubator.apache.org From: joyce@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20130827173639.544CB238889B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: joyce Date: Tue Aug 27 17:36:38 2013 New Revision: 1517893 URL: http://svn.apache.org/r1517893 Log: CLIMATE-280 - Add test for OnBlur - Add unit test to check that on-blur calls the function passed to it when a 'blur' event is triggered. Added: incubator/climate/trunk/rcmet/src/main/ui/test/unit/directives/OnBlur.js Added: incubator/climate/trunk/rcmet/src/main/ui/test/unit/directives/OnBlur.js URL: http://svn.apache.org/viewvc/incubator/climate/trunk/rcmet/src/main/ui/test/unit/directives/OnBlur.js?rev=1517893&view=auto ============================================================================== --- incubator/climate/trunk/rcmet/src/main/ui/test/unit/directives/OnBlur.js (added) +++ incubator/climate/trunk/rcmet/src/main/ui/test/unit/directives/OnBlur.js Tue Aug 27 17:36:38 2013 @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +**/ + +'use strict'; + +describe('directives', function() { + beforeEach(module('ocw')); + + describe('onBlur directive', function() { + it('should call the supplied function on the blur event', function() { + inject(function($compile, $rootScope) { + // Set a rootScope variable to make sure that on-blur calls + // the function that we pass to it. + $rootScope.bogusFunction = function() { + $rootScope.test = "hi" + } + + var element = $compile('')($rootScope); + + expect($rootScope.test).toNotBe('hi'); + element.trigger('blur'); + expect($rootScope.test).toBe('hi'); + }); + }); + }); +});