@itwin/geo-tools-react
Version:
React Geospatial Tools
39 lines • 1.7 kB
JavaScript
;
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.TestUtils = void 0;
const core_frontend_1 = require("@itwin/core-frontend");
const GeoTools_1 = require("../GeoTools");
// cSpell:ignore buttongroup
/** @internal */
class TestUtils {
static get localization() {
if (!TestUtils._localization) {
TestUtils._localization = core_frontend_1.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_1.GeoTools.initialize(TestUtils.localization);
TestUtils._uiComponentsInitialized = true;
}
}
static terminateUiComponents() {
GeoTools_1.GeoTools.terminate();
TestUtils._uiComponentsInitialized = false;
}
/** Waits until all async operations finish */
static async flushAsyncOperations() {
return new Promise((resolve) => setTimeout(resolve));
}
}
exports.TestUtils = TestUtils;
TestUtils._uiComponentsInitialized = false;
exports.default = TestUtils; // eslint-disable-line: no-default-export
//# sourceMappingURL=TestUtils.js.map