@itwin/geo-tools-react
Version:
React Geospatial Tools
35 lines • 1.52 kB
JavaScript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import { IModelApp } from "@itwin/core-frontend";
import { GeoTools } from "../GeoTools";
// cSpell:ignore buttongroup
/** @internal */
export class TestUtils {
static get localization() {
if (!TestUtils._localization) {
TestUtils._localization = IModelApp.localization;
}
return TestUtils._localization;
}
static async initializeGeoTools() {
if (!TestUtils._uiComponentsInitialized) {
// This is required by our I18n module (specifically the i18next package).
global.XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
await GeoTools.initialize(TestUtils.localization);
TestUtils._uiComponentsInitialized = true;
}
}
static terminateUiComponents() {
GeoTools.terminate();
TestUtils._uiComponentsInitialized = false;
}
/** Waits until all async operations finish */
static async flushAsyncOperations() {
return new Promise((resolve) => setTimeout(resolve));
}
}
TestUtils._uiComponentsInitialized = false;
export default TestUtils; // eslint-disable-line: no-default-export
//# sourceMappingURL=TestUtils.js.map