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 AEB3911D5C for ; Tue, 5 Aug 2014 17:32:00 +0000 (UTC) Received: (qmail 2545 invoked by uid 500); 5 Aug 2014 17:32:00 -0000 Delivered-To: apmail-climate-commits-archive@climate.apache.org Received: (qmail 2451 invoked by uid 500); 5 Aug 2014 17:32:00 -0000 Mailing-List: contact commits-help@climate.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@climate.apache.org Delivered-To: mailing list commits@climate.apache.org Received: (qmail 2265 invoked by uid 99); 5 Aug 2014 17:32:00 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Aug 2014 17:32:00 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 1C6969BFF1A; Tue, 5 Aug 2014 17:32:00 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: joyce@apache.org To: commits@climate.apache.org Date: Tue, 05 Aug 2014 17:32:08 -0000 Message-Id: <89b558bfc2bc4d1ca9e2f05ef826fffb@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [10/19] git commit: Transition isodatetomiddleendian filter tests Transition isodatetomiddleendian filter tests Project: http://git-wip-us.apache.org/repos/asf/climate/repo Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/bce574b5 Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/bce574b5 Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/bce574b5 Branch: refs/heads/master Commit: bce574b53fd3bf3b02b24d9a39a66f14a8d3085d Parents: e092e0f Author: Michael Joyce Authored: Fri Aug 1 13:47:50 2014 -0700 Committer: Michael Joyce Committed: Mon Aug 4 15:01:02 2014 -0700 ---------------------------------------------------------------------- .../test/spec/filters/isodatetomiddleendian.js | 46 ++++++++++++++++++-- 1 file changed, 42 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/climate/blob/bce574b5/ocw-ui/frontend-new/test/spec/filters/isodatetomiddleendian.js ---------------------------------------------------------------------- diff --git a/ocw-ui/frontend-new/test/spec/filters/isodatetomiddleendian.js b/ocw-ui/frontend-new/test/spec/filters/isodatetomiddleendian.js index 72ab650..966b333 100644 --- a/ocw-ui/frontend-new/test/spec/filters/isodatetomiddleendian.js +++ b/ocw-ui/frontend-new/test/spec/filters/isodatetomiddleendian.js @@ -30,9 +30,47 @@ describe('Filter: ISODateToMiddleEndian', function () { ISODateToMiddleEndian = $filter('ISODateToMiddleEndian'); })); - it('should return the input prefixed with "ISODateToMiddleEndian filter:"', function () { - var text = 'angularjs'; - expect(ISODateToMiddleEndian(text)).toBe('ISODateToMiddleEndian filter: ' + text); - }); + describe('ISODateToMiddleEndian', function() { + it('should replace the ISO Date/Time stamp', function() { + inject(function($filter) { + var filter = $filter('ISODateToMiddleEndian'); + expect(filter('2012-01-02T00:00:00')).toEqual('01/02/2012'); + }); + }); + it('should replace the modified ISO Date/Time stamp', function() { + inject(function($filter) { + var filter = $filter('ISODateToMiddleEndian'); + expect(filter('2012-01-02 00:00:00')).toEqual('01/02/2012'); + }); + }); + + it('should replace the ISO Date stamp', function() { + inject(function($filter) { + var filter = $filter('ISODateToMiddleEndian'); + expect(filter('2012-01-02')).toEqual('01/02/2012'); + }); + }); + + it('should replace leading and trailing whitespace', function() { + inject(function($filter) { + var filter = $filter('ISODateToMiddleEndian'); + expect(filter(' 2012-01-02T00:00:00 ')).toEqual('01/02/2012'); + }); + }); + + it('should do nothing when the date format has the incorrect number of hyphens', function() { + inject(function($filter) { + var filter = $filter('ISODateToMiddleEndian'); + expect(filter('2012-234T234')).toEqual('2012-234T234') + }); + }); + + it('should do nothing when the date format has no hyphens', function() { + inject(function($filter) { + var filter = $filter('ISODateToMiddleEndian'); + expect(filter('2012234T234')).toEqual('2012234T234') + }); + }); + }); });