From a76de35bb0e6fecf36111b698d9e7ad7fb997235 Mon Sep 17 00:00:00 2001 From: Gustavo Cortez Date: Thu, 12 Jun 2014 11:09:18 -0300 Subject: [PATCH 1/6] Fixes validation of input form. Improved error message --- index.html | 7 ++++--- js/directives.js | 10 ++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index c369e0920..8d286503e 100644 --- a/index.html +++ b/index.html @@ -649,9 +649,10 @@
0) { - if ($rootScope.availableBalance <= vNum) { + if (availableBalanceNum < vNum) { ctrl.$setValidity('enoughAmount', false); - scope.notEnoughAmount = 'Insufficient funds!'; + scope.notEnoughAmount = true; } else { ctrl.$setValidity('enoughAmount', true); scope.notEnoughAmount = null; From d746110f960da6e3ff43d86a4a706a9bf033a704 Mon Sep 17 00:00:00 2001 From: Gustavo Cortez Date: Thu, 12 Jun 2014 11:12:59 -0300 Subject: [PATCH 2/6] Tests for different amounts. --- test/unit/directives/directivesSpec.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/test/unit/directives/directivesSpec.js b/test/unit/directives/directivesSpec.js index 4f3b76d82..4cc8912f1 100644 --- a/test/unit/directives/directivesSpec.js +++ b/test/unit/directives/directivesSpec.js @@ -35,7 +35,7 @@ describe("Unit: Testing Directives", function() { describe('Validate Amount', function() { beforeEach(inject(function($compile, $rootScope) { $scope = $rootScope; - $rootScope.availableBalance = 2; + $rootScope.availableBalance = 0.101; var element = angular.element( '
' + '' + @@ -47,19 +47,21 @@ describe("Unit: Testing Directives", function() { form = $scope.form; })); - it('should validate between min and max value', function() { - form.amount.$setViewValue(1.2); + it('should validate', function() { + form.amount.$setViewValue(0.1); + expect(form.amount.$invalid).to.equal(false); + form.amount.$setViewValue(0.1009); expect(form.amount.$invalid).to.equal(false); }); - it('should not validate between min and max value', function() { + it('should not validate', function() { form.amount.$setViewValue(0); expect(form.amount.$invalid).to.equal(true); - form.amount.$setViewValue(9999999999999); + form.amount.$setViewValue(9999999999); expect(form.amount.$invalid).to.equal(true); - }); - it('should not validate because not enough amount', function() { form.amount.$setViewValue(2.1); expect(form.amount.$invalid).to.equal(true); + form.amount.$setViewValue(0.10091); + expect(form.amount.$invalid).to.equal(true); }); }); From 495aaf48b23736ce2b93968c97b0339d3869dbba Mon Sep 17 00:00:00 2001 From: Gustavo Cortez Date: Thu, 12 Jun 2014 16:13:05 -0300 Subject: [PATCH 3/6] Using a specific version of Bitcore to pass the Karma test. --- bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bower.json b/bower.json index 1a62c0715..4fde03614 100644 --- a/bower.json +++ b/bower.json @@ -18,7 +18,7 @@ "sjcl": "1.0.0", "file-saver": "*", "qrcode-decoder-js": "*", - "bitcore": "~0.1.19", + "bitcore": "git@github.com:bitpay/bitcore.git#1d957b24d9b4fbbd9d0f01f9ec566380bf4a2c23", "angular-moment": "~0.7.1", "socket.io-client": ">=1.0.0", "mousetrap": "1.4.6" From 5afcfb21aed2a6c229a6638d9c046c2402baeb2f Mon Sep 17 00:00:00 2001 From: Gustavo Cortez Date: Fri, 13 Jun 2014 12:37:06 -0300 Subject: [PATCH 4/6] Fixes to last version of bitcore (in bower). --- bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bower.json b/bower.json index 4fde03614..651b4e14d 100644 --- a/bower.json +++ b/bower.json @@ -18,7 +18,7 @@ "sjcl": "1.0.0", "file-saver": "*", "qrcode-decoder-js": "*", - "bitcore": "git@github.com:bitpay/bitcore.git#1d957b24d9b4fbbd9d0f01f9ec566380bf4a2c23", + "bitcore": "~0.1.24", "angular-moment": "~0.7.1", "socket.io-client": ">=1.0.0", "mousetrap": "1.4.6" From 2c96e3a017b587434b523084fb024055e86b8b56 Mon Sep 17 00:00:00 2001 From: Gustavo Cortez Date: Fri, 13 Jun 2014 14:39:10 -0300 Subject: [PATCH 5/6] Fix travis for update bower before test. --- .travis.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index aee558ffc..dfee2992d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,10 @@ language: node_js node_js: - "0.10" -before_install: "npm install -g grunt-cli" -install: "npm install" +before_install: + - "npm install -g grunt-cli" + - "npm install -g bower" +install: + - "npm install" + - "bower install" before_script: "grunt shell" From 325f1c4072300f1b0f34e4d456a51085e943338b Mon Sep 17 00:00:00 2001 From: Gustavo Cortez Date: Fri, 13 Jun 2014 14:58:47 -0300 Subject: [PATCH 6/6] Revert travis config. Bower is not necessary here. --- .travis.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index dfee2992d..aee558ffc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,6 @@ language: node_js node_js: - "0.10" -before_install: - - "npm install -g grunt-cli" - - "npm install -g bower" -install: - - "npm install" - - "bower install" +before_install: "npm install -g grunt-cli" +install: "npm install" before_script: "grunt shell"