Merge pull request #312 from MetaMask/svg-notif
initial svg notificationsfeature/default_network_editable
commit
ac2269b16e
@ -1,31 +0,0 @@ |
||||
const assert = require('assert') |
||||
const sinon = require('sinon') |
||||
|
||||
const path = require('path') |
||||
const IconFactoryGen = require(path.join(__dirname, '..', '..', '..', 'ui', 'lib', 'icon-factory.js')) |
||||
|
||||
describe('icon-factory', function() { |
||||
let iconFactory, address, diameter |
||||
|
||||
beforeEach(function() { |
||||
iconFactory = IconFactoryGen((d,n) => 'stubicon') |
||||
address = '0x012345671234567890' |
||||
diameter = 50 |
||||
}) |
||||
|
||||
it('should return a data-uri string for any address and diameter', function() { |
||||
const output = iconFactory.iconForAddress(address, diameter) |
||||
assert.ok(output.indexOf('data:image/svg') === 0) |
||||
assert.equal(output, iconFactory.cache[address][diameter]) |
||||
}) |
||||
|
||||
it('should default to cache first', function() { |
||||
const testOutput = 'foo' |
||||
const mockSizeCache = {} |
||||
mockSizeCache[diameter] = testOutput |
||||
iconFactory.cache[address] = mockSizeCache |
||||
|
||||
const output = iconFactory.iconForAddress(address, diameter) |
||||
assert.equal(output, testOutput) |
||||
}) |
||||
}) |
@ -1,54 +0,0 @@ |
||||
const inherits = require('util').inherits |
||||
const Component = require('react').Component |
||||
const h = require('react-hyperscript') |
||||
const Identicon = require('./identicon') |
||||
|
||||
module.exports = Panel |
||||
|
||||
inherits(Panel, Component) |
||||
function Panel () { |
||||
Component.call(this) |
||||
} |
||||
|
||||
Panel.prototype.render = function () { |
||||
var state = this.props |
||||
|
||||
var style = { |
||||
flex: '1 0 auto', |
||||
} |
||||
|
||||
if (state.onClick) style.cursor = 'pointer' |
||||
|
||||
return ( |
||||
h('.identity-panel.flex-row.flex-space-between', { |
||||
style, |
||||
onClick: state.onClick, |
||||
}, [ |
||||
|
||||
// account identicon
|
||||
h('.identicon-wrapper.flex-column.select-none', [ |
||||
h(Identicon, { |
||||
address: state.identiconKey, |
||||
}), |
||||
h('span.font-small', state.identiconLabel), |
||||
]), |
||||
|
||||
// account address, balance
|
||||
h('.identity-data.flex-column.flex-justify-center.flex-grow.select-none', [ |
||||
|
||||
state.attributes.map((attr) => { |
||||
return h('.flex-row.flex-space-between', { |
||||
key: '' + Math.round(Math.random() * 1000000), |
||||
}, [ |
||||
h('label.font-small.no-select', attr.key), |
||||
h('span.font-small', attr.value), |
||||
]) |
||||
}), |
||||
]), |
||||
|
||||
// outlet for inserting additional stuff
|
||||
state.children, |
||||
]) |
||||
) |
||||
} |
||||
|
Loading…
Reference in new issue