mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
Fix outdated transitions
Fixes #151 - Cancelling or completing a tx now goes back to account detail view. - Restoring a vault now does not select an unloaded account, shows account list. - Account list now never selects an item only uses the cells as buttons.
This commit is contained in:
parent
8421c97db2
commit
988165224b
@ -12,6 +12,7 @@
|
|||||||
- Transaction list now only shows transactions for the current account.
|
- Transaction list now only shows transactions for the current account.
|
||||||
- Transaction list now only shows transactions for the current network (mainnet, testnet, testrpc).
|
- Transaction list now only shows transactions for the current network (mainnet, testnet, testrpc).
|
||||||
- Fixed transaction links to etherscan blockchain explorer.
|
- Fixed transaction links to etherscan blockchain explorer.
|
||||||
|
- Fixed some UI transitions that had weird behavior.
|
||||||
|
|
||||||
# 1.6.0 2016-04-22
|
# 1.6.0 2016-04-22
|
||||||
|
|
||||||
|
@ -2,11 +2,21 @@ var jsdom = require('mocha-jsdom')
|
|||||||
var assert = require('assert')
|
var assert = require('assert')
|
||||||
var freeze = require('deep-freeze-strict')
|
var freeze = require('deep-freeze-strict')
|
||||||
var path = require('path')
|
var path = require('path')
|
||||||
|
var sinon = require('sinon')
|
||||||
|
|
||||||
var actions = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'actions.js'))
|
var actions = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'actions.js'))
|
||||||
var reducers = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'reducers.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
|
var initialState, result
|
||||||
|
|
||||||
describe('when there is only one tx', function() {
|
describe('when there is only one tx', function() {
|
||||||
@ -42,14 +52,13 @@ describe('tx confirmation screen', function() {
|
|||||||
clearSeedWordCache(cb) { cb() },
|
clearSeedWordCache(cb) { cb() },
|
||||||
})
|
})
|
||||||
|
|
||||||
actions.cancelTx({id: firstTxId})(function(action) {
|
let action = actions.cancelTx({id: firstTxId})
|
||||||
result = reducers(initialState, action)
|
result = reducers(initialState, action)
|
||||||
done()
|
done()
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should transition to the accounts list', function() {
|
it('should transition to the account detail view', function() {
|
||||||
assert.equal(result.appState.currentView.name, 'accounts')
|
assert.equal(result.appState.currentView.name, 'accountDetail')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should have no unconfirmed txs remaining', function() {
|
it('should have no unconfirmed txs remaining', function() {
|
||||||
@ -67,7 +76,7 @@ describe('tx confirmation screen', function() {
|
|||||||
alert = () => {/* noop */}
|
alert = () => {/* noop */}
|
||||||
|
|
||||||
actions._setAccountManager({
|
actions._setAccountManager({
|
||||||
approveTransaction(txId, cb) { cb('An error!') },
|
approveTransaction(txId, cb) { cb({message: 'An error!'}) },
|
||||||
})
|
})
|
||||||
|
|
||||||
actions.sendTx({id: firstTxId})(function(action) {
|
actions.sendTx({id: firstTxId})(function(action) {
|
||||||
@ -86,23 +95,15 @@ describe('tx confirmation screen', function() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('when there is success', function() {
|
describe('when there is success', function() {
|
||||||
before(function(done) {
|
it('should complete tx and go home', function() {
|
||||||
actions._setAccountManager({
|
actions._setAccountManager({
|
||||||
approveTransaction(txId, cb) { cb() },
|
approveTransaction(txId, cb) { cb() },
|
||||||
})
|
})
|
||||||
|
|
||||||
actions.sendTx({id: firstTxId})(function(action) {
|
var dispatchExpect = sinon.mock()
|
||||||
result = reducers(initialState, action)
|
dispatchExpect.twice()
|
||||||
done()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should navigate away from the tx page', function() {
|
actions.sendTx({id: firstTxId})(dispatchExpect)
|
||||||
assert.equal(result.appState.currentView.name, 'accounts')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should clear the tx from the unconfirmed transactions', function() {
|
|
||||||
assert(!(firstTxId in result.metamask.unconfTxs), 'tx is cleared')
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -134,15 +135,14 @@ describe('tx confirmation screen', function() {
|
|||||||
}
|
}
|
||||||
freeze(initialState)
|
freeze(initialState)
|
||||||
|
|
||||||
|
|
||||||
actions._setAccountManager({
|
actions._setAccountManager({
|
||||||
approveTransaction(txId, cb) { cb() },
|
approveTransaction(txId, cb) { cb() },
|
||||||
})
|
})
|
||||||
|
|
||||||
actions.sendTx({id: firstTxId})(function(action) {
|
let action = actions.sendTx({id: firstTxId})(function(action) {
|
||||||
result = reducers(initialState, action)
|
result = reducers(initialState, action)
|
||||||
done()
|
|
||||||
})
|
})
|
||||||
|
done()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should stay on the confTx view', function() {
|
it('should stay on the confTx view', function() {
|
||||||
|
@ -91,7 +91,7 @@ AccountsScreen.prototype.render = function() {
|
|||||||
var componentState = extend(actions, {
|
var componentState = extend(actions, {
|
||||||
identity: identity,
|
identity: identity,
|
||||||
account: account,
|
account: account,
|
||||||
isSelected: isSelected,
|
isSelected: false,
|
||||||
isFauceting: isFauceting,
|
isFauceting: isFauceting,
|
||||||
})
|
})
|
||||||
return h(AccountPanel, componentState)
|
return h(AccountPanel, componentState)
|
||||||
|
@ -131,15 +131,11 @@ function recoverFromSeed(password, seed) {
|
|||||||
// dispatch(this.createNewVaultInProgress())
|
// dispatch(this.createNewVaultInProgress())
|
||||||
dispatch(this.showLoadingIndication())
|
dispatch(this.showLoadingIndication())
|
||||||
_accountManager.recoverFromSeed(password, seed, (err, selectedAccount) => {
|
_accountManager.recoverFromSeed(password, seed, (err, selectedAccount) => {
|
||||||
if (err) {
|
dispatch(this.hideLoadingIndication())
|
||||||
dispatch(this.hideLoadingIndication())
|
if (err) return dispatch(this.displayWarning(err.message))
|
||||||
var message = err.message
|
|
||||||
return dispatch(this.displayWarning(err.message))
|
|
||||||
}
|
|
||||||
|
|
||||||
dispatch(this.unlockMetamask())
|
dispatch(this.unlockMetamask())
|
||||||
dispatch(this.showAccountDetail(selectedAccount))
|
dispatch(this.showAccountsPage())
|
||||||
dispatch(this.hideLoadingIndication())
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -165,7 +161,7 @@ function signTx(txData) {
|
|||||||
|
|
||||||
if (err) return dispatch(this.displayWarning(err.message))
|
if (err) return dispatch(this.displayWarning(err.message))
|
||||||
dispatch(this.hideWarning())
|
dispatch(this.hideWarning())
|
||||||
dispatch(this.showAccountsPage())
|
dispatch(this.goHome())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -198,10 +194,8 @@ function txError(err) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function cancelTx(txData){
|
function cancelTx(txData){
|
||||||
return (dispatch) => {
|
_accountManager.cancelTransaction(txData.id)
|
||||||
_accountManager.cancelTransaction(txData.id)
|
return this.goHome()
|
||||||
dispatch(this.showAccountsPage())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -198,13 +198,12 @@ function reduceApp(state, action) {
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
return extend(appState, {
|
return extend(appState, {
|
||||||
transForward: false,
|
|
||||||
currentView: {
|
|
||||||
name: 'accounts',
|
|
||||||
context: 0,
|
|
||||||
},
|
|
||||||
transForward: false,
|
transForward: false,
|
||||||
warning: null,
|
warning: null,
|
||||||
|
currentView: {
|
||||||
|
name: 'accountDetail',
|
||||||
|
context: appState.currentView.context,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user