Merge pull request #521 from cmgustavo/bug/ui-forms

Bug/uiforms_test_karma
This commit is contained in:
Mario Colque 2014-06-03 11:39:07 -03:00
commit 529ab11481
9 changed files with 105 additions and 82 deletions

View file

@ -169,7 +169,7 @@ h3 {
border-right: 2px dashed #E3E3E3; border-right: 2px dashed #E3E3E3;
} }
@media (max-width: 1025px) { @media (max-width: 640px) {
.line-dashed-v { .line-dashed-v {
border: none; border: none;
} }
@ -347,11 +347,7 @@ hr { margin: 2.25rem 0;}
} }
.box-setup { .box-setup {
padding: 20px 30px; margin-bottom: 25px;
border: 1px solid #eee;
background: #fff;
overflow: hidden;
margin-bottom: 10px;
} }
.box-setup-copayers { .box-setup-copayers {
@ -483,19 +479,6 @@ a.loading {
vertical-align:middle vertical-align:middle
} }
fieldset {
border: 1px solid #eee;
padding: 1.11111rem;
margin: 1rem 0;
}
fieldset legend {
font-weight: bold;
padding: 0 0.16667rem;
margin: 0;
margin-left: -0.16667rem;
}
/* notifications */ /* notifications */
.dr-notification-container { .dr-notification-container {

View file

@ -321,3 +321,7 @@ input.ng-invalid-wallet-secret {
color: #3FBC9C; color: #3FBC9C;
} }
.box-setup fieldset {
background: #fff;
}

View file

@ -203,13 +203,10 @@
</div> </div>
<div ng-show="!wallets.length"> <div ng-show="!wallets.length">
<h3>Create a new wallet</h3> <h3>Create a new wallet</h3>
<form name="createForm" ng-submit="create(createForm)" novalidate>
<p class="text-gray"> <p class="text-gray">
Copay is a free, open-source, multisignature bitcoin wallet. A single-owner bitcoin wallet's security depends on carefully securing the private keys. With copay you can have multiple people controlling the funds, using bitcoin's multisignature functionality, requiring no trust in any third party. Copay is a free, open-source, multisignature bitcoin wallet. A single-owner bitcoin wallet's security depends on carefully securing the private keys. With copay you can have multiple people controlling the funds, using bitcoin's multisignature functionality, requiring no trust in any third party.
</p> </p>
<button type="submit" class="button secondary radius" <a href="#setup" class="button secondary radius">Create</a>
ng-disabled="createForm.$invalid || loading" loading="Creating">Create</button>
</form>
</div> </div>
</div> </div>
</div> </div>
@ -257,19 +254,21 @@
<label for="backupText" ng-click="pastetext=!pastetext" class="m10b">&middot; Paste backup plain text code <i class="fi-clipboard"></i></label> <label for="backupText" ng-click="pastetext=!pastetext" class="m10b">&middot; Paste backup plain text code <i class="fi-clipboard"></i></label>
<textarea class="form-control" name="backupText" ng-model="backupText" rows="5" ng-show="pastetext"></textarea> <textarea class="form-control" name="backupText" ng-model="backupText" rows="5" ng-show="pastetext"></textarea>
</fieldset> </fieldset>
</div>
<div class="large-8 medium-8 columns"> <div class="large-6 large-centered medium-6 medium-centered columns">
<label for="password">Password <small>Required</small></label> <label for="password">Password <small>Required</small></label>
<input type="password" class="form-control" placeholder="Your wallet password" name="password" ng-model="password" required> <input type="password" class="form-control" placeholder="Your wallet password" name="password" ng-model="password" required>
</div> </div>
</div>
</div> </div>
<div class="row"> <div class="row line-dashed">
<div class="large-12 columns line-dashed"> <div class="large-6 medium-6 small-5 columns text-left">
<a class="button secondary radius" href="#signin">Go back</a>
</div>
<div class="large-6 medium-6 small-5 columns text-right">
<button type="submit" class="button primary radius right" ng-disabled="importForm.$invalid" loading="Importing"> <button type="submit" class="button primary radius right" ng-disabled="importForm.$invalid" loading="Importing">
Import backup Import backup
</button> </button>
<a class="button secondary radius" href="#signin">Go back</a>
</div> </div>
</div> </div>
</form> </form>
@ -285,46 +284,64 @@
</div> </div>
<div ng-show="!loading"> <div ng-show="!loading">
<form name="setupForm" ng-submit="create(setupForm)" novalidate> <form name="setupForm" ng-submit="create(setupForm)" novalidate>
<div class="small-12 medium-8 medium-centered large-8 large-centered columns box-setup"> <h3>Create new wallet</h3>
<h3>Create new wallet</h3>
<div class="large-6 columns line-dashed-v">
<h6>Select total number of copayers</h6>
<select ng-model="totalCopayers" ng-options="totalCopayers as totalCopayers for totalCopayers in TCValues">
</select>
</div>
<div class="large-6 columns">
<h6>Select required signatures</h6>
<select ng-model="requiredCopayers" ng-options="requiredCopayers as requiredCopayers for requiredCopayers in RCValues">
</select>
</div>
</div>
<div class="row"> <div class="row">
<div class="small-12 medium-6 medium-centered large-6 large-centered columns m30v"> <div class="small-12 medium-8 medium-centered large-8 large-centered columns">
<label>Wallet name <small>Optional</small>
<input type="text" placeholder="Family vacation funds" class="form-control" ng-model="walletName">
</label>
</div>
<div class="small-12 medium-8 medium-centered large-8 large-centered columns">
<div class="row">
<div class="small-12 medium-6 large-6 columns">
<label>Your name <small>Optional</small>
<input type="text" placeholder="Name" class="form-control" ng-model="myNickname">
</label>
</div>
<div class="small-12 medium-6 large-6 columns">
<label>Your Wallet Password <small class="has-tip" tooltip="doesn't need to be shared">Required</small>
<input type="password" placeholder="Choose your password" class="form-control"
ng-model="walletPassword" required>
</label>
</div>
</div>
</div>
<div class="small-12 medium-8 medium-centered large-8 large-centered columns box-setup">
<fieldset>
<div class="row">
<div class="large-6 medium-6 columns line-dashed-v">
<label>Select total number of copayers
<select ng-model="totalCopayers" ng-options="totalCopayers as totalCopayers for totalCopayers in TCValues">
</select>
</label>
</div>
<div class="large-6 medium-6 columns">
<label>Select required signatures
<select ng-model="requiredCopayers" ng-options="requiredCopayers as requiredCopayers for requiredCopayers in RCValues">
</select>
</label>
</div>
</div>
</fieldset>
</div>
<div class="small-12 medium-6 medium-centered large-6 large-centered columns m10b">
<div class="box-setup-copayers"> <div class="box-setup-copayers">
<div class="box-setup-copayers-fix"> <div class="box-setup-copayers-fix">
<img class="box-setup-copay" ng-repeat="i in getNumber(totalCopayers) track by $index" src="./img/satoshi.gif" alt="Copayer {{$index+1}}-{{totalCopayers}}" ng-class="{'box-setup-copay-required': ($index+1) <= requiredCopayers}"> <img class="box-setup-copay" ng-repeat="i in getNumber(totalCopayers) track by $index" src="./img/satoshi.gif" alt="Copayer {{$index+1}}-{{totalCopayers}}" ng-class="{'box-setup-copay-required': ($index+1) <= requiredCopayers}">
</div> </div>
</div> </div>
</div> </div>
<div class="small-12 medium-6 medium-centered large-6 large-centered columns m30v">
<h6>Your Wallet Password<small>(doesn't need to be shared) Required</small></h6>
<input type="password" placeholder="Choose your password" class="form-control"
ng-model="$parent.walletPassword" check-strength="passwordStrength" tooltip="Password strength: {{passwordStrength}}" tooltip-trigger="focus" required>
</div>
<div class="small-12 medium-6 medium-centered large-6 large-centered columns m30v">
<h6>Wallet name <small>Optional</small></h6>
<input type="text" placeholder="Family vacation funds" class="form-control" ng-model="walletName">
</div>
<div class="small-12 medium-6 medium-centered large-6 large-centered columns m30v">
<h6>Your name <small>Optional</small></h6>
<input type="text" placeholder="Name" class="form-control" ng-model="myNickname">
</div>
</div> </div>
<div class="large-12 columns line-dashed">
<button type="submit" class="button primary radius right" ng-disabled="setupForm.$invalid || loading"> <div class="row line-dashed">
Create {{requiredCopayers}}-of-{{totalCopayers}} wallet <div class="large-6 medium-6 small-5 columns text-left">
</button> <a class="button secondary radius" href="#signin">Go back</a>
<a class="button secondary radius" href="#signin">Go back</a> </div>
<div class="large-6 medium-6 small-7 columns text-right">
<button type="submit" class="button primary radius" ng-disabled="setupForm.$invalid || loading">
Create {{requiredCopayers}}-of-{{totalCopayers}} wallet
</button>
</div>
</div> </div>
</form> </form>
</div> </div>

View file

@ -21,8 +21,6 @@ angular.module('copay.header').controller('HeaderController',
'link': '#/backup' 'link': '#/backup'
}]; }];
var beep = new Audio('sound/transaction.mp3');
$http.get('https://api.github.com/repos/bitpay/copay/tags').success(function(data){ $http.get('https://api.github.com/repos/bitpay/copay/tags').success(function(data){
var toInt = function (s) { return parseInt(s); }; var toInt = function (s) { return parseInt(s); };
var latestVersion = data[0].name.replace('v', '').split('.').map(toInt); var latestVersion = data[0].name.replace('v', '').split('.').map(toInt);
@ -54,6 +52,7 @@ angular.module('copay.header').controller('HeaderController',
} }
} }
if (currentAddr) { if (currentAddr) {
var beep = new Audio('sound/transaction.mp3');
$notification.funds('Received fund', currentAddr, receivedFund); $notification.funds('Received fund', currentAddr, receivedFund);
beep.play(); beep.play();
} }

View file

@ -43,6 +43,7 @@ angular.module('copay.import').controller('ImportController',
if (!backupFile && !backupText) { if (!backupFile && !backupText) {
$scope.loading = false; $scope.loading = false;
$rootScope.$flashMessage = { message: 'Please, select your backup file or paste the text', type: 'error'}; $rootScope.$flashMessage = { message: 'Please, select your backup file or paste the text', type: 'error'};
$scope.loading = false;
return; return;
} }

View file

@ -12,10 +12,6 @@ angular.module('copay.signin').controller('SigninController',
$scope.selectedWalletId = $scope.wallets.length ? $scope.wallets[0].id : null; $scope.selectedWalletId = $scope.wallets.length ? $scope.wallets[0].id : null;
$scope.openPassword = ''; $scope.openPassword = '';
$scope.create = function(form) {
$location.path('setup');
};
$scope.open = function(form) { $scope.open = function(form) {
if (form && form.$invalid) { if (form && form.$invalid) {
$rootScope.$flashMessage = { message: 'Please, enter required fields', type: 'error'}; $rootScope.$flashMessage = { message: 'Please, enter required fields', type: 'error'};

View file

@ -15,16 +15,29 @@ module.exports = function(config) {
// list of files / patterns to load in the browser // list of files / patterns to load in the browser
files: [ files: [
//3rd Party Code //Configs
'lib/angular/angular.min.js', 'config.js',
'lib/angular-route/angular-route.js',
'lib/angular-mocks/angular-mocks.js',
'lib/bitcore.js',
'lib/socket.io.js',
//App-specific Code 'lib/angular/angular.min.js',
'js/*.js', 'lib/angular-mocks/angular-mocks.js',
'js/**/*.js', 'lib/moment/moment.js',
'lib/angular-moment/angular-moment.js',
'lib/qrcode-generator/js/qrcode.js',
'lib/angular-qrcode/qrcode.js',
'lib/angular-route/angular-route.min.js',
'lib/angular-foundation/mm-foundation.min.js',
'lib/angular-foundation/mm-foundation-tpls.min.js',
'lib/peer.js',
'lib/bitcore/browser/bundle.js',
'lib/crypto-js/rollups/sha256.js',
'lib/crypto-js/rollups/pbkdf2.js',
'lib/crypto-js/rollups/aes.js',
'lib/file-saver/FileSaver.js',
'lib/socket.io.js',
'lib/sjcl.js',
'lib/ios-imagefile-megapixel/megapix-image.js',
'lib/qrcode-decoder-js/lib/qrcode-decoder.min.js',
'js/copayBundle.js',
//Test-Specific Code //Test-Specific Code
'lib/chai/chai.js', 'lib/chai/chai.js',
@ -34,18 +47,22 @@ module.exports = function(config) {
//Mocha stuff //Mocha stuff
'test/mocha.conf.js', 'test/mocha.conf.js',
//Configs
'config.js',
//test files //test files
'test/unit/**/*.js' 'test/unit/**/*.js',
//App-specific Code
'js/app.js',
'js/routes.js',
'js/directives.js',
'js/filters.js',
'js/services/*.js',
'js/controllers/*.js',
'js/init.js'
], ],
// list of files to exclude // list of files to exclude
exclude: [ exclude: [],
'js/models/**/*.js',
],
// preprocess matching files before serving them to the browser // preprocess matching files before serving them to the browser

View file

@ -33,4 +33,9 @@ describe("Unit: Testing Controllers", function() {
expect(copayApp.TransactionsController).not.to.equal(null); expect(copayApp.TransactionsController).not.to.equal(null);
}); });
beforeEach(angular.mock.module('copay.walletFactory'));
it('should display a link to create a new wallet if no wallets in localStorage', inject(function(walletFactory) {
expect(walletFactory.storage.getWalletIds()).to.be.empty;
}));
}); });

View file

@ -17,10 +17,11 @@ describe("Unit: Testing Services", function() {
})); }));
beforeEach(angular.mock.module('copay.controllerUtils')); // TODO
/*beforeEach(angular.mock.module('copay.controllerUtils'));
it('should contain a controllerUtils service', inject(function(controllerUtils) { it('should contain a controllerUtils service', inject(function(controllerUtils) {
expect(controllerUtils).not.to.equal(null); expect(controllerUtils).not.to.equal(null);
})); }));
*/
}); });