aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Finlay <somniac@me.com>2016-04-30 08:13:53 +0800
committerDan Finlay <somniac@me.com>2016-04-30 08:13:53 +0800
commit6a6811f1d1b6b2c0fcdefc39840f4fb878a5f6e8 (patch)
tree2ee46ca24e9aa6ee399a45192ed0a46c59dd6a13
parent3a3444aad1493db512cfba7f8ba230b7eb12f14a (diff)
parent988165224b41c1eb3fe1b639b5801204936000e1 (diff)
downloadtangerine-wallet-browser-6a6811f1d1b6b2c0fcdefc39840f4fb878a5f6e8.tar
tangerine-wallet-browser-6a6811f1d1b6b2c0fcdefc39840f4fb878a5f6e8.tar.gz
tangerine-wallet-browser-6a6811f1d1b6b2c0fcdefc39840f4fb878a5f6e8.tar.bz2
tangerine-wallet-browser-6a6811f1d1b6b2c0fcdefc39840f4fb878a5f6e8.tar.lz
tangerine-wallet-browser-6a6811f1d1b6b2c0fcdefc39840f4fb878a5f6e8.tar.xz
tangerine-wallet-browser-6a6811f1d1b6b2c0fcdefc39840f4fb878a5f6e8.tar.zst
tangerine-wallet-browser-6a6811f1d1b6b2c0fcdefc39840f4fb878a5f6e8.zip
Merge pull request #165 from MetaMask/FixTransitions
Fix transitions
-rw-r--r--CHANGELOG.md4
-rw-r--r--test/unit/actions/tx_test.js46
-rw-r--r--ui/app/accounts.js2
-rw-r--r--ui/app/actions.js18
-rw-r--r--ui/app/reducers/app.js7
5 files changed, 37 insertions, 40 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a2e9e1afa..6a9624d6c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,10 @@
- Account icons are now "identicons" (deterministically generated from the address).
- Fixed link to Slack channel.
- Added a context guard for "define" to avoid UMD's exporting themselves to the wrong module system
+- Transaction list now only shows transactions for the current account.
+- Transaction list now only shows transactions for the current network (mainnet, testnet, testrpc).
+- Fixed transaction links to etherscan blockchain explorer.
+- Fixed some UI transitions that had weird behavior.
# 1.6.0 2016-04-22
diff --git a/test/unit/actions/tx_test.js b/test/unit/actions/tx_test.js
index b15bee393..1eb759511 100644
--- a/test/unit/actions/tx_test.js
+++ b/test/unit/actions/tx_test.js
@@ -2,11 +2,21 @@ var jsdom = require('mocha-jsdom')
var assert = require('assert')
var freeze = require('deep-freeze-strict')
var path = require('path')
+var sinon = require('sinon')
var actions = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'actions.js'))
var reducers = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'reducers.js'))
-describe('tx confirmation screen', function() {
+describe.only('tx confirmation screen', function() {
+
+ beforeEach(function() {
+ this.sinon = sinon.sandbox.create();
+ });
+
+ afterEach(function(){
+ this.sinon.restore();
+ });
+
var initialState, result
describe('when there is only one tx', function() {
@@ -42,14 +52,13 @@ describe('tx confirmation screen', function() {
clearSeedWordCache(cb) { cb() },
})
- actions.cancelTx({id: firstTxId})(function(action) {
- result = reducers(initialState, action)
- done()
- })
+ let action = actions.cancelTx({id: firstTxId})
+ result = reducers(initialState, action)
+ done()
})
- it('should transition to the accounts list', function() {
- assert.equal(result.appState.currentView.name, 'accounts')
+ it('should transition to the account detail view', function() {
+ assert.equal(result.appState.currentView.name, 'accountDetail')
})
it('should have no unconfirmed txs remaining', function() {
@@ -67,7 +76,7 @@ describe('tx confirmation screen', function() {
alert = () => {/* noop */}
actions._setAccountManager({
- approveTransaction(txId, cb) { cb('An error!') },
+ approveTransaction(txId, cb) { cb({message: 'An error!'}) },
})
actions.sendTx({id: firstTxId})(function(action) {
@@ -86,23 +95,15 @@ describe('tx confirmation screen', function() {
})
describe('when there is success', function() {
- before(function(done) {
+ it('should complete tx and go home', function() {
actions._setAccountManager({
approveTransaction(txId, cb) { cb() },
})
- actions.sendTx({id: firstTxId})(function(action) {
- result = reducers(initialState, action)
- done()
- })
- })
-
- it('should navigate away from the tx page', function() {
- assert.equal(result.appState.currentView.name, 'accounts')
- })
+ var dispatchExpect = sinon.mock()
+ dispatchExpect.twice()
- it('should clear the tx from the unconfirmed transactions', function() {
- assert(!(firstTxId in result.metamask.unconfTxs), 'tx is cleared')
+ actions.sendTx({id: firstTxId})(dispatchExpect)
})
})
})
@@ -134,15 +135,14 @@ describe('tx confirmation screen', function() {
}
freeze(initialState)
-
actions._setAccountManager({
approveTransaction(txId, cb) { cb() },
})
- actions.sendTx({id: firstTxId})(function(action) {
+ let action = actions.sendTx({id: firstTxId})(function(action) {
result = reducers(initialState, action)
- done()
})
+ done()
})
it('should stay on the confTx view', function() {
diff --git a/ui/app/accounts.js b/ui/app/accounts.js
index d35e80678..0cc72878c 100644
--- a/ui/app/accounts.js
+++ b/ui/app/accounts.js
@@ -91,7 +91,7 @@ AccountsScreen.prototype.render = function() {
var componentState = extend(actions, {
identity: identity,
account: account,
- isSelected: isSelected,
+ isSelected: false,
isFauceting: isFauceting,
})
return h(AccountPanel, componentState)
diff --git a/ui/app/actions.js b/ui/app/actions.js
index a2106ea85..12e20e0cf 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -131,15 +131,11 @@ function recoverFromSeed(password, seed) {
// dispatch(this.createNewVaultInProgress())
dispatch(this.showLoadingIndication())
_accountManager.recoverFromSeed(password, seed, (err, selectedAccount) => {
- if (err) {
- dispatch(this.hideLoadingIndication())
- var message = err.message
- return dispatch(this.displayWarning(err.message))
- }
+ dispatch(this.hideLoadingIndication())
+ if (err) return dispatch(this.displayWarning(err.message))
dispatch(this.unlockMetamask())
- dispatch(this.showAccountDetail(selectedAccount))
- dispatch(this.hideLoadingIndication())
+ dispatch(this.showAccountsPage())
})
}
}
@@ -165,7 +161,7 @@ function signTx(txData) {
if (err) return dispatch(this.displayWarning(err.message))
dispatch(this.hideWarning())
- dispatch(this.showAccountsPage())
+ dispatch(this.goHome())
})
}
}
@@ -198,10 +194,8 @@ function txError(err) {
}
function cancelTx(txData){
- return (dispatch) => {
- _accountManager.cancelTransaction(txData.id)
- dispatch(this.showAccountsPage())
- }
+ _accountManager.cancelTransaction(txData.id)
+ return this.goHome()
}
//
diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js
index 143a67527..57cdccbac 100644
--- a/ui/app/reducers/app.js
+++ b/ui/app/reducers/app.js
@@ -199,12 +199,11 @@ function reduceApp(state, action) {
} else {
return extend(appState, {
transForward: false,
+ warning: null,
currentView: {
- name: 'accounts',
- context: 0,
+ name: 'accountDetail',
+ context: appState.currentView.context,
},
- transForward: false,
- warning: null,
})
}