Merge pull request #2060 from matiu/bug/payment-intent
Bug/payment intent
This commit is contained in:
commit
c2598b2646
39 changed files with 935 additions and 888 deletions
|
|
@ -26,7 +26,7 @@ var inherits = function(ctor, superCtor) {
|
|||
|
||||
inherits(FakeSocket, EventEmitter);
|
||||
|
||||
FakeSocket.prototype.removeEventListener = function() {
|
||||
FakeSocket.prototype.removeListener = function() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -195,16 +195,16 @@ describe("Unit: Controllers", function() {
|
|||
scope.model = {
|
||||
newaddress: null,
|
||||
newlabel: null,
|
||||
address: null,
|
||||
amount: null
|
||||
_address: null,
|
||||
_amount: null
|
||||
};
|
||||
$compile(element)(scope);
|
||||
|
||||
var element2 = angular.element(
|
||||
'<form name="form2">' +
|
||||
'<input type="text" id="address" name="address" ng-model="address" valid-address required>' +
|
||||
'<input type="number" id="amount" name="amount" ng-model="amount" min="1" max="10000000000" required>' +
|
||||
'<input type="number" id="alternative" name="alternative" ng-model="alternative">' +
|
||||
'<input type="text" id="address" name="address" ng-model="_address" valid-address required>' +
|
||||
'<input type="number" id="amount" name="amount" ng-model="_amount" min="1" max="10000000000" required>' +
|
||||
'<input type="number" id="alternative" name="alternative" ng-model="_alternative">' +
|
||||
'<textarea id="comment" name="comment" ng-model="commentText" ng-maxlength="100"></textarea>' +
|
||||
'</form>'
|
||||
);
|
||||
|
|
@ -213,7 +213,7 @@ describe("Unit: Controllers", function() {
|
|||
$scope: scope,
|
||||
$modal: {},
|
||||
});
|
||||
|
||||
scope.init();
|
||||
scope.$digest();
|
||||
form = scope.form;
|
||||
sendForm = scope.form2;
|
||||
|
|
@ -221,11 +221,11 @@ describe("Unit: Controllers", function() {
|
|||
}));
|
||||
|
||||
it('should have a SendController controller', function() {
|
||||
expect(scope.loading).equal(false);
|
||||
should.exist(scope.submitForm);
|
||||
});
|
||||
|
||||
it('should have a title', function() {
|
||||
expect(scope.title).equal('Create Transaction Proposal');
|
||||
expect(scope.title);
|
||||
});
|
||||
|
||||
it('should validate address with network', function() {
|
||||
|
|
@ -302,7 +302,8 @@ describe("Unit: Controllers", function() {
|
|||
scope.rateService.whenAvailable(function() {
|
||||
sendForm.amount.$setViewValue(1e6);
|
||||
scope.$digest();
|
||||
expect(scope.alternative).to.equal(2);
|
||||
expect(scope._amount).to.equal(1e6);
|
||||
expect(scope.__alternative).to.equal(2);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
@ -310,7 +311,8 @@ describe("Unit: Controllers", function() {
|
|||
scope.rateService.whenAvailable(function() {
|
||||
sendForm.alternative.$setViewValue(2);
|
||||
scope.$digest();
|
||||
expect(scope.amount).to.equal(1e6);
|
||||
expect(scope.__alternative).to.equal(2);
|
||||
expect(scope._amount).to.equal(1e6);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
@ -517,7 +519,7 @@ describe("Unit: Controllers", function() {
|
|||
});
|
||||
});
|
||||
|
||||
describe('UriPayment Controller', function() {
|
||||
describe('paymentUriController Controller', function() {
|
||||
var what;
|
||||
beforeEach(inject(function($controller, $rootScope, $location) {
|
||||
scope = $rootScope.$new();
|
||||
|
|
@ -528,7 +530,7 @@ describe("Unit: Controllers", function() {
|
|||
amount: 0.1,
|
||||
message: "a bitcoin donation"
|
||||
};
|
||||
what = $controller('UriPaymentController', {
|
||||
what = $controller('paymentUriController', {
|
||||
$scope: scope,
|
||||
$routeParams: routeParams,
|
||||
$location: {
|
||||
|
|
@ -546,9 +548,7 @@ describe("Unit: Controllers", function() {
|
|||
it('should parse url correctly', function() {
|
||||
should.exist(what);
|
||||
should.exist(scope.pendingPayment);
|
||||
scope.pendingPayment.address.data.should.equal('19mP9FKrXqL46Si58pHdhGKow88SUPy1V8');
|
||||
scope.pendingPayment.data.amount.should.equal(0.1);
|
||||
scope.pendingPayment.data.message.should.equal('a bitcoin donation');
|
||||
scope.pendingPayment.should.equal('bitcoin:19mP9FKrXqL46Si58pHdhGKow88SUPy1V8?amount=0.1&message=a bitcoin donation');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -94,9 +94,6 @@ describe("Unit: Testing Directives", function() {
|
|||
form.amount.$setViewValue(800);
|
||||
expect(form.amount.$invalid).to.equal(false);
|
||||
form.amount.$setViewValue(900);
|
||||
expect($scope.notValidAmount).to.equal(null);
|
||||
form.amount.$setViewValue(0.44);
|
||||
expect($scope.notValidAmount).to.equal(null);
|
||||
|
||||
});
|
||||
|
||||
|
|
@ -105,8 +102,6 @@ describe("Unit: Testing Directives", function() {
|
|||
expect(form.amount.$invalid).to.equal(true);
|
||||
form.amount.$setViewValue(999999999999);
|
||||
expect(form.amount.$invalid).to.equal(true);
|
||||
form.amount.$setViewValue(0.333);
|
||||
expect($scope.notValidAmount).to.equal(true);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -134,19 +129,15 @@ describe("Unit: Testing Directives", function() {
|
|||
|
||||
it('should validate', function() {
|
||||
form.amount.$setViewValue(0.01);
|
||||
expect($scope.notValidAmount).to.equal(null);
|
||||
expect(form.amount.$invalid).to.equal(false);
|
||||
form.amount.$setViewValue(0.039);
|
||||
expect($scope.notValidAmount).to.equal(null);
|
||||
expect(form.amount.$invalid).to.equal(false);
|
||||
form.amount.$setViewValue(100292.039);
|
||||
expect($scope.notValidAmount).to.equal(null);
|
||||
expect(form.amount.$invalid).to.equal(false);
|
||||
});
|
||||
|
||||
it('should not validate', function() {
|
||||
form.amount.$setViewValue(0.039998888888888);
|
||||
expect($scope.notValidAmount).to.equal(true);
|
||||
expect(form.amount.$invalid).to.equal(true);
|
||||
form.amount.$setViewValue(0);
|
||||
expect(form.amount.$invalid).to.equal(true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue