mirror of https://github.com/BTCPrivate/copay.git
Fixed test and new test entry for new method
This commit is contained in:
parent
2de90d093e
commit
e330da0b9b
|
@ -283,10 +283,23 @@ describe("Unit: Controllers", function() {
|
|||
});
|
||||
|
||||
describe('Send Controller', function() {
|
||||
var sendCtrl;
|
||||
beforeEach(inject(function($controller, $rootScope) {
|
||||
var sendCtrl, form;
|
||||
beforeEach(inject(function($compile, $rootScope, $controller) {
|
||||
scope = $rootScope.$new();
|
||||
$rootScope.availableBalance = 123456;
|
||||
|
||||
var element = angular.element(
|
||||
'<form name="form">' +
|
||||
'<input type="number" id="amount" name="amount" placeholder="Amount" ng-model="amount" min="0.0001" max="10000000" enough-amount required>' +
|
||||
'</form>'
|
||||
);
|
||||
scope.model = {
|
||||
amount: null
|
||||
};
|
||||
$compile(element)(scope);
|
||||
scope.$digest();
|
||||
form = scope.form;
|
||||
|
||||
sendCtrl = $controller('SendController', {
|
||||
$scope: scope,
|
||||
$modal: {},
|
||||
|
@ -297,8 +310,15 @@ describe("Unit: Controllers", function() {
|
|||
expect(scope.isMobile).not.to.equal(null);
|
||||
});
|
||||
it('should autotop balance correctly', function() {
|
||||
scope.topAmount();
|
||||
scope.topAmount(form);
|
||||
form.amount.$setViewValue(123356);
|
||||
expect(scope.amount).to.equal(123356);
|
||||
expect(form.amount.$invalid).to.equal(false);
|
||||
expect(form.amount.$pristine).to.equal(false);
|
||||
});
|
||||
it('should return available amount', function() {
|
||||
var amount = scope.getAvailableAmount();
|
||||
expect(amount).to.equal(123356);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue