2019-01-15 18:53:27 -05:00
|
|
|
/**
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
* or more contributor license agreements. See the NOTICE file
|
|
|
|
* distributed with this work for additional information
|
|
|
|
* regarding copyright ownership. The ASF licenses this file
|
|
|
|
* to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance
|
|
|
|
* with the License. You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing,
|
|
|
|
* software distributed under the License is distributed on an
|
|
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
* KIND, either express or implied. See the License for the
|
|
|
|
* specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*/
|
2019-08-20 18:32:50 -04:00
|
|
|
import 'core-js/stable';
|
|
|
|
import 'regenerator-runtime/runtime';
|
2018-10-15 19:52:19 -04:00
|
|
|
import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only';
|
2020-07-29 13:53:06 -04:00
|
|
|
import 'jest-enzyme';
|
|
|
|
import jQuery from 'jquery';
|
2018-09-10 17:48:06 -04:00
|
|
|
import { configure } from 'enzyme';
|
|
|
|
import Adapter from 'enzyme-adapter-react-16';
|
2020-09-09 16:18:55 -04:00
|
|
|
import { configure as configureTranslation } from '@superset-ui/core';
|
2018-09-10 17:48:06 -04:00
|
|
|
|
2018-10-18 13:40:30 -04:00
|
|
|
import setupSupersetClient from './setupSupersetClient';
|
|
|
|
|
2018-09-10 17:48:06 -04:00
|
|
|
configure({ adapter: new Adapter() });
|
2016-07-14 22:50:47 -04:00
|
|
|
|
2016-07-27 19:57:05 -04:00
|
|
|
const exposedProperties = ['window', 'navigator', 'document'];
|
2016-07-14 22:50:47 -04:00
|
|
|
|
2020-09-14 13:11:20 -04:00
|
|
|
const { defaultView } = document;
|
2020-07-29 13:53:06 -04:00
|
|
|
if (defaultView != null) {
|
|
|
|
Object.keys(defaultView).forEach(property => {
|
|
|
|
if (typeof global[property] === 'undefined') {
|
|
|
|
exposedProperties.push(property);
|
|
|
|
global[property] = defaultView[property];
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2016-07-14 22:50:47 -04:00
|
|
|
|
2020-07-29 13:53:06 -04:00
|
|
|
const g = global as any;
|
|
|
|
|
|
|
|
g.window = g.window || {};
|
|
|
|
g.window.location = { href: 'about:blank' };
|
|
|
|
g.window.performance = { now: () => new Date().getTime() };
|
|
|
|
|
|
|
|
g.$ = jQuery(g.window);
|
2018-10-18 13:40:30 -04:00
|
|
|
|
2018-10-30 17:51:44 -04:00
|
|
|
configureTranslation();
|
2018-10-18 13:40:30 -04:00
|
|
|
setupSupersetClient();
|