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 109 additions and 86 deletions

View File

@ -169,7 +169,7 @@ h3 {
border-right: 2px dashed #E3E3E3;
}
@media (max-width: 1025px) {
@media (max-width: 640px) {
.line-dashed-v {
border: none;
}
@ -347,11 +347,7 @@ hr { margin: 2.25rem 0;}
}
.box-setup {
padding: 20px 30px;
border: 1px solid #eee;
background: #fff;
overflow: hidden;
margin-bottom: 10px;
margin-bottom: 25px;
}
.box-setup-copayers {
@ -483,19 +479,6 @@ a.loading {
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 */
.dr-notification-container {
@ -668,4 +651,4 @@ ul.pagination li.current a:hover, ul.pagination li.current a:focus {
width: 71px;
}
}
}

View File

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

View File

@ -203,13 +203,10 @@
</div>
<div ng-show="!wallets.length">
<h3>Create a new wallet</h3>
<form name="createForm" ng-submit="create(createForm)" novalidate>
<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.
</p>
<button type="submit" class="button secondary radius"
ng-disabled="createForm.$invalid || loading" loading="Creating">Create</button>
</form>
<a href="#setup" class="button secondary radius">Create</a>
</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>
<textarea class="form-control" name="backupText" ng-model="backupText" rows="5" ng-show="pastetext"></textarea>
</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>
<input type="password" class="form-control" placeholder="Your wallet password" name="password" ng-model="password" required>
</div>
</div>
</div>
<div class="row">
<div class="large-12 columns line-dashed">
<div class="row 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">
Import backup
</button>
<a class="button secondary radius" href="#signin">Go back</a>
</div>
</div>
</form>
@ -285,46 +284,64 @@
</div>
<div ng-show="!loading">
<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>
<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>
<h3>Create new wallet</h3>
<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-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}">
</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 class="large-12 columns line-dashed">
<button type="submit" class="button primary radius right" ng-disabled="setupForm.$invalid || loading">
Create {{requiredCopayers}}-of-{{totalCopayers}} wallet
</button>
<a class="button secondary radius" href="#signin">Go back</a>
<div class="row 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-7 columns text-right">
<button type="submit" class="button primary radius" ng-disabled="setupForm.$invalid || loading">
Create {{requiredCopayers}}-of-{{totalCopayers}} wallet
</button>
</div>
</div>
</form>
</div>

View File

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

View File

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

View File

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

View File

@ -15,37 +15,54 @@ module.exports = function(config) {
// list of files / patterns to load in the browser
files: [
//3rd Party Code
'lib/angular/angular.min.js',
'lib/angular-route/angular-route.js',
'lib/angular-mocks/angular-mocks.js',
'lib/bitcore.js',
'lib/socket.io.js',
//Configs
'config.js',
//App-specific Code
'js/*.js',
'js/**/*.js',
'lib/angular/angular.min.js',
'lib/angular-mocks/angular-mocks.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
'lib/chai/chai.js',
'test/lib/chai-should.js',
'test/lib/chai-expect.js',
//Mocha stuff
'test/mocha.conf.js',
//Configs
'config.js',
//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
exclude: [
'js/models/**/*.js',
],
exclude: [],
// 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);
});
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) {
expect(controllerUtils).not.to.equal(null);
}));
*/
});