aboutsummaryrefslogtreecommitdiffstats
path: root/test/lib
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-07-04 03:42:14 +0800
committerkumavis <aaron@kumavis.me>2018-07-04 03:42:14 +0800
commit77daed5c74aa3c1fdbf1d9c71f544928f47f3993 (patch)
tree4a614dbdfce84b452562dcabccffa53b8393e2b0 /test/lib
parent2b2cd87e2d6e93dadb3ddd20ebf854ab6f2d2382 (diff)
parente467eda4f720fa89141ded2e709566102402479b (diff)
downloadtangerine-wallet-browser-77daed5c74aa3c1fdbf1d9c71f544928f47f3993.tar
tangerine-wallet-browser-77daed5c74aa3c1fdbf1d9c71f544928f47f3993.tar.gz
tangerine-wallet-browser-77daed5c74aa3c1fdbf1d9c71f544928f47f3993.tar.bz2
tangerine-wallet-browser-77daed5c74aa3c1fdbf1d9c71f544928f47f3993.tar.lz
tangerine-wallet-browser-77daed5c74aa3c1fdbf1d9c71f544928f47f3993.tar.xz
tangerine-wallet-browser-77daed5c74aa3c1fdbf1d9c71f544928f47f3993.tar.zst
tangerine-wallet-browser-77daed5c74aa3c1fdbf1d9c71f544928f47f3993.zip
Merge branch 'develop' of github.com:MetaMask/metamask-extension into network-remove-provider-engine
Diffstat (limited to 'test/lib')
-rw-r--r--test/lib/createTxMeta.js2
-rw-r--r--test/lib/mock-encryptor.js2
-rw-r--r--test/lib/mock-tx-gen.js6
-rw-r--r--test/lib/react-trigger-change.js112
-rw-r--r--test/lib/util.js6
5 files changed, 64 insertions, 64 deletions
diff --git a/test/lib/createTxMeta.js b/test/lib/createTxMeta.js
index 246ea58a5..0e88e3cfb 100644
--- a/test/lib/createTxMeta.js
+++ b/test/lib/createTxMeta.js
@@ -2,7 +2,7 @@ const txStateHistoryHelper = require('../../app/scripts/controllers/transactions
module.exports = createTxMeta
-function createTxMeta(partialMeta) {
+function createTxMeta (partialMeta) {
const txMeta = Object.assign({
status: 'unapproved',
txParams: {},
diff --git a/test/lib/mock-encryptor.js b/test/lib/mock-encryptor.js
index ef229a82f..48aa9e52c 100644
--- a/test/lib/mock-encryptor.js
+++ b/test/lib/mock-encryptor.js
@@ -31,6 +31,6 @@ module.exports = {
getRandomValues () {
return 'SOO RANDO!!!1'
- }
+ },
}
diff --git a/test/lib/mock-tx-gen.js b/test/lib/mock-tx-gen.js
index 7aea09c59..106101500 100644
--- a/test/lib/mock-tx-gen.js
+++ b/test/lib/mock-tx-gen.js
@@ -17,14 +17,14 @@ class TxGenerator {
}
generate (tx = {}, opts = {}) {
- let { count, fromNonce } = opts
+ const { count, fromNonce } = opts
let nonce = fromNonce || this.txs.length
- let txs = []
+ const txs = []
for (let i = 0; i < count; i++) {
txs.push(extend(template, {
txParams: {
nonce: hexify(nonce++),
- }
+ },
}, tx))
}
this.txs = this.txs.concat(txs)
diff --git a/test/lib/react-trigger-change.js b/test/lib/react-trigger-change.js
index a25ddff00..d169dd614 100644
--- a/test/lib/react-trigger-change.js
+++ b/test/lib/react-trigger-change.js
@@ -1,7 +1,7 @@
// Trigger React's synthetic change events on input, textarea and select elements
// https://github.com/vitalyq/react-trigger-change
-/******************IMPORTANT NOTE******************/
+/** ****************IMPORTANT NOTE******************/
/* This file is a modification of the */
/* 'react-trigger-change' library linked above. */
/* That library breaks when 'onFocus' events are */
@@ -11,13 +11,13 @@
/* This modification removes the accomodations */
/* 'react-trigger-change' makes for IE to ensure */
/* our tests can pass in chrome and firefox. */
-/**************************************************/
+/** ************************************************/
-'use strict';
+'use strict'
// Constants and functions are declared inside the closure.
// In this way, reactTriggerChange can be passed directly to executeScript in Selenium.
-module.exports = function reactTriggerChange(node) {
+module.exports = function reactTriggerChange (node) {
var supportedInputTypes = {
color: true,
date: true,
@@ -33,47 +33,47 @@ module.exports = function reactTriggerChange(node) {
text: true,
time: true,
url: true,
- week: true
- };
- var nodeName = node.nodeName.toLowerCase();
- var type = node.type;
- var event;
- var descriptor;
- var initialValue;
- var initialChecked;
- var initialCheckedRadio;
+ week: true,
+ }
+ var nodeName = node.nodeName.toLowerCase()
+ var type = node.type
+ var event
+ var descriptor
+ var initialValue
+ var initialChecked
+ var initialCheckedRadio
// Do not try to delete non-configurable properties.
// Value and checked properties on DOM elements are non-configurable in PhantomJS.
- function deletePropertySafe(elem, prop) {
- var desc = Object.getOwnPropertyDescriptor(elem, prop);
+ function deletePropertySafe (elem, prop) {
+ var desc = Object.getOwnPropertyDescriptor(elem, prop)
if (desc && desc.configurable) {
- delete elem[prop];
+ delete elem[prop]
}
}
- function getCheckedRadio(radio) {
- var name = radio.name;
- var radios;
- var i;
+ function getCheckedRadio (radio) {
+ var name = radio.name
+ var radios
+ var i
if (name) {
- radios = document.querySelectorAll('input[type="radio"][name="' + name + '"]');
+ radios = document.querySelectorAll('input[type="radio"][name="' + name + '"]')
for (i = 0; i < radios.length; i += 1) {
if (radios[i].checked) {
- return radios[i] !== radio ? radios[i] : null;
+ return radios[i] !== radio ? radios[i] : null
}
}
}
- return null;
+ return null
}
- function preventChecking(e) {
- e.preventDefault();
+ function preventChecking (e) {
+ e.preventDefault()
if (!initialChecked) {
- e.target.checked = false;
+ e.target.checked = false
}
if (initialCheckedRadio) {
- initialCheckedRadio.checked = true;
+ initialCheckedRadio.checked = true
}
}
@@ -81,81 +81,81 @@ module.exports = function reactTriggerChange(node) {
(nodeName === 'input' && type === 'file')) {
// IE9-IE11, non-IE
// Dispatch change.
- event = document.createEvent('HTMLEvents');
- event.initEvent('change', true, false);
- node.dispatchEvent(event);
+ event = document.createEvent('HTMLEvents')
+ event.initEvent('change', true, false)
+ node.dispatchEvent(event)
} else if ((nodeName === 'input' && supportedInputTypes[type]) ||
nodeName === 'textarea') {
// React 16
// Cache artificial value property descriptor.
// Property doesn't exist in React <16, descriptor is undefined.
- descriptor = Object.getOwnPropertyDescriptor(node, 'value');
+ descriptor = Object.getOwnPropertyDescriptor(node, 'value')
// Update inputValueTracking cached value.
// Remove artificial value property.
// Restore initial value to trigger event with it.
- initialValue = node.value;
- node.value = initialValue + '#';
- deletePropertySafe(node, 'value');
- node.value = initialValue;
+ initialValue = node.value
+ node.value = initialValue + '#'
+ deletePropertySafe(node, 'value')
+ node.value = initialValue
// React 0.14: IE10-IE11, non-IE
// React 15: non-IE
// React 16: IE10-IE11, non-IE
- event = document.createEvent('HTMLEvents');
- event.initEvent('input', true, false);
- node.dispatchEvent(event);
+ event = document.createEvent('HTMLEvents')
+ event.initEvent('input', true, false)
+ node.dispatchEvent(event)
// React 16
// Restore artificial value property descriptor.
if (descriptor) {
- Object.defineProperty(node, 'value', descriptor);
+ Object.defineProperty(node, 'value', descriptor)
}
} else if (nodeName === 'input' && type === 'checkbox') {
// Invert inputValueTracking cached value.
- node.checked = !node.checked;
+ node.checked = !node.checked
// Dispatch click.
// Click event inverts checked value.
- event = document.createEvent('MouseEvents');
- event.initEvent('click', true, true);
- node.dispatchEvent(event);
+ event = document.createEvent('MouseEvents')
+ event.initEvent('click', true, true)
+ node.dispatchEvent(event)
} else if (nodeName === 'input' && type === 'radio') {
// Cache initial checked value.
- initialChecked = node.checked;
+ initialChecked = node.checked
// Find and cache initially checked radio in the group.
- initialCheckedRadio = getCheckedRadio(node);
+ initialCheckedRadio = getCheckedRadio(node)
// React 16
// Cache property descriptor.
// Invert inputValueTracking cached value.
// Remove artificial checked property.
// Restore initial value, otherwise preventDefault will eventually revert the value.
- descriptor = Object.getOwnPropertyDescriptor(node, 'checked');
- node.checked = !initialChecked;
- deletePropertySafe(node, 'checked');
- node.checked = initialChecked;
+ descriptor = Object.getOwnPropertyDescriptor(node, 'checked')
+ node.checked = !initialChecked
+ deletePropertySafe(node, 'checked')
+ node.checked = initialChecked
// Prevent toggling during event capturing phase.
// Set checked value to false if initialChecked is false,
// otherwise next listeners will see true.
// Restore initially checked radio in the group.
- node.addEventListener('click', preventChecking, true);
+ node.addEventListener('click', preventChecking, true)
// Dispatch click.
// Click event inverts checked value.
- event = document.createEvent('MouseEvents');
- event.initEvent('click', true, true);
- node.dispatchEvent(event);
+ event = document.createEvent('MouseEvents')
+ event.initEvent('click', true, true)
+ node.dispatchEvent(event)
// Remove listener to stop further change prevention.
- node.removeEventListener('click', preventChecking, true);
+ node.removeEventListener('click', preventChecking, true)
// React 16
// Restore artificial checked property descriptor.
if (descriptor) {
- Object.defineProperty(node, 'checked', descriptor);
+ Object.defineProperty(node, 'checked', descriptor)
}
}
-};
+}
diff --git a/test/lib/util.js b/test/lib/util.js
index 626280745..858565bb9 100644
--- a/test/lib/util.js
+++ b/test/lib/util.js
@@ -11,7 +11,7 @@ function timeout (time) {
})
}
-async function findAsync(container, selector, opts) {
+async function findAsync (container, selector, opts) {
try {
return await pollUntilTruthy(() => {
const result = container.find(selector)
@@ -22,7 +22,7 @@ async function findAsync(container, selector, opts) {
}
}
-async function queryAsync(jQuery, selector, opts) {
+async function queryAsync (jQuery, selector, opts) {
try {
return await pollUntilTruthy(() => {
const result = jQuery(selector)
@@ -33,7 +33,7 @@ async function queryAsync(jQuery, selector, opts) {
}
}
-async function pollUntilTruthy(fn, opts = {}){
+async function pollUntilTruthy (fn, opts = {}) {
const pollingInterval = opts.pollingInterval || 100
const timeoutInterval = opts.timeoutInterval || 5000
const start = Date.now()