diff --git a/examples/index.html b/examples/index.html index e734269..19af347 100644 --- a/examples/index.html +++ b/examples/index.html @@ -28,7 +28,7 @@

Example of angular dynamic number directive

-
+
@@ -49,6 +49,11 @@

Example of angular dynamic number directive

How looks model: {{value9}}
+
+ + +
How looks model: {{value12}}
+
diff --git a/test/directiveSpec.js b/test/directiveSpec.js index 91d277d..8ca92e1 100644 --- a/test/directiveSpec.js +++ b/test/directiveSpec.js @@ -233,6 +233,22 @@ describe('Angular-dynamic-number basic', function() { expect($scope.testForm.testInput.$viewValue).toEqual('-111 111.11'); }); }); + describe('number format: 6 integeres, decimals dot separator, positive and negative, apostrophe thousand separator', function() { + beforeEach(function(){ + var el = $compile('')($scope); + $scope.$digest(); + }); + it('should have view value 111\'111.11 and model value 111111.11 when set 111\'111.11', function () { + $scope.testForm.testInput.$setViewValue('111\'111.11'); + expect($scope.testInput).toEqual('111111.11'); + expect($scope.testForm.testInput.$viewValue).toEqual('111\'111.11'); + }); + it('should have view value -111\'111.11 and model value -111111.11 when set -111\'111.11', function () { + $scope.testForm.testInput.$setViewValue('-111\'111.11'); + expect($scope.testInput).toEqual('-111111.11'); + expect($scope.testForm.testInput.$viewValue).toEqual('-111\'111.11'); + }); + }); describe('custom strategy provider', function(){ beforeEach(function(){ dynamicNumberStrategyProvider.addStrategy('price', {