@eclipse-scout/core
Version:
Eclipse Scout runtime
1,215 lines (1,149 loc) • 137 kB
JavaScript
import * as __WEBPACK_EXTERNAL_MODULE__eclipse_scout_core_ec9759ad__ from "@eclipse-scout/core";
import * as __WEBPACK_EXTERNAL_MODULE_jasmine_ajax_551d3866__ from "jasmine-ajax";
import * as __WEBPACK_EXTERNAL_MODULE_jasmine_jquery_250afc6b__ from "jasmine-jquery";
/******/ var __webpack_modules__ = ({
/***/ "./src/testing/JasmineScout.ts":
/*!*************************************!*\
!*** ./src/testing/JasmineScout.ts ***!
\*************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ JasmineScout: () => (/* binding */ JasmineScout)
/* harmony export */ });
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../index */ "../index");
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index */ "./src/testing/index.ts");
/* harmony import */ var jasmine_jquery__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! jasmine-jquery */ "jasmine-jquery");
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! jquery */ "jquery");
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_3__);
/*
* Copyright (c) 2010, 2025 BSI Business Systems Integration AG
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
window.sandboxSession = options => {
options = options || {};
let $sandbox = jquery__WEBPACK_IMPORTED_MODULE_3___default()('#sandbox').addClass('scout');
let model = options;
model.portletPartId = options.portletPartId || '0';
model.backgroundJobPollingEnabled = false;
model.suppressErrors = true;
model.$entryPoint = $sandbox;
let session = _index__WEBPACK_IMPORTED_MODULE_0__.scout.create(_index__WEBPACK_IMPORTED_MODULE_0__.Session, model);
$sandbox.data('sandboxSession', session);
// Install non-filtering requestToJson() function. This is required to test
// the value of the "showBusyIndicator" using toContainEvents(). Usually, this
// flag is filtered from the request before sending the AJAX call, however in
// the tests we want to keep it.
session._requestToJson = request => JSON.stringify(request);
// Simulate successful session initialization
session.uiSessionId = '1.1';
session.modelAdapterRegistry[session.uiSessionId] = session;
session.locale = new _index__WEBPACK_IMPORTED_MODULE_1__.LocaleSpecHelper().createLocale('de-CH');
let desktop = options.desktop || {};
desktop.navigationVisible = _index__WEBPACK_IMPORTED_MODULE_0__.scout.nvl(desktop.navigationVisible, false);
desktop.headerVisible = _index__WEBPACK_IMPORTED_MODULE_0__.scout.nvl(desktop.headerVisible, false);
desktop.benchVisible = _index__WEBPACK_IMPORTED_MODULE_0__.scout.nvl(desktop.benchVisible, false);
desktop.parent = _index__WEBPACK_IMPORTED_MODULE_0__.scout.nvl(desktop.parent, session.root);
session.desktop = _index__WEBPACK_IMPORTED_MODULE_0__.scout.create(_index__WEBPACK_IMPORTED_MODULE_0__.Desktop, desktop);
if (_index__WEBPACK_IMPORTED_MODULE_0__.scout.nvl(options.renderDesktop, true)) {
session._renderDesktop();
}
// Prevent exception when test window gets resized
$sandbox.window().off('resize', session.desktop._resizeHandler);
return session;
};
/**
* This function links and existing widget with a new adapter instance. This is useful for tests
* where you have an existing widget and later create a new adapter instance to that widget.
*/
window.linkWidgetAndAdapter = (widget, adapterClass) => {
let session = widget.session;
let adapter = _index__WEBPACK_IMPORTED_MODULE_0__.scout.create(adapterClass, {
id: widget.id,
session: session
});
adapter.widget = widget;
widget.modelAdapter = adapter;
adapter._attachWidget();
adapter._postCreateWidget();
};
/**
* Converts the given adapterDataArray into a map of adapterData where the key
* is the adapterData.id and the value is the adapterData itself.
*/
window.mapAdapterData = adapterDataArray => {
let adapterDataMap = {};
adapterDataArray = _index__WEBPACK_IMPORTED_MODULE_0__.arrays.ensure(adapterDataArray);
adapterDataArray.forEach(adapterData => {
adapterDataMap[adapterData.id] = adapterData;
});
return adapterDataMap;
};
/**
* Converts the given adapterDataArray into a map of adapterData and registers the adapterData in the Session.
* Only use this function when your tests requires to have a remote adapter. In that case create widget and
* remote adapter with Session#getOrCreateWidget().
*/
window.registerAdapterData = (adapterDataArray, session) => {
let adapterDataMap = window.mapAdapterData(adapterDataArray);
session._copyAdapterData(adapterDataMap);
};
/**
* Removes all open popups for the given session.
* May be used to make sure handlers get properly detached
*/
window.removePopups = (session, cssClass) => {
cssClass = cssClass || '.popup';
session.$entryPoint.children(cssClass).each(function () {
let popup = _index__WEBPACK_IMPORTED_MODULE_0__.scout.widget(jquery__WEBPACK_IMPORTED_MODULE_3___default()(this));
popup.animateRemoval = false;
popup.remove();
});
};
window.createSimpleModel = (objectType, session, id) => {
if (id === undefined) {
id = _index__WEBPACK_IMPORTED_MODULE_0__.ObjectIdProvider.get().createUiSeqId();
}
let parent = session.desktop;
return {
id: id,
objectType: objectType,
parent: parent,
session: session
};
};
window.mostRecentJsonRequest = () => {
let req = jasmine.Ajax.requests.mostRecent();
if (req) {
return JSON.parse(req.params);
}
};
window.sandboxDesktop = () => {
let $sandbox = sandbox();
$sandbox.addClass('scout desktop');
return $sandbox;
};
/**
* Sends the queued requests and simulates a response as well.
* @param response if not set an empty success response will be generated
*/
window.sendQueuedAjaxCalls = (response, time) => {
time = time || 0;
jasmine.clock().tick(time);
window.receiveResponseForAjaxCall(null, response);
};
window.receiveResponseForAjaxCall = (request, response) => {
if (!response) {
response = {
status: 200,
responseText: '{"events":[]}'
};
}
if (!request) {
request = jasmine.Ajax.requests.mostRecent();
}
if (request && request.onload) {
request.respondWith(response);
}
};
/**
* Uninstalls 'beforeunload' and 'unload' events from window that were previously installed by session.start()
*/
window.uninstallUnloadHandlers = session => {
jquery__WEBPACK_IMPORTED_MODULE_3___default()(window).off('beforeunload.' + session.uiSessionId).off('unload.' + session.uiSessionId);
};
window.createPropertyChangeEvent = (model, properties) => ({
target: model.id,
properties: properties,
type: 'property'
});
window.sleep = duration => {
let deferred = jquery__WEBPACK_IMPORTED_MODULE_3___default().Deferred();
setTimeout(() => deferred.resolve(), duration);
return deferred.promise();
};
const JasmineScout = {
runTestSuite(context) {
this.startApp(_index__WEBPACK_IMPORTED_MODULE_1__.TestingApp);
beforeAll(() => {
spyOn(_index__WEBPACK_IMPORTED_MODULE_0__.scout, 'reloadPage').and.callFake(() => {
// NOP: disable reloading as this would restart the whole test-suite again and again
});
});
beforeEach(() => {
jasmine.addMatchers(_index__WEBPACK_IMPORTED_MODULE_1__.jasmineScoutMatchers);
_index__WEBPACK_IMPORTED_MODULE_1__.SpecUiPreferencesStore.install();
});
afterEach(() => {
const $sandbox = jquery__WEBPACK_IMPORTED_MODULE_3___default()('#sandbox');
const session = $sandbox.data('sandboxSession');
$sandbox.removeData('sandboxSession');
if (session?.layoutValidator) {
session.layoutValidator._postValidateFunctions = [];
session.layoutValidator.desktop = null;
}
// Cleanup global objects and remove every handler to avoid a memory leak because widgets are not destroyed properly after tests, so they won't unregister their handlers
_index__WEBPACK_IMPORTED_MODULE_0__.HtmlEnvironment.get().off('propertyChange');
_index__WEBPACK_IMPORTED_MODULE_0__.uiNotifications.tearDown();
_index__WEBPACK_IMPORTED_MODULE_1__.SpecUiPreferencesStore.uninstall();
});
context.keys().forEach(context);
},
startApp(AppClass) {
// App initialization uses promises which are executed asynchronously
// -> Use the clock to make sure all promise callbacks are executed before any test starts.
jasmine.clock().install();
jasmine.Ajax.install();
_index__WEBPACK_IMPORTED_MODULE_0__.App.addListener('prepare', () => {
_index__WEBPACK_IMPORTED_MODULE_1__.JasmineScoutUtil.mockRestCall('api/permissions', {
type: _index__WEBPACK_IMPORTED_MODULE_0__.PermissionCollectionType.ALL
});
_index__WEBPACK_IMPORTED_MODULE_1__.JasmineScoutUtil.mockRestCall('api/codes', {});
_index__WEBPACK_IMPORTED_MODULE_1__.UiNotificationsMock.register(); // Disable endless unsuccessful polling in specs if a component subscribes for ui notifications
});
new AppClass().init();
jasmine.clock().tick(1000);
jasmine.Ajax.uninstall();
jasmine.clock().uninstall();
}
};
/***/ }),
/***/ "./src/testing/JasmineScoutUtil.ts":
/*!*****************************************!*\
!*** ./src/testing/JasmineScoutUtil.ts ***!
\*****************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ JasmineScoutUtil: () => (/* binding */ JasmineScoutUtil)
/* harmony export */ });
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../index */ "../index");
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jquery */ "jquery");
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var jasmine_ajax__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! jasmine-ajax */ "jasmine-ajax");
/*
* Copyright (c) 2010, 2025 BSI Business Systems Integration AG
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
let _jsonResourceCache = {};
/**
* Utility functions for jasmine tests.
*/
const JasmineScoutUtil = {
/**
* @returns the loaded JSON data structure
*/
loadJsonResource(jsonResourceUrl) {
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_index__WEBPACK_IMPORTED_MODULE_0__.scout.assertParameter('jsonResourceUrl', jsonResourceUrl);
if (_index__WEBPACK_IMPORTED_MODULE_0__.scout.nvl(options.useCache, true)) {
let json = _jsonResourceCache[jsonResourceUrl];
if (json) {
return jquery__WEBPACK_IMPORTED_MODULE_1___default().resolvedPromise(json);
}
}
return jquery__WEBPACK_IMPORTED_MODULE_1___default().ajax({
async: false,
method: 'GET',
dataType: 'json',
contentType: 'application/json; charset=UTF-8',
cache: false,
url: jsonResourceUrl
}).done(json => {
if (_index__WEBPACK_IMPORTED_MODULE_0__.scout.nvl(options.useCache, true)) {
_jsonResourceCache[jsonResourceUrl] = json;
}
return jquery__WEBPACK_IMPORTED_MODULE_1___default().resolvedPromise(json);
}).fail((jqXHR, textStatus, errorThrown) => {
throw new Error('Could not load resource from url: ' + jsonResourceUrl);
});
},
loadJsonResourceAndMockRestCall(resourceUrlToMock, jsonResourceUrl) {
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
_index__WEBPACK_IMPORTED_MODULE_0__.scout.assertParameter('resourceUrlToMock', resourceUrlToMock);
JasmineScoutUtil.loadJsonResource(jsonResourceUrl, options).then(json => JasmineScoutUtil.mockRestCall(resourceUrlToMock, json, options));
},
mockRestLookupCall(resourceUrlToMock, lookupRows, parentRestriction) {
_index__WEBPACK_IMPORTED_MODULE_0__.scout.assertParameter('resourceUrlToMock', resourceUrlToMock);
// Normalize lookup rows
lookupRows = _index__WEBPACK_IMPORTED_MODULE_0__.arrays.ensure(lookupRows).map(lookupRow => jquery__WEBPACK_IMPORTED_MODULE_1___default().extend({
active: true,
enabled: true,
parentId: null
}, lookupRow));
// getAll()
JasmineScoutUtil.mockRestCall(resourceUrlToMock, {
rows: lookupRows
}, {
restriction: parentRestriction
});
// getKey()
lookupRows.forEach(lookupRow => {
JasmineScoutUtil.mockRestCall(resourceUrlToMock, {
rows: [lookupRow]
}, {
restriction: lookupRow.id
});
});
},
mockRestCall(resourceUrlToMock, responseData) {
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
let url = new RegExp('.*' + _index__WEBPACK_IMPORTED_MODULE_0__.strings.quote(resourceUrlToMock) + '.*');
let data = options.restriction ? new RegExp('.*' + _index__WEBPACK_IMPORTED_MODULE_0__.strings.quote(options.restriction) + '.*') : undefined;
const stringify = options.stringify || JSON.stringify;
const responseText = stringify(responseData);
jasmine.Ajax.stubRequest(url, data, options.method).andReturn({
status: 200,
responseText
});
},
mockDataObjectRestCall(resourceUrlToMock, responseData) {
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
options.stringify = options.stringify || _index__WEBPACK_IMPORTED_MODULE_0__.dataObjects.stringify;
this.mockRestCall(resourceUrlToMock, responseData, options);
},
/**
* If an ajax call is not mocked, this fallback will be triggered to show information about which url is not mocked.
*/
captureNotMockedCalls() {
jasmine.Ajax.stubRequest(/.*/).andCallFunction(request => {
fail('Ajax call not mocked for url: ' + request.url + ', method: ' + request.method);
});
},
/**
* Calls the given mock as soon as a hybrid action with the given actionType is called.
* The mock is called asynchronously using setTimeout to let the runtime code add any required event listeners first.
*
* The mock may return an object with [id, widget] if the action is supposed to create widgets.
* The format of the id depends on the method used to add widgets:
* - `AbstractHybridAction.addWidget(IWidget)` (e.g. `AbstractFormHybridAction`): `${widgetId}`
* - `AbstractHybridAction.addWidgets(Map<String, IWidget>)`: `${actionId}${widgetId}`
*/
mockHybridAction(session, actionType, mock) {
let hm = _index__WEBPACK_IMPORTED_MODULE_0__.HybridManager.get(session);
hm.on('hybridAction', event => {
if (event.data.actionType === actionType) {
setTimeout(() => {
let widgets = mock(event);
if (widgets) {
hm.setProperty('widgets', widgets);
}
});
}
});
},
/**
* Asserts that every page has an uuid and a specific {@link PageParamDo}, if required.
*/
assertPageCompleteness(options) {
options = options || {};
let pagesNotRequiringUuid = new Set([_index__WEBPACK_IMPORTED_MODULE_0__.PageWithNodes, _index__WEBPACK_IMPORTED_MODULE_0__.PageWithTable, _index__WEBPACK_IMPORTED_MODULE_0__.AutoLeafPageWithNodes, ...(options.pagesNotRequiringUuid || [])]);
let pagesNotRequiringPageParam = new Set([_index__WEBPACK_IMPORTED_MODULE_0__.PageWithNodes, _index__WEBPACK_IMPORTED_MODULE_0__.PageWithTable, _index__WEBPACK_IMPORTED_MODULE_0__.AutoLeafPageWithNodes, ...(options.pagesNotRequiringPageParam || [])]);
let missingUuids = new Set();
let missingPageParams = new Set();
let completePages = new Set();
for (const PageConstructor of _index__WEBPACK_IMPORTED_MODULE_0__.ObjectFactory.get().getSubClassesOf(_index__WEBPACK_IMPORTED_MODULE_0__.Page)) {
let pageType = _index__WEBPACK_IMPORTED_MODULE_0__.ObjectFactory.get().getObjectType(PageConstructor);
if (options.namespace && !pageType.startsWith(options.namespace)) {
continue;
}
let page = new PageConstructor();
page.minimalInit();
// Assert uuid
if (_index__WEBPACK_IMPORTED_MODULE_0__.scout.nvl(options.assertUuid, true) && !page.uuid && !pagesNotRequiringUuid.has(PageConstructor)) {
missingUuids.add(pageType);
}
// Assert pageParam
if (_index__WEBPACK_IMPORTED_MODULE_0__.scout.nvl(options.assertPageParam, true)) {
let pageParamType = `${pageType}ParamDo`;
let PageParam = _index__WEBPACK_IMPORTED_MODULE_0__.TypeDescriptor.resolveType(pageParamType);
if (!PageParam && !pagesNotRequiringPageParam.has(PageConstructor)) {
missingPageParams.add(pageType);
}
}
if (!missingUuids.has(pageType) && !missingPageParams.has(pageType)) {
completePages.add(pageType);
}
}
if (missingUuids.size > 0) {
fail([`Found ${missingUuids.size} pages without a uuid. Please ensure every page has a uuid.`, ...missingUuids].join('\n'));
}
if (missingPageParams.size > 0) {
fail([`Found ${missingPageParams.size} pages without a pageParam.`, 'If a pageParam is required, create one and add `declare pageParam: NewPageParam` to your page.', 'Otherwise, add the page to the ignore list (`options.pagesNotRequiringPageParam`).', ...missingPageParams].join('\n'));
}
if (completePages.size > 0) {
console.log(`PageCompleteness: the following pages are complete: ${Array.from(completePages).join(', ')}`);
}
if (completePages.size === 0 && missingUuids.size === 0 && missingPageParams.size === 0) {
console.log('PageCompleteness: no pages found in this module.');
}
// A test without an expectation logs a warning
expect(true).toBe(true);
}
};
/***/ }),
/***/ "./src/testing/TestingApp.ts":
/*!***********************************!*\
!*** ./src/testing/TestingApp.ts ***!
\***********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ TestingApp: () => (/* binding */ TestingApp)
/* harmony export */ });
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../index */ "../index");
/*
* Copyright (c) 2010, 2024 BSI Business Systems Integration AG
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
class TestingApp extends _index__WEBPACK_IMPORTED_MODULE_0__.RemoteApp {
_defaultValuesBootstrapper() {
// nop for testing
return null;
}
_installErrorHandler() {
// nop for testing
// otherwise, it might overwrite the global error handler of Jasmine which will then not be notified about failing specs.
}
_createSession(options) {
return super._createSession(options);
}
_defaultBootstrappers(options) {
return [_index__WEBPACK_IMPORTED_MODULE_0__.Device.get().bootstrap.bind(_index__WEBPACK_IMPORTED_MODULE_0__.Device.get())];
}
static set(newApp) {
_index__WEBPACK_IMPORTED_MODULE_0__.App._set(newApp);
}
}
/***/ }),
/***/ "./src/testing/desktop/outline/OutlineSpecHelper.ts":
/*!**********************************************************!*\
!*** ./src/testing/desktop/outline/OutlineSpecHelper.ts ***!
\**********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ OutlineSpecHelper: () => (/* binding */ OutlineSpecHelper)
/* harmony export */ });
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../index */ "../index");
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../index */ "./src/testing/index.ts");
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! jquery */ "jquery");
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_2__);
/*
* Copyright (c) 2010, 2025 BSI Business Systems Integration AG
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
class OutlineSpecHelper {
session;
constructor(session) {
this.session = session;
}
createModelFixture(nodeCount, depth, expanded) {
return this.createModel(this.createModelNodes(nodeCount, depth, {
expanded: expanded
}));
}
createModel(nodes) {
let model = createSimpleModel('Outline', this.session);
if (nodes) {
model.nodes = nodes;
}
return model;
}
createModelNode(id, text, model) {
return jquery__WEBPACK_IMPORTED_MODULE_2___default().extend({
id: id || _index__WEBPACK_IMPORTED_MODULE_0__.ObjectIdProvider.get().createUiSeqId(),
text: text
}, model);
}
createModelNodes(nodeCount, depth, model) {
return this.createModelNodesInternal(nodeCount, depth);
}
createModelNodesInternal(nodeCount, depth, parentNode, model) {
if (!nodeCount) {
return;
}
let nodes = [],
nodeId;
if (!depth) {
depth = 0;
}
for (let i = 0; i < nodeCount; i++) {
nodeId = i;
if (parentNode) {
nodeId = parentNode.id + '_' + nodeId;
}
nodes[i] = this.createModelNode(nodeId, 'node ' + i, model);
if (depth > 0) {
nodes[i].childNodes = this.createModelNodesInternal(nodeCount, depth - 1, nodes[i], model);
}
}
return nodes;
}
createOutline(model) {
let defaults = {
parent: this.session.desktop
};
let m = jquery__WEBPACK_IMPORTED_MODULE_2___default().extend({}, defaults, model);
let outline = new _index__WEBPACK_IMPORTED_MODULE_0__.Outline();
outline.init(m);
return outline;
}
createOutlineAdapter(model) {
let outlineAdapter = new _index__WEBPACK_IMPORTED_MODULE_0__.OutlineAdapter();
outlineAdapter.init(model);
return outlineAdapter;
}
/**
* Creates an outline with 3 nodes, the first node has a visible detail form
*/
createOutlineWithOneDetailForm() {
let model = this.createModelFixture(3, 2, true);
let outline = this.createOutline(model);
let node = outline.nodes[0];
node.detailForm = new _index__WEBPACK_IMPORTED_MODULE_1__.FormSpecHelper(this.session).createFormWithOneField({
modal: false
});
node.detailFormVisible = true;
return outline;
}
/**
* Creates an outline with 3 nodes, the first node has a visible detail table
*/
createOutlineWithOneDetailTable() {
let model = this.createModelFixture(3, 2, true);
let outline = this.createOutline(model);
let node = outline.nodes[0];
node.detailTable = new _index__WEBPACK_IMPORTED_MODULE_1__.TableSpecHelper(this.session).createTableWithOneColumn();
node.detailTableVisible = true;
return outline;
}
setMobileFlags(outline) {
outline.setBreadcrumbStyleActive(true);
outline.setToggleBreadcrumbStyleEnabled(false);
outline.setCompact(true);
outline.setEmbedDetailContent(true);
}
}
/***/ }),
/***/ "./src/testing/focus/FocusManagerSpecHelper.ts":
/*!*****************************************************!*\
!*** ./src/testing/focus/FocusManagerSpecHelper.ts ***!
\*****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ FocusManagerSpecHelper: () => (/* binding */ FocusManagerSpecHelper)
/* harmony export */ });
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
/*
* Copyright (c) 2010, 2023 BSI Business Systems Integration AG
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
class FocusManagerSpecHelper {
handlersRegistered($comp) {
let i,
expectedHandlers = ['keydown', 'focusin', 'focusout', 'hide'],
handlerCount = 0,
// @ts-expect-error
events = jquery__WEBPACK_IMPORTED_MODULE_0___default()._data($comp[0], 'events'),
expectedCount = expectedHandlers.length;
if (events) {
for (i = 0; i < expectedCount; i++) {
if (events[expectedHandlers[i]]) {
handlerCount++;
}
}
}
return handlerCount === expectedCount;
}
}
/***/ }),
/***/ "./src/testing/form/FormSpecHelper.ts":
/*!********************************************!*\
!*** ./src/testing/form/FormSpecHelper.ts ***!
\********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ FormSpecHelper: () => (/* binding */ FormSpecHelper)
/* harmony export */ });
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../index */ "./src/testing/index.ts");
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../index */ "../index");
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! jquery */ "jquery");
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_2__);
/*
* Copyright (c) 2010, 2023 BSI Business Systems Integration AG
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
class FormSpecHelper {
session;
constructor(session) {
this.session = session;
}
closeMessageBoxes(option) {
if (!this.session) {
return;
}
let button = option || _index__WEBPACK_IMPORTED_MODULE_1__.MessageBox.Buttons.YES;
this.findMessageBoxes().forEach(messageBox => messageBox.trigger('action', {
option: button
}));
}
findMessageBoxes() {
if (!this.session) {
return new Set();
}
const result = new Set();
if (this.session.$entryPoint) {
// collect rendered MessageBoxes
this.session.$entryPoint.find('.messagebox').get().map(domElement => _index__WEBPACK_IMPORTED_MODULE_1__.scout.widget(domElement, _index__WEBPACK_IMPORTED_MODULE_1__.MessageBox)).filter(messageBox => !!messageBox).forEach(messageBox => result.add(messageBox));
}
// collect the remaining (possibly not rendered) boxes on the Desktop
if (this.session.desktop) {
this.session.desktop.messageBoxes.forEach(messageBox => result.add(messageBox));
}
return result;
}
createViewWithOneField(model) {
let form = this.createFormWithOneField(model);
form.displayHint = _index__WEBPACK_IMPORTED_MODULE_1__.Form.DisplayHint.VIEW;
return form;
}
createFormWithOneField(model) {
let defaults = {
parent: this.session.desktop
};
model = jquery__WEBPACK_IMPORTED_MODULE_2___default().extend({}, defaults, model);
let form = _index__WEBPACK_IMPORTED_MODULE_1__.scout.create(_index__WEBPACK_IMPORTED_MODULE_0__.SpecForm, model);
let rootGroupBox = this.createGroupBoxWithFields(form, 1);
form.setRootGroupBox(rootGroupBox);
return form;
}
createFormWithFieldsAndTabBoxes(model) {
let fieldModelPart = (id, mandatory) => ({
id: id,
objectType: _index__WEBPACK_IMPORTED_MODULE_1__.StringField,
label: id,
mandatory: mandatory
}),
tabBoxModelPart = (id, tabItems) => ({
id: id,
objectType: _index__WEBPACK_IMPORTED_MODULE_1__.TabBox,
tabItems: tabItems
}),
tabItemModelPart = (id, fields) => ({
id: id,
objectType: _index__WEBPACK_IMPORTED_MODULE_1__.TabItem,
label: 'id',
fields: fields
}),
tableFieldModelPart = (id, columns) => ({
id: id,
objectType: _index__WEBPACK_IMPORTED_MODULE_1__.TableField,
label: id,
table: {
id: id + 'Table',
objectType: _index__WEBPACK_IMPORTED_MODULE_1__.Table,
columns: columns
}
}),
columnModelPart = (id, mandatory) => ({
id: id,
objectType: _index__WEBPACK_IMPORTED_MODULE_1__.Column,
text: id,
editable: true,
mandatory: mandatory
});
let defaults = {
parent: this.session.desktop,
id: 'Form',
title: 'Form',
rootGroupBox: {
id: 'RootGroupBox',
objectType: _index__WEBPACK_IMPORTED_MODULE_1__.GroupBox,
fields: [fieldModelPart('Field1', false), fieldModelPart('Field2', false), fieldModelPart('Field3', true), fieldModelPart('Field4', true), tabBoxModelPart('TabBox', [tabItemModelPart('TabA', [fieldModelPart('FieldA1', false), fieldModelPart('FieldA2', true), tabBoxModelPart('TabBoxA', [tabItemModelPart('TabAA', [fieldModelPart('FieldAA1', false), fieldModelPart('FieldAA2', true)]), tabItemModelPart('TabAB', [fieldModelPart('FieldAB1', false), fieldModelPart('FieldAB2', true)]), tabItemModelPart('TabAC', [fieldModelPart('FieldAC1', false), fieldModelPart('FieldAC2', true)])])]), tabItemModelPart('TabB', [fieldModelPart('FieldB1', false), fieldModelPart('FieldB2', false), fieldModelPart('FieldB3', true), fieldModelPart('FieldB4', true), tableFieldModelPart('TableFieldB5', [columnModelPart('ColumnB51', false), columnModelPart('ColumnB52', true)])])])]
}
};
model = jquery__WEBPACK_IMPORTED_MODULE_2___default().extend({}, defaults, model);
let form = _index__WEBPACK_IMPORTED_MODULE_1__.scout.create(_index__WEBPACK_IMPORTED_MODULE_1__.Form, model);
form.widget('TableFieldB5', _index__WEBPACK_IMPORTED_MODULE_1__.TableField).table.insertRows([{
cells: _index__WEBPACK_IMPORTED_MODULE_1__.arrays.init(2, null)
}, {
cells: _index__WEBPACK_IMPORTED_MODULE_1__.arrays.init(2, null)
}]);
return form;
}
createGroupBoxWithOneField(parent) {
return this.createGroupBoxWithFields(parent, 1);
}
createGroupBoxWithFields(parent, numFields) {
parent = _index__WEBPACK_IMPORTED_MODULE_1__.scout.nvl(parent, this.session.desktop);
numFields = _index__WEBPACK_IMPORTED_MODULE_1__.scout.nvl(numFields, 1);
let fields = [],
groupBox = _index__WEBPACK_IMPORTED_MODULE_1__.scout.create(_index__WEBPACK_IMPORTED_MODULE_1__.GroupBox, {
parent: parent
});
for (let i = 0; i < numFields; i++) {
fields.push(_index__WEBPACK_IMPORTED_MODULE_1__.scout.create(_index__WEBPACK_IMPORTED_MODULE_1__.StringField, {
parent: groupBox
}));
}
groupBox.setProperty('fields', fields);
return groupBox;
}
createRadioButtonGroup(parent, numRadioButtons) {
parent = _index__WEBPACK_IMPORTED_MODULE_1__.scout.nvl(parent, this.session.desktop);
numRadioButtons = _index__WEBPACK_IMPORTED_MODULE_1__.scout.nvl(numRadioButtons, 2);
let fields = [];
for (let i = 0; i < numRadioButtons; i++) {
fields.push({
objectType: _index__WEBPACK_IMPORTED_MODULE_1__.RadioButton
});
}
return _index__WEBPACK_IMPORTED_MODULE_1__.scout.create(_index__WEBPACK_IMPORTED_MODULE_0__.SpecRadioButtonGroup, {
parent: parent,
fields: fields
});
}
createFormWithFields(parent, isModal, numFields) {
parent = _index__WEBPACK_IMPORTED_MODULE_1__.scout.nvl(parent, this.session.desktop);
let form = _index__WEBPACK_IMPORTED_MODULE_1__.scout.create(_index__WEBPACK_IMPORTED_MODULE_1__.Form, {
parent: parent,
displayHint: isModal ? 'dialog' : 'view'
});
let rootGroupBox = this.createGroupBoxWithFields(form, numFields);
form.setRootGroupBox(rootGroupBox);
return form;
}
createFieldModel(objectType, parent, modelProperties) {
parent = _index__WEBPACK_IMPORTED_MODULE_1__.scout.nvl(parent, this.session.desktop);
let model = createSimpleModel(objectType || 'StringField', this.session);
model.parent = parent;
if (modelProperties) {
jquery__WEBPACK_IMPORTED_MODULE_2___default().extend(model, modelProperties);
}
return model;
}
createField(objectType, parent, modelProperties) {
return _index__WEBPACK_IMPORTED_MODULE_1__.scout.create(objectType, this.createFieldModel(objectType, parent, modelProperties));
}
createModeSelector(parent, numModes) {
parent = _index__WEBPACK_IMPORTED_MODULE_1__.scout.nvl(parent, this.session.desktop);
numModes = _index__WEBPACK_IMPORTED_MODULE_1__.scout.nvl(numModes, 2);
let modes = [];
for (let i = 0; i < numModes; i++) {
modes.push({
objectType: _index__WEBPACK_IMPORTED_MODULE_1__.Mode
});
}
return _index__WEBPACK_IMPORTED_MODULE_1__.scout.create(_index__WEBPACK_IMPORTED_MODULE_1__.ModeSelector, {
parent: parent,
modes: modes
});
}
}
/***/ }),
/***/ "./src/testing/form/SpecForm.ts":
/*!**************************************!*\
!*** ./src/testing/form/SpecForm.ts ***!
\**************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ SpecForm: () => (/* binding */ SpecForm)
/* harmony export */ });
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../index */ "../index");
/*
* Copyright (c) 2010, 2023 BSI Business Systems Integration AG
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
class SpecForm extends _index__WEBPACK_IMPORTED_MODULE_0__.Form {
_load() {
return super._load();
}
_save(data) {
return super._save(data);
}
_validate() {
return super._validate();
}
_showFormInvalidMessageBox(status) {
return super._showFormInvalidMessageBox(status);
}
_createStatusMessageBox(status) {
return super._createStatusMessageBox(status);
}
}
/***/ }),
/***/ "./src/testing/form/SpecLifecycle.ts":
/*!*******************************************!*\
!*** ./src/testing/form/SpecLifecycle.ts ***!
\*******************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ SpecLifecycle: () => (/* binding */ SpecLifecycle)
/* harmony export */ });
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../index */ "../index");
/*
* Copyright (c) 2010, 2023 BSI Business Systems Integration AG
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
class SpecLifecycle extends _index__WEBPACK_IMPORTED_MODULE_0__.FormLifecycle {
_validate() {
return super._validate();
}
_createInvalidElementsMessageHtml(missing, invalid) {
return super._createInvalidElementsMessageHtml(missing, invalid);
}
}
/***/ }),
/***/ "./src/testing/form/SpecRadioButtonGroup.ts":
/*!**************************************************!*\
!*** ./src/testing/form/SpecRadioButtonGroup.ts ***!
\**************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ SpecRadioButtonGroup: () => (/* binding */ SpecRadioButtonGroup)
/* harmony export */ });
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../index */ "../index");
/*
* Copyright (c) 2010, 2023 BSI Business Systems Integration AG
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
class SpecRadioButtonGroup extends _index__WEBPACK_IMPORTED_MODULE_0__.RadioButtonGroup {
_setGridColumnCount(gridColumnCount) {
return super._setGridColumnCount(gridColumnCount);
}
}
/***/ }),
/***/ "./src/testing/form/fields/CloneSpecHelper.ts":
/*!****************************************************!*\
!*** ./src/testing/form/fields/CloneSpecHelper.ts ***!
\****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ CloneSpecHelper: () => (/* binding */ CloneSpecHelper)
/* harmony export */ });
class CloneSpecHelper {
validateClone(original, clone) {
let properties = Array.from(original.cloneProperties).filter(prop => {
return !original.isWidgetProperty(prop);
});
let widgetProperties = Array.from(original.cloneProperties).filter(prop => {
return original.isWidgetProperty(prop);
});
// simple properties to be cloned
properties.forEach(prop => {
expect(clone[prop]).toBeDefined();
expect(clone[prop]).toBe(original[prop]);
});
// widget properties to be cloned
widgetProperties.forEach(prop => {
expect(clone[prop]).toBeDefined();
expect(clone).toHaveClonedWidgetProperty(original, prop);
});
}
}
/***/ }),
/***/ "./src/testing/form/fields/beanfield/TestBeanField.ts":
/*!************************************************************!*\
!*** ./src/testing/form/fields/beanfield/TestBeanField.ts ***!
\************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ TestBeanField: () => (/* binding */ TestBeanField)
/* harmony export */ });
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../index */ "../index");
/*
* Copyright (c) 2010, 2023 BSI Business Systems Integration AG
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
class TestBeanField extends _index__WEBPACK_IMPORTED_MODULE_0__.BeanField {
_render() {
super._render();
this.$container.addClass('test-bean-field');
}
_renderValue() {
this.$field.empty();
if (!this.value) {
return;
}
this.$field.appendDiv('msg-from').text('Message from ' + this.value.sender);
this.$field.appendDiv('msg-text').textOrNbsp(this.value.message);
}
}
/***/ }),
/***/ "./src/testing/form/fields/groupbox/GroupBoxSpecHelper.ts":
/*!****************************************************************!*\
!*** ./src/testing/form/fields/groupbox/GroupBoxSpecHelper.ts ***!
\****************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ GroupBoxSpecHelper: () => (/* binding */ GroupBoxSpecHelper)
/* harmony export */ });
/*
* Copyright (c) 2010, 2023 BSI Business Systems Integration AG
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
class GroupBoxSpecHelper {
static assertGridData(x, y, w, h, gd) {
expect(gd.x).toEqual(x); // GridData[x]
expect(gd.y).toEqual(y); // GridData[y]
expect(gd.w).toEqual(w); // GridData[w]
expect(gd.h).toEqual(h); // GridData[h]
}
}
/***/ }),
/***/ "./src/testing/form/fields/smartfield/proposalFieldSpecHelper.ts":
/*!***********************************************************************!*\
!*** ./src/testing/form/fields/smartfield/proposalFieldSpecHelper.ts ***!
\***********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ LookupRowSelectionStrategy: () => (/* binding */ LookupRowSelectionStrategy),
/* harmony export */ SpecProposalField: () => (/* binding */ SpecProposalField),
/* harmony export */ SpecSmartFieldTouchPopup: () => (/* binding */ SpecSmartFieldTouchPopup),
/* harmony export */ proposalFieldSpecHelper: () => (/* binding */ proposalFieldSpecHelper)
/* harmony export */ });
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../index */ "../index");
/* harmony import */ var _jquery_testing__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../jquery-testing */ "./src/testing/jquery-testing.ts");
/*
* Copyright (c) 2010, 2025 BSI Business Systems Integration AG
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
const proposalFieldSpecHelper = {
async testProposalFieldInputs(field, inputs, touchMode, callbacks, selectionStrategy) {
field.touchMode = touchMode;
field.render();
callbacks = $.extend({
beforeInput: input => {},
afterInput: input => {},
afterSelectLookupRow: (text, lookupRow) => {},
afterAcceptCustomText: text => {}
}, callbacks);
for (const inputOrText of inputs) {
const input = proposalFieldSpecHelper.ensureInput(inputOrText);
const {
text,
lookup
} = input;
callbacks.beforeInput(input);
if (lookup || selectionStrategy === LookupRowSelectionStrategy.EXACT_TEXT) {
const lookupRow = await proposalFieldSpecHelper.selectLookupRow(field, text, selectionStrategy);
callbacks.afterSelectLookupRow(text, lookupRow);
} else {
await proposalFieldSpecHelper.acceptCustomText(field, text);
callbacks.afterAcceptCustomText(text);
}
callbacks.afterInput(input);
}
},
ensureInput(inputOrText) {
return typeof inputOrText === 'string' ? {
text: inputOrText
} : inputOrText;
},
async acceptCustomText(field, text) {
if (field.touchMode) {
// touchMode opens a popup with a field and a done-menu
const popup = await proposalFieldSpecHelper.openPopup(field);
popup._field.$field.val(text);
popup._field.acceptInput();
popup.doneAction.doAction();
} else {
field.$field.val(text);
await field.acceptInput();
}
},
async selectLookupRow(field, text) {
let strategy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : LookupRowSelectionStrategy.CLICK;
// find row for text
const popup = await proposalFieldSpecHelper.openPopup(field);
const smartField = field.touchMode ? popup._field : popup.smartField;
const proposalChooser = field.touchMode ? popup._widget : popup.proposalChooser;
const table = proposalChooser.content;
const row = table.rows.find(r => r.cells[0].text === text);
switch (strategy) {
case LookupRowSelectionStrategy.CLICK:
{
_jquery_testing__WEBPACK_IMPORTED_MODULE_1__.JQueryTesting.triggerMouseDown(row.$row);
_jquery_testing__WEBPACK_IMPORTED_MODULE_1__.JQueryTesting.triggerMouseUp(row.$row);
break;
}
case LookupRowSelectionStrategy.ENTER:
{
table.selectRow(row);
_jquery_testing__WEBPACK_IMPORTED_MODULE_1__.JQueryTesting.triggerKeyDownCapture(smartField.$field, _index__WEBPACK_IMPORTED_MODULE_0__.keys.ENTER);
break;
}
case LookupRowSelectionStrategy.EXACT_TEXT:
{
smartField.$field.val(text);
let closePromise = popup.when('close');
_jquery_testing__WEBPACK_IMPORTED_MODULE_1__.JQueryTesting.triggerKeyDownCapture(smartField.$field, _index__WEBPACK_IMPORTED_MODULE_0__.keys.ENTER);
await closePromise;
return smartField.lookupRow;
}
}
return row.lookupRow;
},
async openPopup(field) {
field.$field.focus();
await field.openPopup(true);
const popup = field.popup;
popup.animateRemoval = false;
return popup;
}
};
class SpecProposalField extends _index__WEBPACK_IMPORTED_MODULE_0__.ProposalField {
_lookupByTextOrAllDone(result) {
super._lookupByTextOrAllDone(result);
}
_getLastSearchText() {
return super._getLastSearchText();
}
acceptInput(sync) {
this._acceptInputEnabled = true; // accept all inputs, no need for a timeout
return super.acceptInput(sync);
}
_acceptInput(sync, searchText, searchTextEmpty, searchTextChanged, selectedLookupRow) {
return super._acceptInput(sync, searchText, searchTextEmpty, searchTextChanged, selectedLookupRow);
}
}
class SpecSmartFieldTouchPopup extends _index__WEBPACK_IMPORTED_MODULE_0__.SmartFieldTouchPopup {}
var LookupRowSelectionStrategy;
(function (LookupRowSelectionStrategy) {
LookupRowSelectionStrategy[LookupRowSelectionStrategy["CLICK"] = 0] = "CLICK";
LookupRowSelectionStrategy[LookupRowSelectionStrategy["ENTER"] = 1] = "ENTER";
LookupRowSelectionStrategy[LookupRowSelectionStrategy["EXACT_TEXT"] = 2] = "EXACT_TEXT"; // The exact value is typed into the smart field. In combination with the flag lookupOnAcceptByText, the row is selected
})(LookupRowSelectionStrategy || (LookupRowSelectionStrategy = {}));
/***/ }),
/***/ "./src/testing/form/fields/tabbox/TabBoxSpecHelper.ts":
/*!************************************************************!*\
!*** ./src/testing/form/fields/tabbox/TabBoxSpecHelper.ts ***!
\************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ TabBoxSpecHelper: () => (/* binding */ TabBoxSpecHelper)
/* harmony export */ });
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../index */ "../index");
/*
* Copyright (c) 2010, 2023 BSI Business Systems Integration AG
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
class TabBoxSpecHelper {
session;
constructor(session) {
this.session = session;
}
createTabBoxWith2Tabs(model) {
model = jquery__WEBPACK_IMPORTED_MODULE_0___default().extend({
tabItems: [{
objectType: _index__WEBPACK_IMPORTED_MODULE_1__.TabItem,
label: 'first'
}, {
objectType: _index__WEBPACK_IMPORTED_MODULE_1__.TabItem,
label: 'second'
}]
}, model);
return this.createTabBox(model);
}
createTabBoxWith(tabItems) {
tabItems = _index__WEBPACK_IMPORTED_MODULE_1__.scout.nvl(tabItems, []);
return this.createTabBox({
tabItems: tabItems,
selectedTab: tabItems[0]
});
}
createTabBox(model) {
model = jquery__WEBPACK_IMPORTED_MODULE_0___default().extend({
parent: this.session.desktop
}, model);
return _index__WEBPACK_IMPORTED_MODULE_1__.scout.create(_index__WEBPACK_IMPORTED_MODULE_1__.TabBox, model);
}
createTabItem(model) {
model = jquery__WEBPACK_IMPORTED_MODULE_0___default().extend({
parent: this.session.desktop
}, model);
return _index__WEBPACK_IMPORTED_MODULE_1__.scout.create(_index__WEBPACK_IMPORTED_MODULE_1__.TabItem, model);
}
}
/***/ }),
/***/ "./src/testing/index.ts":
/*!*******************