fleet/frontend/.test.setup.js
Mike Stone 58c3733524 Add hosts (#294)
* New hosts route

* Adds source code pro font

* New Host Page

* make Icons clickable

* Adds clipboard icon

* highlight icon & show helper text when text copied

* Method 2 text

* Fixes Firefox bug

* Fix spelling error
2016-10-11 12:10:41 -04:00

54 lines
1.1 KiB
JavaScript

import jsdom from 'jsdom';
const doc = jsdom.jsdom(
`<!doctype html>
<html>
<body>
<input id="method1" value="hello world" />
<input id="method2" value="hello world" />
</body>
</html>`,
{
url: 'http://localhost:8080/foo'
},
);
global.document = doc;
global.document.queryCommandEnabled = () => { return true; };
global.document.execCommand = () => { return true; };
global.window = doc.defaultView;
global.window.getSelection = () => {
return {
removeAllRanges: () => { return true; },
};
};
global.navigator = global.window.navigator;
function mockStorage() {
let storage = {};
return {
setItem(key, value = '') {
storage[key] = value;
},
getItem(key) {
return storage[key];
},
removeItem(key) {
delete storage[key];
},
get length() {
return Object.keys(storage).length;
},
key(i) {
return Object.keys(storage)[i] || null;
},
clear () {
storage = {};
},
};
}
require('radium').TestMode.enable();
global.localStorage = window.localStorage = mockStorage();