Initial new UI source code import (#2607)
* address -> name mappings * expanding, loading all coin details * send use only actual BasicCoin tokens registered (any reg) * sending token & accounts * form styling updates * send form layout in place * coin send working as expected * api subscriptions on multiple addresses * bring in events * simplify * basic events display in-place, functionally complete * basic functionality in-place * fix horrible event address issue * rwork display of events slightly * test TLA availability * table for owner -> tokens * fix signature lookup address * fix signature lookup address * basic overview styling * txhash links * page layout adjustments * background import * adjust colors * no global registration, simplify color selection * updated styling * connection dialog for "busy connecting" * initial token connection - WIP * init token updates take place * basic test for manual token * rework connection display * allow updates of the secure token * first stab at making the build build * update runner tags * fix linting issues * skip tests requiring network (should be e2e, TODO) * re-enable javascript tag/runner * release push does the trick * push to any branch, CI name * javscript-test runner as well * swap dependencies build requires test * revert stages swap * retrieve images associated with tokens * remove js build deps order * null image when hash = 0x0 * 6x64 images (hashes for registries) * don't pass tokens as prop to IdentityIcon * check images against content hash pictures * cleanup signer after connection changes * fix naming typo * display unknownImages for balances (not available as content hash) * unknownImage for transfer dialog * basic githubhint layout * single input for commit/filename * ethcore_hashContent call * lookup hash * registration in place * fixes * events is using a proper table * pass value through as-is * stop wrongly using main app IdentityIcon * NEVER export class instance functions * alignment back to normal * typo in definition * set & get images working (mostly) * show content retrieval info * set exitcode via || * use javascript:latest images * disable npm progress bar * rename phase I * rename phase II * only send build output to GitHub on major branches * also run the build step as part of the test (until comprehensive) * ci-specific build (no webpack progress) * allow for account creation via recovery phrase * display account uuid (where available), closes #2546 * connection dialog now shows up in dapps as well, closes #2538 * token images show up as expected * IdentityName component added and deployed * fix padding tests * adjust tests to map to stricter 0x-prefixed hex * render names via common component for the address -> name * split lint into seperate script (early exit) * test phases changed to lint, test & pack * pack part of test phase * remove files marked for deletion (cleanup) * Signer cleanups, start moving in the direction of the rest * add personal signer methods * basic signer request subscription * don't poll blockNumber when not connected * missing return, creating massive ws queue backlogs * ΞTH -> ETH * fix failing tests * registry uses setAddress to actually set addresses now * bytes mapping operates on lowerCase hex strings * sha3 ids for each application * add dappreg to list of contracts * adjust alignment of queries * show gas estimation log * abi with payable for register function * add key as required * image retrieval from dappreg * use proper Image urls * embed and link apps from Parity, retrieved via /api/apps * filter apps that has been replaced * proxy entry for parity-utils * add basiccoin abi * add support for fallback abi type * capture constructor paramaters * merge master into js * move images to assets/images/ * add font assets * import fonts as part of build * don't inline woff files * Revert "merge master into js" This reverts commit cfcfa81bd26f1b3cbc748d3afa1eb5c670b363fe. * remove unused npm packages * information on gas estimates (like almost everywhere else) * don't pass gas & gasPrice to estimation * display account passwordhint when available * signer subscriptions based on polling & function trapping * pending requests retrieved via jsapi * update signer middleware * remove all web3 instances * remove web3 package * last web3 dependencies removed * no need to toChecksumAddress - api takes care of it * expand description for personal_confirmRequest * Signer conversion from web3 -> parity.js completed * explicit in no return * green circle background * remove generated background * convert /api/* paths to localhost:8080/api/* paths (hard-coded, temporary) * change dapps to load from localhost:8080/ui/* * remove dangling web3 files * update manager test for signer * /api/ping -> / * additional token images * additional token images * add missing styles.css for 8180 error pages * cater for txhash returning null/empty object * adjust output directories * Release merge with origin with ours strategy * additional token images * cater for development server * s/localhost/127.0.0.1/ (cater for origin) * Fix address selection for contract deployment * Adjust z-index for error overlay * better text on unique background pattern * fix signer rejections * Don't allow gavcoin transfer with no balance * fix txhash rendering in signer * remove unnecessary ParityBackground * script to update js-precompiled * Redirect from :8080 to :8180 * Remove extra return * Dapp logo images
This commit is contained in:
17
js/test/babel.js
Normal file
17
js/test/babel.js
Normal file
@@ -0,0 +1,17 @@
|
||||
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||
// This file is part of Parity.
|
||||
|
||||
// Parity is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
require('babel-register')();
|
||||
33
js/test/e2e/ethapi.js
Normal file
33
js/test/e2e/ethapi.js
Normal file
@@ -0,0 +1,33 @@
|
||||
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||
// This file is part of Parity.
|
||||
|
||||
// Parity is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import Api from '../../src/api';
|
||||
|
||||
function createApi (transport) {
|
||||
if (process.env.DEBUG) {
|
||||
transport.setDebug(true);
|
||||
}
|
||||
|
||||
return new Api(transport);
|
||||
}
|
||||
|
||||
export function createHttpApi () {
|
||||
return createApi(new Api.Transport.Http('http://localhost:8545'));
|
||||
}
|
||||
|
||||
export function createWsApi () {
|
||||
return createApi(new Api.Transport.Ws('ws://localhost:8546'));
|
||||
}
|
||||
45
js/test/mocha.config.js
Normal file
45
js/test/mocha.config.js
Normal file
@@ -0,0 +1,45 @@
|
||||
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||
// This file is part of Parity.
|
||||
|
||||
// Parity is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import 'isomorphic-fetch';
|
||||
|
||||
import es6Promise from 'es6-promise';
|
||||
es6Promise.polyfill();
|
||||
|
||||
import 'mock-local-storage';
|
||||
|
||||
import chai from 'chai';
|
||||
import chaiEnzyme from 'chai-enzyme';
|
||||
import sinonChai from 'sinon-chai';
|
||||
import { w3cwebsocket } from 'websocket';
|
||||
import jsdom from 'jsdom';
|
||||
|
||||
chai.use(chaiEnzyme());
|
||||
chai.use(sinonChai);
|
||||
|
||||
// expose expect to global so we won't have to manually import & define it in every test
|
||||
global.expect = chai.expect;
|
||||
global.WebSocket = w3cwebsocket;
|
||||
|
||||
// setup jsdom
|
||||
global.document = jsdom.jsdom('<!doctype html><html><body></body></html>');
|
||||
global.window = document.defaultView;
|
||||
global.navigator = global.window.navigator;
|
||||
|
||||
// attach mocked localStorage onto the window as exposed by jsdom
|
||||
global.window.localStorage = global.localStorage;
|
||||
|
||||
module.exports = {};
|
||||
3
js/test/mocha.opts
Normal file
3
js/test/mocha.opts
Normal file
@@ -0,0 +1,3 @@
|
||||
-r ./test/babel
|
||||
-r ./test/mocha.config
|
||||
-r ignore-styles
|
||||
95
js/test/mockRpc.js
Normal file
95
js/test/mockRpc.js
Normal file
@@ -0,0 +1,95 @@
|
||||
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||
// This file is part of Parity.
|
||||
|
||||
// Parity is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import nock from 'nock';
|
||||
import { Server as MockWsServer } from 'mock-socket';
|
||||
|
||||
import { isFunction } from '../src/api/util/types';
|
||||
|
||||
export const TEST_HTTP_URL = 'http://localhost:6688';
|
||||
export const TEST_WS_URL = 'ws://localhost:8866';
|
||||
|
||||
export function mockHttp (requests) {
|
||||
let scope = nock(TEST_HTTP_URL);
|
||||
|
||||
requests.forEach((request) => {
|
||||
scope = scope
|
||||
.post('/')
|
||||
.reply(request.code || 200, (uri, body) => {
|
||||
if (body.method !== request.method) {
|
||||
return {
|
||||
error: `Invalid method ${body.method}, expected ${request.method}`
|
||||
};
|
||||
}
|
||||
|
||||
scope.body = scope.body || {};
|
||||
scope.body[request.method] = body;
|
||||
|
||||
return request.reply;
|
||||
});
|
||||
});
|
||||
|
||||
return scope;
|
||||
}
|
||||
|
||||
export function mockWs (requests) {
|
||||
const scope = { requests: 0, body: {} };
|
||||
let mockServer = new MockWsServer(TEST_WS_URL);
|
||||
|
||||
scope.isDone = () => scope.requests === requests.length;
|
||||
scope.stop = () => {
|
||||
if (mockServer) {
|
||||
mockServer.stop();
|
||||
mockServer = null;
|
||||
}
|
||||
};
|
||||
|
||||
mockServer.on('message', (_body) => {
|
||||
const body = JSON.parse(_body);
|
||||
const request = requests[scope.requests];
|
||||
const reply = request.reply;
|
||||
const response = reply.error
|
||||
? { id: body.id, error: { code: reply.error.code, message: reply.error.message } }
|
||||
: { id: body.id, result: reply };
|
||||
|
||||
scope.body[request.method] = body;
|
||||
scope.requests++;
|
||||
|
||||
mockServer.send(JSON.stringify(response));
|
||||
});
|
||||
|
||||
return scope;
|
||||
}
|
||||
|
||||
export function endpointTest (instance, moduleId, name) {
|
||||
describe(name, () => {
|
||||
it(`has the ${moduleId}.${name} endpoint`, () => {
|
||||
expect(isFunction(instance[moduleId][name])).to.be.ok;
|
||||
});
|
||||
|
||||
it(`maps to ${moduleId}_${name} via RPC`, () => {
|
||||
const scope = mockHttp([{ method: `${moduleId}_${name}`, reply: {} }]);
|
||||
|
||||
return instance[moduleId][name]()
|
||||
.then(() => {
|
||||
expect(scope.isDone()).to.be.true;
|
||||
})
|
||||
.catch(() => {
|
||||
nock.cleanAll();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
42
js/test/types.js
Normal file
42
js/test/types.js
Normal file
@@ -0,0 +1,42 @@
|
||||
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||
// This file is part of Parity.
|
||||
|
||||
// Parity is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { isInstanceOf } from '../src/api/util/types';
|
||||
|
||||
export { isFunction, isInstanceOf } from '../src/api/util/types';
|
||||
export { isAddress } from '../src/abi/util/address';
|
||||
|
||||
const ZEROS = '000000000000000000000000000000000000000000000000000000000000';
|
||||
|
||||
export function isBigNumber (test) {
|
||||
return isInstanceOf(test, BigNumber);
|
||||
}
|
||||
|
||||
export function isBoolean (test) {
|
||||
return Object.prototype.toString.call(test) === '[object Boolean]';
|
||||
}
|
||||
|
||||
export function isHexNumber (_test) {
|
||||
if (_test.substr(0, 2) !== '0x') {
|
||||
return false;
|
||||
}
|
||||
|
||||
const test = _test.substr(2);
|
||||
const hex = `${ZEROS}${(new BigNumber(_test, 16)).toString(16)}`.slice(-1 * test.length);
|
||||
|
||||
return hex === test;
|
||||
}
|
||||
Reference in New Issue
Block a user