mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-01-17 21:28:28 +01:00
Add jsdom for headless testing.
This commit is contained in:
parent
1d4b4b8a02
commit
a6994150ca
4
ghu.js
4
ghu.js
@ -20,6 +20,10 @@ const webpackCfg = include => ({
|
||||
cacheDirectory: true,
|
||||
presets: ['es2015']
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /jsdom/,
|
||||
loader: 'null-loader'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -18,10 +18,12 @@
|
||||
"babel-preset-es2015": "6.9.0",
|
||||
"eslint": "3.1.1",
|
||||
"ghu": "0.7.0",
|
||||
"jsdom": "9.4.1",
|
||||
"kjua": "0.1.1",
|
||||
"lolight": "0.3.0",
|
||||
"marked": "0.3.5",
|
||||
"normalize.css": "4.2.0",
|
||||
"null-loader": "0.1.1",
|
||||
"scar": "0.14.0"
|
||||
},
|
||||
"engines": {
|
||||
|
@ -1,11 +1,10 @@
|
||||
const {each, values, difference} = require('../util');
|
||||
const {win} = require('../globals');
|
||||
const {request} = require('../server');
|
||||
const allsettings = require('./settings');
|
||||
const event = require('./event');
|
||||
const notification = require('../view/notification');
|
||||
|
||||
|
||||
const win = global.window;
|
||||
const doc = win.document;
|
||||
const settings = Object.assign({
|
||||
fastBrowsing: true,
|
||||
|
@ -1,6 +1,4 @@
|
||||
const {win} = require('../globals');
|
||||
|
||||
const store = win.localStorage;
|
||||
const store = global.window.localStorage;
|
||||
const storekey = '_h5ai';
|
||||
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
const {win} = require('../globals');
|
||||
const event = require('../core/event');
|
||||
const location = require('../core/location');
|
||||
const allsettings = require('../core/settings');
|
||||
|
||||
const win = global.window;
|
||||
const settings = Object.assign({
|
||||
enabled: false,
|
||||
interval: 5000
|
||||
|
@ -1,9 +1,8 @@
|
||||
const {map} = require('../util');
|
||||
const {win} = require('../globals');
|
||||
const event = require('../core/event');
|
||||
const allsettings = require('../core/settings');
|
||||
|
||||
|
||||
const win = global.window;
|
||||
const settings = Object.assign({
|
||||
enabled: false,
|
||||
id: 'UA-000000-0'
|
||||
|
@ -1,6 +1,5 @@
|
||||
const kjua = require('kjua');
|
||||
const {isNum, dom} = require('../util');
|
||||
const {win} = require('../globals');
|
||||
const event = require('../core/event');
|
||||
const format = require('../core/format');
|
||||
const resource = require('../core/resource');
|
||||
@ -96,7 +95,7 @@ const update = item => {
|
||||
}
|
||||
|
||||
if (settings.qrcode) {
|
||||
const loc = win.location;
|
||||
const loc = global.window.location;
|
||||
$qrcode.clr().app(kjua({
|
||||
render: 'image',
|
||||
size: 200,
|
||||
|
@ -1,5 +1,4 @@
|
||||
const {each, isStr, dom} = require('../util');
|
||||
const {win} = require('../globals');
|
||||
const server = require('../server');
|
||||
const event = require('../core/event');
|
||||
const format = require('../core/format');
|
||||
@ -7,6 +6,7 @@ const langs = require('../core/langs');
|
||||
const allsettings = require('../core/settings');
|
||||
const store = require('../core/store');
|
||||
|
||||
const win = global.window;
|
||||
const settings = Object.assign({
|
||||
enabled: false,
|
||||
lang: 'en',
|
||||
|
@ -1,9 +1,8 @@
|
||||
const {dom, onLoad} = require('../util');
|
||||
const {win} = require('../globals');
|
||||
const event = require('../core/event');
|
||||
const allsettings = require('../core/settings');
|
||||
|
||||
|
||||
const win = global.window;
|
||||
const settings = Object.assign({
|
||||
enabled: false,
|
||||
baseURL: 'not-set',
|
||||
|
@ -1,10 +1,10 @@
|
||||
const lolight = require('lolight');
|
||||
const marked = require('marked');
|
||||
const {keys, dom} = require('../../util');
|
||||
const {win} = require('../../globals');
|
||||
const allsettings = require('../../core/settings');
|
||||
const preview = require('./preview');
|
||||
|
||||
const win = global.window;
|
||||
const XHR = win.XMLHttpRequest;
|
||||
const settings = Object.assign({
|
||||
enabled: false,
|
||||
|
@ -1,10 +1,10 @@
|
||||
const {each, isFn, isNum, dom, includes, compact} = require('../../util');
|
||||
const {win} = require('../../globals');
|
||||
const event = require('../../core/event');
|
||||
const resource = require('../../core/resource');
|
||||
const allsettings = require('../../core/settings');
|
||||
const store = require('../../core/store');
|
||||
|
||||
const win = global.window;
|
||||
const settings = Object.assign({
|
||||
enabled: true
|
||||
}, allsettings.preview);
|
||||
|
@ -1,11 +1,9 @@
|
||||
const {each, dom} = require('../util');
|
||||
const {win} = require('../globals');
|
||||
const event = require('../core/event');
|
||||
const resource = require('../core/resource');
|
||||
const allsettings = require('../core/settings');
|
||||
|
||||
|
||||
const doc = win.document;
|
||||
const doc = global.window.document;
|
||||
const settings = Object.assign({
|
||||
enabled: false,
|
||||
clickndrag: false,
|
||||
|
@ -1,9 +1,7 @@
|
||||
const {win} = require('../globals');
|
||||
const event = require('../core/event');
|
||||
const allsettings = require('../core/settings');
|
||||
|
||||
|
||||
const doc = win.document;
|
||||
const doc = global.window.document;
|
||||
const settings = Object.assign({
|
||||
enabled: false
|
||||
}, allsettings.title);
|
||||
|
@ -1,3 +0,0 @@
|
||||
module.exports = {
|
||||
win: global.window
|
||||
};
|
@ -1,4 +1,3 @@
|
||||
const {win} = require('../globals');
|
||||
const location = require('../core/location');
|
||||
|
||||
require('../view/viewmode');
|
||||
@ -20,4 +19,4 @@ require('../ext/thumbnails');
|
||||
require('../ext/title');
|
||||
require('../ext/tree');
|
||||
|
||||
location.setLocation(win.document.location.href, true);
|
||||
location.setLocation(global.window.document.location.href, true);
|
||||
|
@ -1,5 +1,4 @@
|
||||
const {dom} = require('../util');
|
||||
const {win} = require('../globals');
|
||||
const config = require('../config');
|
||||
const server = require('../server');
|
||||
const resource = require('../core/resource');
|
||||
@ -135,7 +134,7 @@ const addTests = () => {
|
||||
};
|
||||
|
||||
const reload = () => {
|
||||
win.location.reload();
|
||||
global.window.location.reload();
|
||||
};
|
||||
|
||||
const onLogin = () => {
|
||||
|
@ -1,6 +1,5 @@
|
||||
const {each, dom} = require('./util');
|
||||
const {win} = require('./globals');
|
||||
const XHR = win.XMLHttpRequest;
|
||||
const XHR = global.window.XMLHttpRequest;
|
||||
|
||||
const request = data => {
|
||||
return new Promise(resolve => {
|
||||
|
@ -1,6 +1,6 @@
|
||||
const {win} = require('../globals');
|
||||
const {each, filter, hasLength, is, isStr, map, isInstanceOf, toArray} = require('./lo');
|
||||
|
||||
const win = global.window;
|
||||
const doc = win.document;
|
||||
|
||||
const parseHtml = (() => {
|
||||
|
@ -1,3 +1,7 @@
|
||||
if (!global.window) {
|
||||
global.window = require('jsdom').jsdom().defaultView;
|
||||
}
|
||||
|
||||
const {test} = require('scar');
|
||||
const {pinHtml} = require('./util/pin');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user