make unit configurable in settings. update after @cmgustavo comments
This commit is contained in:
parent
12b45fcfb9
commit
00ca9f1c32
14 changed files with 359 additions and 259 deletions
|
|
@ -8,6 +8,14 @@ describe("Unit: Testing Directives", function() {
|
|||
|
||||
beforeEach(module('copayApp.directives'));
|
||||
|
||||
|
||||
describe('Check config', function() {
|
||||
it('unit should be set to BITS in config.js', function() {
|
||||
expect(config.unitToSatoshi).to.equal(100);
|
||||
expect(config.unitName).to.equal('bits');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Validate Address', function() {
|
||||
beforeEach(inject(function($compile, $rootScope) {
|
||||
$scope = $rootScope;
|
||||
|
|
@ -15,8 +23,10 @@ describe("Unit: Testing Directives", function() {
|
|||
'<form name="form">' +
|
||||
'<input type="text" id="address" name="address" placeholder="Send to" ng-model="address" valid-address required>' +
|
||||
'</form>'
|
||||
);
|
||||
$scope.model = { address: null };
|
||||
);
|
||||
$scope.model = {
|
||||
address: null
|
||||
};
|
||||
$compile(element)($scope);
|
||||
$scope.$digest();
|
||||
form = $scope.form;
|
||||
|
|
@ -35,42 +45,47 @@ describe("Unit: Testing Directives", function() {
|
|||
describe('Validate Amount', function() {
|
||||
beforeEach(inject(function($compile, $rootScope) {
|
||||
$scope = $rootScope;
|
||||
$rootScope.availableBalance = 0.101;
|
||||
$rootScope.availableBalance = 1000;
|
||||
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 };
|
||||
);
|
||||
$scope.model = {
|
||||
amount: null
|
||||
};
|
||||
$compile(element)($scope);
|
||||
$scope.$digest();
|
||||
form = $scope.form;
|
||||
}));
|
||||
|
||||
|
||||
|
||||
it('should validate', function() {
|
||||
form.amount.$setViewValue(0.1);
|
||||
form.amount.$setViewValue(100);
|
||||
expect(form.amount.$invalid).to.equal(false);
|
||||
form.amount.$setViewValue(0.1009);
|
||||
form.amount.$setViewValue(900);
|
||||
expect(form.amount.$invalid).to.equal(false);
|
||||
});
|
||||
|
||||
it('should not validate', function() {
|
||||
form.amount.$setViewValue(0);
|
||||
expect(form.amount.$invalid).to.equal(true);
|
||||
form.amount.$setViewValue(9999999999);
|
||||
expect(form.amount.$invalid).to.equal(true);
|
||||
form.amount.$setViewValue(2.1);
|
||||
form.amount.$setViewValue(901);
|
||||
expect(form.amount.$invalid).to.equal(true);
|
||||
form.amount.$setViewValue(0.10091);
|
||||
form.amount.$setViewValue(1000);
|
||||
expect(form.amount.$invalid).to.equal(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Password strength', function() {
|
||||
beforeEach(inject(function($compile, $rootScope) {
|
||||
beforeEach(inject(function($compile, $rootScope) {
|
||||
$scope = $rootScope;
|
||||
var element = angular.element(
|
||||
'<input type="password" name="password" ng-model="password" check-strength="passwordStrength" value="asd" required>'
|
||||
);
|
||||
);
|
||||
$compile(element)($scope);
|
||||
$scope.$digest();
|
||||
}));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue