From 455a7db76420febbf064955313e36cabdd78398e Mon Sep 17 00:00:00 2001 From: Pushpak Rangaiah Date: Mon, 24 Nov 2014 01:45:23 +0530 Subject: [PATCH 1/3] Changed dots to ellipsis in splitcharacters filter --- src/truncate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/truncate.js b/src/truncate.js index da77562..a11304c 100644 --- a/src/truncate.js +++ b/src/truncate.js @@ -29,7 +29,7 @@ angular.module('truncate', []) if (input && input.length > chars) { var prefix = input.substring(0, chars/2); var postfix = input.substring(input.length-chars/2, input.length); - return prefix + '...' + postfix; + return prefix + '…' + postfix; } return input; }; From cfc57b9842cb0c098bc741a07f21e1198cc806c7 Mon Sep 17 00:00:00 2001 From: Pushpak Rangaiah Date: Mon, 24 Nov 2014 01:46:41 +0530 Subject: [PATCH 2/3] Updated readme with splitcharacters example --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 10d3976..73d58a6 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ var myApp = angular.module('myApp', ['truncate']); ###When outputting text, apply the filter. ```html

- {{ text | characters:25 }} or {{ text | words:5 }} + {{ text | characters:25 }} or {{ text | splitcharacters:5 }} or {{ text | words:5 }}

``` @@ -32,4 +32,4 @@ By default, a _word_ will not be truncated. Set the optional boolean after the c

{{ text | characters:25 :true}}

- ``` \ No newline at end of file + ``` From f7d34291861875832d745579d7f235b3bad2a1aa Mon Sep 17 00:00:00 2001 From: Pushpak Rangaiah Date: Mon, 24 Nov 2014 01:50:05 +0530 Subject: [PATCH 3/3] Fixed tests --- test/unit/filtersSpec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/filtersSpec.js b/test/unit/filtersSpec.js index 92bc175..1b0d025 100644 --- a/test/unit/filtersSpec.js +++ b/test/unit/filtersSpec.js @@ -115,11 +115,11 @@ describe('truncate', function () { }); it('should trim these down', function () { - expect(characterFilter('1234567890', 5)).toEqual('12...890'); + expect(characterFilter('1234567890', 5)).toEqual('12…890'); }); it('should trim this down including the space', function () { - expect(characterFilter('123456789 10 11 12 13 14', 13)).toEqual('123456...2 13 14'); + expect(characterFilter('123456789 10 11 12 13 14', 13)).toEqual('123456…2 13 14'); }); it('should handle invalid numbers', function () {