mirror of https://github.com/BTCPrivate/copay.git
Merge pull request #540 from matiu/feature/UXtesting
Feature/u xtesting
This commit is contained in:
commit
5e3b1e94e2
45
js/app.js
45
js/app.js
|
@ -16,46 +16,23 @@ var log = function() {
|
||||||
if (config.verbose) console.log(arguments);
|
if (config.verbose) console.log(arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// From the bundle
|
||||||
var copay = require('copay');
|
var copay = require('copay');
|
||||||
|
|
||||||
var copayApp = window.copayApp = angular.module('copay',[
|
var copayApp = window.copayApp = angular.module('copayApp',[
|
||||||
'ngRoute',
|
'ngRoute',
|
||||||
'angularMoment',
|
'angularMoment',
|
||||||
'mm.foundation',
|
'mm.foundation',
|
||||||
'monospaced.qrcode',
|
'monospaced.qrcode',
|
||||||
'notifications',
|
'notifications',
|
||||||
'copay.filters',
|
'copayApp.filters',
|
||||||
'copay.header',
|
'copayApp.controllers',
|
||||||
'copay.footer',
|
'copayApp.directives',
|
||||||
'copay.addresses',
|
'copayApp.services',
|
||||||
'copay.transactions',
|
|
||||||
'copay.send',
|
|
||||||
'copay.backup',
|
|
||||||
'copay.walletFactory',
|
|
||||||
'copay.signin',
|
|
||||||
'copay.socket',
|
|
||||||
'copay.controllerUtils',
|
|
||||||
'copay.setup',
|
|
||||||
'copay.directives',
|
|
||||||
'copay.video',
|
|
||||||
'copay.import',
|
|
||||||
'copay.passphrase',
|
|
||||||
'copay.settings'
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
angular.module('copay.header', []);
|
angular.module('copayApp.filters', []);
|
||||||
angular.module('copay.footer', []);
|
angular.module('copayApp.controllers', []);
|
||||||
angular.module('copay.addresses', []);
|
angular.module('copayApp.directives', []);
|
||||||
angular.module('copay.transactions', []);
|
angular.module('copayApp.services', []);
|
||||||
angular.module('copay.send', []);
|
|
||||||
angular.module('copay.backup', []);
|
|
||||||
angular.module('copay.walletFactory', []);
|
|
||||||
angular.module('copay.controllerUtils', []);
|
|
||||||
angular.module('copay.signin', []);
|
|
||||||
angular.module('copay.setup', []);
|
|
||||||
angular.module('copay.socket', []);
|
|
||||||
angular.module('copay.directives', []);
|
|
||||||
angular.module('copay.video', []);
|
|
||||||
angular.module('copay.import', []);
|
|
||||||
angular.module('copay.passphrase', []);
|
|
||||||
angular.module('copay.settings', []);
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copay.addresses').controller('AddressesController',
|
angular.module('copayApp.controllers').controller('AddressesController',
|
||||||
function($scope, $rootScope, $timeout, controllerUtils) {
|
function($scope, $rootScope, $timeout, controllerUtils) {
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
var w = $rootScope.wallet;
|
var w = $rootScope.wallet;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copay.backup').controller('BackupController',
|
angular.module('copayApp.controllers').controller('BackupController',
|
||||||
function($scope, $rootScope, $location, $window, $timeout, $modal) {
|
function($scope, $rootScope, $location, $window, $timeout, $modal) {
|
||||||
$scope.title = 'Backup';
|
$scope.title = 'Backup';
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copay.footer').controller('FooterController', function($rootScope, $sce, $scope, $http) {
|
angular.module('copayApp.controllers').controller('FooterController', function($rootScope, $sce, $scope, $http) {
|
||||||
|
|
||||||
if (config.themes && Array.isArray(config.themes) && config.themes[0]) {
|
if (config.themes && Array.isArray(config.themes) && config.themes[0]) {
|
||||||
$scope.themes = config.themes;
|
$scope.themes = config.themes;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copay.header').controller('HeaderController',
|
angular.module('copayApp.controllers').controller('HeaderController',
|
||||||
function($scope, $rootScope, $location, $notification, $http, walletFactory, controllerUtils) {
|
function($scope, $rootScope, $location, $notification, $http, walletFactory, controllerUtils) {
|
||||||
$scope.menu = [
|
$scope.menu = [
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copay.import').controller('ImportController',
|
angular.module('copayApp.controllers').controller('ImportController',
|
||||||
function($scope, $rootScope, walletFactory, controllerUtils, Passphrase) {
|
function($scope, $rootScope, walletFactory, controllerUtils, Passphrase) {
|
||||||
$scope.title = 'Import a backup';
|
$scope.title = 'Import a backup';
|
||||||
var reader = new FileReader();
|
var reader = new FileReader();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copay.send').controller('SendController',
|
angular.module('copayApp.controllers').controller('SendController',
|
||||||
function($scope, $rootScope, $window, $location, $timeout) {
|
function($scope, $rootScope, $window, $location, $timeout) {
|
||||||
$scope.title = 'Send';
|
$scope.title = 'Send';
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copay.settings').controller('SettingsController',
|
angular.module('copayApp.controllers').controller('SettingsController',
|
||||||
function($scope, $rootScope, $window, $location) {
|
function($scope, $rootScope, $window, $location) {
|
||||||
$scope.title = 'Settings';
|
$scope.title = 'Settings';
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ var valid_pairs = {
|
||||||
'1,12': 489
|
'1,12': 489
|
||||||
};
|
};
|
||||||
|
|
||||||
angular.module('copay.setup').controller('SetupController',
|
angular.module('copayApp.controllers').controller('SetupController',
|
||||||
function($scope, $rootScope, $location, $timeout, walletFactory, controllerUtils, Passphrase) {
|
function($scope, $rootScope, $location, $timeout, walletFactory, controllerUtils, Passphrase) {
|
||||||
|
|
||||||
$rootScope.videoInfo = {};
|
$rootScope.videoInfo = {};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copay.signin').controller('SigninController',
|
angular.module('copayApp.controllers').controller('SigninController',
|
||||||
function($scope, $rootScope, $location, walletFactory, controllerUtils, Passphrase) {
|
function($scope, $rootScope, $location, walletFactory, controllerUtils, Passphrase) {
|
||||||
var cmp = function(o1, o2){
|
var cmp = function(o1, o2){
|
||||||
var v1 = o1.show.toLowerCase(), v2 = o2.show.toLowerCase();
|
var v1 = o1.show.toLowerCase(), v2 = o2.show.toLowerCase();
|
||||||
|
@ -24,10 +24,16 @@ angular.module('copay.signin').controller('SigninController',
|
||||||
console.log('## Obtaining passphrase...');
|
console.log('## Obtaining passphrase...');
|
||||||
Passphrase.getBase64Async(password, function(passphrase){
|
Passphrase.getBase64Async(password, function(passphrase){
|
||||||
console.log('## Passphrase obtained');
|
console.log('## Passphrase obtained');
|
||||||
var w = walletFactory.open($scope.selectedWalletId, { passphrase: passphrase});
|
var w, errMsg;
|
||||||
|
try{
|
||||||
|
var w = walletFactory.open($scope.selectedWalletId, { passphrase: passphrase});
|
||||||
|
} catch (e){
|
||||||
|
errMsg = e.message;
|
||||||
|
};
|
||||||
|
|
||||||
if (!w) {
|
if (!w) {
|
||||||
$scope.loading = $scope.failure = false;
|
$scope.loading = $scope.failure = false;
|
||||||
$rootScope.$flashMessage = { message: 'Wrong password', type: 'error'};
|
$rootScope.$flashMessage = { message: errMsg || 'Wrong password', type: 'error'};
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copay.transactions').controller('TransactionsController',
|
angular.module('copayApp.controllers').controller('TransactionsController',
|
||||||
function($scope, $rootScope, $timeout, controllerUtils) {
|
function($scope, $rootScope, $timeout, controllerUtils) {
|
||||||
|
|
||||||
$scope.title = 'Transactions';
|
$scope.title = 'Transactions';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copay.directives')
|
angular.module('copayApp.directives')
|
||||||
.directive('validAddress', [
|
.directive('validAddress', [
|
||||||
|
|
||||||
function() {
|
function() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copay.filters', [])
|
angular.module('copayApp.filters', [])
|
||||||
.filter('amTimeAgo', ['amMoment', function(amMoment) {
|
.filter('amTimeAgo', ['amMoment', function(amMoment) {
|
||||||
return function(input) {
|
return function(input) {
|
||||||
return amMoment.preprocessDate(input).fromNow();
|
return amMoment.preprocessDate(input).fromNow();
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
angular.element(document).ready(function() {
|
angular.element(document).ready(function() {
|
||||||
// Init the app
|
// Init the app
|
||||||
angular.bootstrap(document, ['copay']);
|
angular.bootstrap(document, ['copayApp']);
|
||||||
});
|
});
|
||||||
|
|
|
@ -65,7 +65,6 @@ Wallet.prototype.seedCopayer = function(pubKey) {
|
||||||
Wallet.prototype.connectToAll = function() {
|
Wallet.prototype.connectToAll = function() {
|
||||||
|
|
||||||
var all = this.publicKeyRing.getAllCopayerIds();
|
var all = this.publicKeyRing.getAllCopayerIds();
|
||||||
console.log('[Wallet.js.58] connecting'); //TODO
|
|
||||||
this.network.connectToCopayers(all);
|
this.network.connectToCopayers(all);
|
||||||
if (this.seededCopayerId) {
|
if (this.seededCopayerId) {
|
||||||
this.sendWalletReady(this.seededCopayerId);
|
this.sendWalletReady(this.seededCopayerId);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
//Setting up route
|
//Setting up route
|
||||||
angular
|
angular
|
||||||
.module('copay')
|
.module('copayApp')
|
||||||
.config(function($routeProvider) {
|
.config(function($routeProvider) {
|
||||||
|
|
||||||
$routeProvider
|
$routeProvider
|
||||||
|
@ -56,7 +56,7 @@ angular
|
||||||
|
|
||||||
//Setting HTML5 Location Mode
|
//Setting HTML5 Location Mode
|
||||||
angular
|
angular
|
||||||
.module('copay')
|
.module('copayApp')
|
||||||
.config(function($locationProvider) {
|
.config(function($locationProvider) {
|
||||||
$locationProvider
|
$locationProvider
|
||||||
.html5Mode(false);
|
.html5Mode(false);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copay.controllerUtils')
|
angular.module('copayApp.services')
|
||||||
.factory('controllerUtils', function($rootScope, $sce, $location, $notification, Socket, video) {
|
.factory('controllerUtils', function($rootScope, $sce, $location, $notification, Socket, video) {
|
||||||
var root = {};
|
var root = {};
|
||||||
var bitcore = require('bitcore');
|
var bitcore = require('bitcore');
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copay.passphrase').value('Passphrase', new copay.Passphrase(config.passphrase));
|
angular.module('copayApp.services')
|
||||||
|
.value('Passphrase', new copay.Passphrase(config.passphrase));
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copay.socket').factory('Socket',
|
angular.module('copayApp.services').factory('Socket',
|
||||||
function($rootScope) {
|
function($rootScope) {
|
||||||
var listeners = [];
|
var listeners = [];
|
||||||
var url = 'http://' + config.socket.host + ':' + config.socket.port;
|
var url = 'http://' + config.socket.host + ':' + config.socket.port;
|
||||||
|
|
|
@ -93,4 +93,4 @@ Video.prototype.close = function() {
|
||||||
this.mediaConnections = {};
|
this.mediaConnections = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
angular.module('copay.video').value('video', new Video());
|
angular.module('copayApp.services').value('video', new Video());
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copay.walletFactory').value('walletFactory', new copay.WalletFactory(config, copay.version));
|
angular.module('copayApp.services').value('walletFactory', new copay.WalletFactory(config, copay.version));
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,6 @@ module.exports = function(config) {
|
||||||
//Mocha stuff
|
//Mocha stuff
|
||||||
'test/mocha.conf.js',
|
'test/mocha.conf.js',
|
||||||
|
|
||||||
//test files
|
|
||||||
'test/unit/**/*.js',
|
|
||||||
|
|
||||||
//App-specific Code
|
//App-specific Code
|
||||||
'js/app.js',
|
'js/app.js',
|
||||||
|
@ -57,7 +55,11 @@ module.exports = function(config) {
|
||||||
'js/filters.js',
|
'js/filters.js',
|
||||||
'js/services/*.js',
|
'js/services/*.js',
|
||||||
'js/controllers/*.js',
|
'js/controllers/*.js',
|
||||||
'js/init.js'
|
'js/init.js',
|
||||||
|
|
||||||
|
|
||||||
|
//test files
|
||||||
|
'test/unit/**/*.js'
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,39 +3,59 @@
|
||||||
//
|
//
|
||||||
describe("Unit: Testing Controllers", function() {
|
describe("Unit: Testing Controllers", function() {
|
||||||
|
|
||||||
beforeEach(angular.mock.module('copay'));
|
beforeEach(module('notifications'));
|
||||||
|
beforeEach(module('copayApp.services'));
|
||||||
|
beforeEach(module('copayApp.controllers'));
|
||||||
|
|
||||||
it('should have a AddressesController controller', function() {
|
var scope, addressCtrl;
|
||||||
expect(copayApp.AddressesController).not.to.equal(null);
|
//
|
||||||
});
|
beforeEach(inject(function($controller, $rootScope) {
|
||||||
|
scope = $rootScope.$new();
|
||||||
|
addressCtrl = $controller('AddressesController', {
|
||||||
|
$scope: scope,
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
|
||||||
it('should have a BackupController controller', function() {
|
|
||||||
expect(copayApp.Backupcontroller).not.to.equal(null);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have a HeaderController controller', function() {
|
|
||||||
expect(copayApp.HeaderController).not.to.equal(null);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have a SendController controller', function() {
|
it('should have a AddressesController controller', function() {
|
||||||
expect(copayApp.SendController).not.to.equal(null);
|
expect(scope.loading).equal(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should have a SetupController controller', function() {
|
it('selectedAddr should modify scope', function() {
|
||||||
expect(copayApp.SetupController).not.to.equal(null);
|
expect(scope.selectedAddress).equal(undefined);
|
||||||
});
|
scope.selectAddress('hola');
|
||||||
|
expect(scope.selectedAddr).equal('hola');
|
||||||
it('should have a SigninController controller', function() {
|
});
|
||||||
expect(copayApp.SigninController).not.to.equal(null);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have a TransactionsController controller', 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;
|
|
||||||
}));
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// it('should have a BackupController controller', function() {
|
||||||
|
// expect(copayApp.Backupcontroller).not.to.equal(null);
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// it('should have a HeaderController controller', function() {
|
||||||
|
// expect(copayApp.HeaderController).not.to.equal(null);
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// it('should have a SendController controller', function() {
|
||||||
|
// expect(copayApp.SendController).not.to.equal(null);
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// it('should have a SetupController controller', function() {
|
||||||
|
// expect(copayApp.SetupController).not.to.equal(null);
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// it('should have a SigninController controller', function() {
|
||||||
|
// expect(copayApp.SigninController).not.to.equal(null);
|
||||||
|
// console.log('[controllersSpec.js.30:copayApp:]',copayApp); //TODO
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// it('should have a TransactionsController controller', 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;
|
||||||
|
// }));
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,7 +6,7 @@ describe("Unit: Testing Directives", function() {
|
||||||
|
|
||||||
var $scope, form;
|
var $scope, form;
|
||||||
|
|
||||||
beforeEach(module('copay.directives'));
|
beforeEach(module('copayApp.directives'));
|
||||||
|
|
||||||
describe('Validate Address', function() {
|
describe('Validate Address', function() {
|
||||||
beforeEach(inject(function($compile, $rootScope) {
|
beforeEach(inject(function($compile, $rootScope) {
|
||||||
|
|
|
@ -3,22 +3,19 @@
|
||||||
//
|
//
|
||||||
describe("Unit: Testing Services", function() {
|
describe("Unit: Testing Services", function() {
|
||||||
|
|
||||||
beforeEach(angular.mock.module('copay.socket'));
|
beforeEach(angular.mock.module('copayApp.services'));
|
||||||
|
|
||||||
it('should contain a Socket service', inject(function(Socket) {
|
it('should contain a Socket service', inject(function(Socket) {
|
||||||
expect(Socket).not.to.equal(null);
|
expect(Socket).not.to.equal(null);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
beforeEach(angular.mock.module('copay.walletFactory'));
|
|
||||||
|
|
||||||
it('should contain a walletFactory service', inject(function(walletFactory) {
|
it('should contain a walletFactory service', inject(function(walletFactory) {
|
||||||
expect(walletFactory).not.to.equal(null);
|
expect(walletFactory).not.to.equal(null);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
/*beforeEach(angular.mock.module('copay.controllerUtils'));
|
/*beforeEach(angular.mock.module('copayApp.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);
|
||||||
|
|
Loading…
Reference in New Issue