Best JavaScript code snippet using ng-mocks
tbPersonnelIntroduction_TabStripMenus_Operations.js
Source:tbPersonnelIntroduction_TabStripMenus_Operations.js
...24 var selectedPersonnel_Personnel = GridPersonnel_Personnel.getSelectedItems()[0];25 if (selectedPersonnel_Personnel != undefined) {26 CurrentStateObj_Personnel.PageState = CurrentPageState_Personnel;27 CurrentStateObj_Personnel.PageSize = document.getElementById('hfPersonnelPageSize_Personnel').value;28 CurrentStateObj_Personnel.PersonnelID = selectedPersonnel_Personnel.getMember('ID').get_text();29 CurrentStateObj_Personnel.IsActive = selectedPersonnel_Personnel.getMember('Active').get_text();30 CurrentStateObj_Personnel.FirstName = selectedPersonnel_Personnel.getMember('FirstName').get_text();31 CurrentStateObj_Personnel.LastName = selectedPersonnel_Personnel.getMember('LastName').get_text();32 CurrentStateObj_Personnel.SexID = selectedPersonnel_Personnel.getMember('Sex').get_text();33 CurrentStateObj_Personnel.SexTitle = selectedPersonnel_Personnel.getMember('SexTitle').get_text();34 CurrentStateObj_Personnel.FatherName = selectedPersonnel_Personnel.getMember('PersonDetail.FatherName').get_text();35 CurrentStateObj_Personnel.NationalCode = selectedPersonnel_Personnel.getMember('PersonDetail.MeliCode').get_text();36 CurrentStateObj_Personnel.MilitaryState = selectedPersonnel_Personnel.getMember('PersonDetail.MilitaryStatus').get_text();37 CurrentStateObj_Personnel.MilitaryStateTitle = selectedPersonnel_Personnel.getMember('PersonDetail.MilitaryStatusTitle').get_text();38 CurrentStateObj_Personnel.IdentityCertificate = selectedPersonnel_Personnel.getMember('PersonDetail.BirthCertificate').get_text();39 CurrentStateObj_Personnel.IssuanceLocation = selectedPersonnel_Personnel.getMember('PersonDetail.PlaceIssued').get_text();40 CurrentStateObj_Personnel.Education = selectedPersonnel_Personnel.getMember('Education').get_text();41 CurrentStateObj_Personnel.MarriageStateID = selectedPersonnel_Personnel.getMember('MaritalStatus').get_text();42 CurrentStateObj_Personnel.MarriageStateTitle = selectedPersonnel_Personnel.getMember('MaritalStatusTitle').get_text();43 CurrentStateObj_Personnel.State = selectedPersonnel_Personnel.getMember('PersonDetail.Status').get_text();44 CurrentStateObj_Personnel.Tel = selectedPersonnel_Personnel.getMember('PersonDetail.Tel').get_text();45 CurrentStateObj_Personnel.Address = selectedPersonnel_Personnel.getMember('PersonDetail.Address').get_text();46 CurrentStateObj_Personnel.BirthLocation = selectedPersonnel_Personnel.getMember('PersonDetail.BirthPlace').get_text();47 CurrentStateObj_Personnel.BirthDate = CheckDate_PersonnelMainInformation(selectedPersonnel_Personnel.getMember('PersonDetail.UIBirthDate').get_text());48 CurrentStateObj_Personnel.PersonnelNumber = selectedPersonnel_Personnel.getMember('PersonCode').get_text();49 CurrentStateObj_Personnel.CardNumber = selectedPersonnel_Personnel.getMember('CardNum').get_text();50 CurrentStateObj_Personnel.DepartmentID = selectedPersonnel_Personnel.getMember('Department.ID').get_text();51 CurrentStateObj_Personnel.DepartmentName = selectedPersonnel_Personnel.getMember('Department.Name').get_text();52 CurrentStateObj_Personnel.OrganizationPostID = selectedPersonnel_Personnel.getMember('OrganizationUnit.ID').get_text();53 CurrentStateObj_Personnel.OrganizationPostName = selectedPersonnel_Personnel.getMember('OrganizationUnit.Name').get_text();54 CurrentStateObj_Personnel.OrganizationPostCustomCode = selectedPersonnel_Personnel.getMember('OrganizationUnit.CustomCode').get_text();55 CurrentStateObj_Personnel.ParentOrganizationPostID = selectedPersonnel_Personnel.getMember('OrganizationUnit.ParentID').get_text();56 CurrentStateObj_Personnel.CurrentActiveWorkGroup = selectedPersonnel_Personnel.getMember('CurrentActiveWorkGroup').get_text();57 CurrentStateObj_Personnel.CurrentActiveRuleGroup = selectedPersonnel_Personnel.getMember('CurrentActiveRuleGroup').get_text();58 CurrentStateObj_Personnel.ControlStationID = selectedPersonnel_Personnel.getMember('ControlStation.ID').get_text();59 CurrentStateObj_Personnel.ControlStationName = selectedPersonnel_Personnel.getMember('ControlStation.Name').get_text();60 CurrentStateObj_Personnel.EmployNumber = selectedPersonnel_Personnel.getMember('EmploymentNum').get_text();61 CurrentStateObj_Personnel.EmployTypeID = selectedPersonnel_Personnel.getMember('EmploymentType.ID').get_text();62 CurrentStateObj_Personnel.EmployTypeName = selectedPersonnel_Personnel.getMember('EmploymentType.Name').get_text();63 CurrentStateObj_Personnel.EmployDate = CheckDate_PersonnelMainInformation(selectedPersonnel_Personnel.getMember('UIEmploymentDate').get_text());64 CurrentStateObj_Personnel.EmployEndDate = CheckDate_PersonnelMainInformation(selectedPersonnel_Personnel.getMember('UIEndEmploymentDate').get_text());65 CurrentStateObj_Personnel.CalculationRangeID = selectedPersonnel_Personnel.getMember('CurrentRangeAssignment.CalcDateRangeGroup.ID').get_text();66 CurrentStateObj_Personnel.CalculationRangeName = selectedPersonnel_Personnel.getMember('CurrentRangeAssignment.CalcDateRangeGroup.Name').get_text();67 CurrentStateObj_Personnel.RunFromDate = selectedPersonnel_Personnel.getMember('CurrentRangeAssignment.UIFromDate').get_text();68 CurrentStateObj_Personnel.UserInterfaceRuleGroupID = selectedPersonnel_Personnel.getMember('UIValidationGroup.ID').get_text();69 CurrentStateObj_Personnel.UserInterfaceRuleGroupName = selectedPersonnel_Personnel.getMember('UIValidationGroup.Name').get_text();70 CurrentStateObj_Personnel.Reserve1 = selectedPersonnel_Personnel.getMember('PersonDetail.R1').get_text();71 CurrentStateObj_Personnel.Reserve1Title = selectedPersonnel_Personnel.getMember('PersonDetail.R1Title').get_text();72 CurrentStateObj_Personnel.Reserve2 = selectedPersonnel_Personnel.getMember('PersonDetail.R2').get_text();73 CurrentStateObj_Personnel.Reserve2Title = selectedPersonnel_Personnel.getMember('PersonDetail.R2Title').get_text();74 CurrentStateObj_Personnel.Reserve3 = selectedPersonnel_Personnel.getMember('PersonDetail.R3').get_text();75 CurrentStateObj_Personnel.Reserve3Title = selectedPersonnel_Personnel.getMember('PersonDetail.R3Title').get_text();76 CurrentStateObj_Personnel.Reserve4 = selectedPersonnel_Personnel.getMember('PersonDetail.R4').get_text();77 CurrentStateObj_Personnel.Reserve4Title = selectedPersonnel_Personnel.getMember('PersonDetail.R4Title').get_text();78 CurrentStateObj_Personnel.Reserve5 = selectedPersonnel_Personnel.getMember('PersonDetail.R5').get_text();79 CurrentStateObj_Personnel.Reserve5Title = selectedPersonnel_Personnel.getMember('PersonDetail.R5Title').get_text();80 CurrentStateObj_Personnel.Reserve6 = selectedPersonnel_Personnel.getMember('PersonDetail.R6').get_text();81 CurrentStateObj_Personnel.Reserve6Title = selectedPersonnel_Personnel.getMember('PersonDetail.R6Title').get_text();82 CurrentStateObj_Personnel.Reserve7 = selectedPersonnel_Personnel.getMember('PersonDetail.R7').get_text();83 CurrentStateObj_Personnel.Reserve7Title = selectedPersonnel_Personnel.getMember('PersonDetail.R7Title').get_text();84 CurrentStateObj_Personnel.Reserve8 = selectedPersonnel_Personnel.getMember('PersonDetail.R8').get_text();85 CurrentStateObj_Personnel.Reserve8Title = selectedPersonnel_Personnel.getMember('PersonDetail.R8Title').get_text();86 CurrentStateObj_Personnel.Reserve9 = selectedPersonnel_Personnel.getMember('PersonDetail.R9').get_text();87 CurrentStateObj_Personnel.Reserve9Title = selectedPersonnel_Personnel.getMember('PersonDetail.R9Title').get_text();88 CurrentStateObj_Personnel.Reserve10 = selectedPersonnel_Personnel.getMember('PersonDetail.R10').get_text();89 CurrentStateObj_Personnel.Reserve10Title = selectedPersonnel_Personnel.getMember('PersonDetail.R10Title').get_text();90 CurrentStateObj_Personnel.Reserve11 = selectedPersonnel_Personnel.getMember('PersonDetail.R11').get_text();91 CurrentStateObj_Personnel.Reserve11Title = selectedPersonnel_Personnel.getMember('PersonDetail.R11Title').get_text();92 CurrentStateObj_Personnel.Reserve12 = selectedPersonnel_Personnel.getMember('PersonDetail.R12').get_text();93 CurrentStateObj_Personnel.Reserve12Title = selectedPersonnel_Personnel.getMember('PersonDetail.R12Title').get_text();94 CurrentStateObj_Personnel.Reserve13 = selectedPersonnel_Personnel.getMember('PersonDetail.R13').get_text();95 CurrentStateObj_Personnel.Reserve13Title = selectedPersonnel_Personnel.getMember('PersonDetail.R13Title').get_text();96 CurrentStateObj_Personnel.Reserve14 = selectedPersonnel_Personnel.getMember('PersonDetail.R14').get_text();97 CurrentStateObj_Personnel.Reserve14Title = selectedPersonnel_Personnel.getMember('PersonDetail.R14Title').get_text();98 CurrentStateObj_Personnel.Reserve15 = selectedPersonnel_Personnel.getMember('PersonDetail.R15').get_text();99 CurrentStateObj_Personnel.Reserve15Title = selectedPersonnel_Personnel.getMember('PersonDetail.R15Title').get_text();100 CurrentStateObj_Personnel.Reserve16 = selectedPersonnel_Personnel.getMember('PersonDetail.R16').get_text();101 CurrentStateObj_Personnel.Reserve16Title = selectedPersonnel_Personnel.getMember('PersonDetail.R16Title').get_text();102 CurrentStateObj_Personnel.Reserve17 = selectedPersonnel_Personnel.getMember('PersonDetail.R17').get_text();103 CurrentStateObj_Personnel.Reserve17Title = selectedPersonnel_Personnel.getMember('PersonDetail.R17Title').get_text();104 CurrentStateObj_Personnel.Reserve18 = selectedPersonnel_Personnel.getMember('PersonDetail.R18').get_text();105 CurrentStateObj_Personnel.Reserve18Title = selectedPersonnel_Personnel.getMember('PersonDetail.R18Title').get_text();106 CurrentStateObj_Personnel.Reserve19 = selectedPersonnel_Personnel.getMember('PersonDetail.R19').get_text();107 CurrentStateObj_Personnel.Reserve19Title = selectedPersonnel_Personnel.getMember('PersonDetail.R19Title').get_text();108 CurrentStateObj_Personnel.Reserve20 = selectedPersonnel_Personnel.getMember('PersonDetail.R20').get_text();109 CurrentStateObj_Personnel.Reserve20Title = selectedPersonnel_Personnel.getMember('PersonDetail.R20Title').get_text();110 parent.DialogPersonnelMainInformation.set_value(CurrentStateObj_Personnel);111 parent.DialogPersonnelMainInformation.Show();112 }113 }114}115function CheckDate_PersonnelMainInformation(date) {116 if (document.getElementById('hfBaseDateString_Personnel').value != date)117 return date;118 else119 return "";120}121function ShowDialogPersonnelSearch(state) {122 var ObjDialogPersonnelSearch = new Object();123 ObjDialogPersonnelSearch.Caller = state;124 parent.DialogPersonnelSearch.set_value(ObjDialogPersonnelSearch);125 parent.DialogPersonnelSearch.Show();126}127function tlbItemNew_TlbPersonnel_onClick() {128 CurrentPageState_Personnel = 'Add';129 ShowDialogPersonnelMainInformation();130}131function tlbItemEdit_TlbPersonnel_onClick() {132 CurrentPageState_Personnel = 'Edit';133 ShowDialogPersonnelMainInformation();134}135function tlbItemDelete_TlbPersonnel_onClick() {136 CurrentPageState_Personnel = 'Delete';137 ShowDialogConfirm('Delete');138}139function tlbItemExit_TlbPersonnel_onClick() {140 ShowDialogConfirm('Exit');141}142function tlbItemSearch_TlbPersonnel_onClick() {143 LoadState_Personnel = 'AdvancedSearch';144 ShowDialogPersonnelSearch('MasterPersonnel');145}146function tlbItemSearch_TlbPersonnelQuickSearch_onClick() {147 LoadState_Personnel = 'Search';148 SetPageIndex_GridPersonnel_Personnel(0);149}150function Refresh_GridPersonnel_Personnel() {151 LoadState_Personnel = 'Normal';152 SetPageIndex_GridPersonnel_Personnel(0);153}154function Fill_GridPersonnel_Personnel(pageIndex) {155 document.getElementById('loadingPanel_GridPersonnel_Personnel').innerHTML = document.getElementById('hfloadingPanel_GridPersonnel_Personnel').value;156 var pageSize = parseInt(document.getElementById('hfPersonnelPageSize_Personnel').value);157 switch (LoadState_Personnel) {158 case 'Normal':159 CallBack_GridPersonnel_Personnel.callback(CharToKeyCode_Personnel(LoadState_Personnel), CharToKeyCode_Personnel(pageSize.toString()), CharToKeyCode_Personnel(pageIndex.toString())); 160 break;161 case 'Search':162 var seachTerm = document.getElementById('txtSerchTerm_Personnel').value;163 CallBack_GridPersonnel_Personnel.callback(CharToKeyCode_Personnel(LoadState_Personnel), CharToKeyCode_Personnel(pageSize.toString()), CharToKeyCode_Personnel(pageIndex.toString()), CharToKeyCode_Personnel(seachTerm));164 break;165 case 'AdvancedSearch':166 var seachTerm = AdvancedSearchTerm_Personnel;167 CallBack_GridPersonnel_Personnel.callback(CharToKeyCode_Personnel(LoadState_Personnel), CharToKeyCode_Personnel(pageSize.toString()), CharToKeyCode_Personnel(pageIndex.toString()), CharToKeyCode_Personnel(seachTerm));168 break;169 }170}171function Fill_GridPersonnel_Personnel_onPersonnelOperationCompleted(pageState, RetMessage) {172 switch (pageState) {173 case 'Add':174 var pageCount = parseInt(RetMessage[4]);175 SetPageIndex_GridPersonnel_Personnel(pageCount - 1);176 break;177 case 'Edit':178 SetPageIndex_GridPersonnel_Personnel(CurrentPageIndex_GridPersonnel_Personnel);179 break;180 }181 showDialog(RetMessage[0], RetMessage[1], RetMessage[2]); 182}183function GridPersonnel_Personnel_onLoad(sender, e) {184 document.getElementById('loadingPanel_GridPersonnel_Personnel').innerHTML = '';185}186function CallBack_GridPersonnel_Personnel_onCallbackComplete(sender, e) {187 var error = document.getElementById('ErrorHiddenField_Personnel').value;188 if (error != "") {189 var errorParts = eval('(' + error + ')');190 if (errorParts[3] == 'Reload')191 SetPageIndex_GridPersonnel_Personnel(0);192 else193 showDialog(errorParts[0], errorParts[1], errorParts[2]); 194 }195 else 196 Changefooter_GridPersonnel_Personnel();197}198function Changefooter_GridPersonnel_Personnel() {199 var retfooterVal = '';200 var footerVal = document.getElementById('footer_GridPersonnel_Personnel').innerHTML;201 var footerValCol = footerVal.split(' ');202 for (var i = 0; i < footerValCol.length; i++) {203 if (i == 1)204 footerValCol[i] = parseInt(document.getElementById('hfPersonnelPageCount_Personnel').value) > 0 ? CurrentPageIndex_GridPersonnel_Personnel + 1 : 0;205 if (i == 3)206 footerValCol[i] = document.getElementById('hfPersonnelPageCount_Personnel').value;207 retfooterVal += footerValCol[i] + ' ';208 }209 document.getElementById('footer_GridPersonnel_Personnel').innerHTML = retfooterVal;210 document.getElementById('lblPersonnelCount_Personnel').innerHTML = OriginalText_lblPersonnelCount_Personnel + ' ' + document.getElementById('hfPersonnelCount_Personnel').value;211}212function GetSexTitle_Personnel(sex) {213 var SexList = document.getElementById('hfSexList_Personnel').value.split('#');214 for (var i = 0; i < SexList.length; i++) {215 var sexObj = SexList[i].split(':');216 if (sexObj.length > 1) {217 if (sexObj[1] == sex.toString())218 return sexObj[0];219 }220 }221}222function GetMilitaryStatusTitle_Personnel(MilitaryStatus) {223 var MilitaryStatusList = document.getElementById('hfMilitaryStatusList_Personnel').value.split('#');224 for (var i = 0; i < MilitaryStatusList.length; i++) {225 var militaryStatusObj = MilitaryStatusList[i].split(':');226 if (militaryStatusObj.length > 1) {227 if (militaryStatusObj[1] == MilitaryStatus.toString())228 return militaryStatusObj[0];229 }230 }231}232function tlbItemRefresh_TlbPaging_GridPersonnel_Personnel_onClick() {233 Refresh_GridPersonnel_Personnel();234}235function tlbItemFirst_TlbPaging_GridPersonnel_Personnel_onClick() {236 SetPageIndex_GridPersonnel_Personnel(0);237}238function tlbItemBefore_TlbPaging_GridPersonnel_Personnel_onClick() {239 if (CurrentPageIndex_GridPersonnel_Personnel != 0) {240 CurrentPageIndex_GridPersonnel_Personnel = CurrentPageIndex_GridPersonnel_Personnel - 1;241 SetPageIndex_GridPersonnel_Personnel(CurrentPageIndex_GridPersonnel_Personnel);242 }243}244function tlbItemNext_TlbPaging_GridPersonnel_Personnel_onClick() {245 if (CurrentPageIndex_GridPersonnel_Personnel < parseInt(document.getElementById('hfPersonnelPageCount_Personnel').value) - 1) {246 CurrentPageIndex_GridPersonnel_Personnel = CurrentPageIndex_GridPersonnel_Personnel + 1;247 SetPageIndex_GridPersonnel_Personnel(CurrentPageIndex_GridPersonnel_Personnel);248 }249}250function tlbItemLast_TlbPaging_GridPersonnel_Personnel_onClick() {251 SetPageIndex_GridPersonnel_Personnel(parseInt(document.getElementById('hfPersonnelPageCount_Personnel').value) - 1);252}253function SetPageIndex_GridPersonnel_Personnel(pageIndex) {254 CurrentPageIndex_GridPersonnel_Personnel = pageIndex;255 Fill_GridPersonnel_Personnel(pageIndex);256}257function GetMaritalStatusTitle_Personnel(MaritalStatus) {258 var MaritalStatusList = document.getElementById('hfMaritalStatusList_Personnel').value.split('#');259 for (var i = 0; i < MaritalStatusList.length; i++) {260 var maritalStatusObj = MaritalStatusList[i].split(':');261 if (maritalStatusObj.length > 1) {262 if (maritalStatusObj[1] == MaritalStatus.toString())263 return maritalStatusObj[0];264 }265 }266}267function tlbItemOk_TlbOkConfirm_onClick() {268 switch (ConfirmState_Personnel) {269 case 'Delete':270 DialogConfirm.Close();271 UpdatePersonnel_Personnel();272 break;273 case 'Exit':274 parent.CloseCurrentTabOnTabStripMenus();275 break;276 default:277 }278}279function tlbItemCancel_TlbCancelConfirm_onClick() {280 DialogConfirm.Close();281 CurrentPageState_Personnel = 'View';282}283function CharToKeyCode_Personnel(str) {284 var OutStr = '';285 if (str != null && str != undefined) {286 for (var i = 0; i < str.length; i++) {287 var KeyCode = str.charCodeAt(i);288 var CharKeyCode = '//' + KeyCode;289 OutStr += CharKeyCode;290 }291 }292 return OutStr;293}294function UpdatePersonnel_Personnel() {295 ObjPersonnel_Personnel = new Object();296 ObjPersonnel_Personnel.ID = '0';297 var SelectedPersonnel_Personnel = GridPersonnel_Personnel.getSelectedItems();298 if (SelectedPersonnel_Personnel.length > 0)299 ObjPersonnel_Personnel.ID = SelectedPersonnel_Personnel[0].getMember('ID').get_text();300 UpdatePersonnel_PersonnelPage(CharToKeyCode_Personnel(CurrentPageState_Personnel), CharToKeyCode_Personnel(ObjPersonnel_Personnel.ID));301}302function UpdatePersonnel_PersonnelPage_onCallBack(Response) {303 var RetMessage = Response;304 if (RetMessage != null && RetMessage.length > 0) {305 if (Response[1] == "ConnectionError") {306 Response[0] = document.getElementById('hfErrorType_Personnel').value;307 Response[1] = document.getElementById('hfConnectionError_Personnel').value;308 }309 showDialog(RetMessage[0], Response[1], RetMessage[2]);310 if (RetMessage[2] == 'success') {311 Personnel_OnAfterUpdate(Response);312 CurrentPageState_Personnel = 'View';313 }...
utilsCdm-dbg.js
Source:utilsCdm-dbg.js
2 "sap/ushell/utils"3], function (oUshellUtils) {4 "use strict";5 function getMember (oObject, sAccessPath) {6 return oUshellUtils.getMember(oObject, sAccessPath);7 }8 function mapOne(sKey, oSrc, oApp) {9 oSrc = oUshellUtils.clone(oSrc); // do not modify input parameters10 oApp = oUshellUtils.clone(oApp); // do not modify input parameters11 var oInbound = {};12 oInbound.semanticObject = oSrc.semanticObject;13 oInbound.action = oSrc.action;14 oInbound.title = oSrc.title || getMember(oApp, "sap|app.title");15 oInbound.info = oSrc.info || getMember(oApp, "sap|app.info");16 oInbound.icon = oSrc.icon || getMember(oApp, "sap|ui.icons.icon");17 oInbound.subTitle = oSrc.subTitle || getMember(oApp, "sap|app.subTitle");18 oInbound.shortTitle = oSrc.shortTitle || getMember(oApp, "sap|app.shortTitle");19 var sTileSize,20 sTileDescription,21 sTileTechnicalInformation,22 oTargetOutbound,23 oDataSource,24 sAppId,25 bIsCustomTile = false;26 var oSapPlatformRuntime = getMember(oApp, "sap|platform|runtime");27 oInbound.resolutionResult = jQuery.extend(true, {}, oSapPlatformRuntime);28 if (oSapPlatformRuntime) {29 oInbound.resolutionResult["sap.platform.runtime"] = jQuery.extend(true, {}, oSapPlatformRuntime);30 }31 // copy a GUI/WDA namespace if provided32 if (getMember(oApp, "sap|ui.technology") === "GUI") {33 oInbound.resolutionResult["sap.gui"] = getMember(oApp, "sap|gui");34 }35 if (getMember(oApp, "sap|ui.technology") === "WDA") {36 oInbound.resolutionResult["sap.wda"] = getMember(oApp, "sap|wda");37 }38 if (getMember(oApp, "sap|ui.technology") === "URL") {39 if (oApp["sap.url"]) {40 oInbound.resolutionResult["sap.platform.runtime"] = oInbound.resolutionResult["sap.platform.runtime"] || {};41 oInbound.resolutionResult.url = oApp["sap.url"].uri;42 oInbound.resolutionResult["sap.platform.runtime"].url = oApp["sap.url"].uri;43 } else if (oSapPlatformRuntime && oSapPlatformRuntime.uri) {44 oInbound.resolutionResult["sap.platform.runtime"].url = oSapPlatformRuntime.uri;45 oInbound.resolutionResult.url = oSapPlatformRuntime.uri;46 }47 }48 oInbound.resolutionResult.applicationType = this._formatApplicationType(oInbound.resolutionResult, oApp);49 // Forward the name of the systemAlias used to interpolate the URL50 // ClientSideTargetResolution will de-interpolate the URL before applying sap-system51 oInbound.resolutionResult.systemAlias = oInbound.resolutionResult.systemAlias || oSrc.systemAlias; // NOTE: "" is the local system alias52 // In the CDM platform the "systemAlias" value is meant as: "apply this53 // system alias to the resolved URL if no sap-system is given".54 oInbound.resolutionResult.systemAliasSemantics = "apply";55 oInbound.resolutionResult.text = oInbound.title;56 oInbound.deviceTypes = getMember(oApp, "sap|ui.deviceTypes") || {};57 // if not supplied, default is true (!)58 ["desktop", "tablet", "phone"].forEach(function(sMember) {59 // we overwrite member by member if deviceType specified in oSrc!60 if (Object.prototype.hasOwnProperty.call(oSrc.deviceTypes || {}, sMember)) {61 oInbound.deviceTypes[sMember] = oSrc.deviceTypes[sMember];62 }63 if (!Object.prototype.hasOwnProperty.call(oInbound.deviceTypes, sMember)) {64 oInbound.deviceTypes[sMember] = true;65 }66 oInbound.deviceTypes[sMember] = !!oInbound.deviceTypes[sMember];67 });68 // signature69 oInbound.signature = oSrc.signature || {};70 oInbound.signature.parameters = oInbound.signature.parameters || {};71 oInbound.signature.additionalParameters = (oSrc.signature || {}).additionalParameters || "allowed";72 var indicatorDataSource = oSrc.indicatorDataSource || getMember(oApp, "sap|app.crossNavigation.inbounds."+sKey+".indicatorDataSource");73 var oTempTileComponent = indicatorDataSource ? "#Shell-dynamicTile" : "#Shell-staticTile";74 if (getMember(oApp, "sap|app.type") === "tile" || getMember(oApp, "sap|flp.type") === "tile") {75 // this is a custom tile76 oTempTileComponent = oInbound.resolutionResult;77 oTempTileComponent.url = getMember(oApp, "sap|platform|runtime.componentProperties.url");78 oTempTileComponent.componentName = getMember(oApp, "sap|ui5.componentName");79 if (getMember(oApp,"sap|platform|runtime.includeManifest")) {80 // with includeManifest the server specifies that the application from CDM site81 // includes the entire manifest (App Descriptor) properties and can directly82 // be used for instantiation of the tile83 oTempTileComponent.componentProperties = oTempTileComponent.componentProperties || {};84 oTempTileComponent.componentProperties.manifest = jQuery.extend(true, {}, oApp);85 // sap.platform.runtime needs to be removed because it is added by the server86 // and is not part of the actual App Descriptor schema!87 delete oTempTileComponent.componentProperties.manifest["sap.platform.runtime"];88 }89 oTargetOutbound = getMember(oApp, "sap|app.crossNavigation.outbounds.target");90 bIsCustomTile = true;91 }92 if (getMember(oApp, "sap|app.type") === "plugin" || getMember(oApp, "sap|flp.type") === "plugin") {93 return undefined;94 }95 if (getMember(oApp, "sap|flp.tileSize")) {96 sTileSize = getMember(oApp, "sap|flp.tileSize");97 }98 if (getMember(oApp, "sap|app.description")) {99 sTileDescription = getMember(oApp, "sap|app.description");100 }101 if (getMember(oApp, "sap|ui.technology") === "GUI" && getMember(oApp, "sap|gui.transaction")){102 sTileTechnicalInformation = getMember(oApp, "sap|gui.transaction");103 }104 if (getMember(oApp, "sap|ui.technology") === "WDA" &&105 getMember(oApp, "sap|wda.applicationId")){106 sTileTechnicalInformation = getMember(oApp, "sap|wda.applicationId");107 }108 if(getMember(oApp, "sap|app.dataSources")) {109 oDataSource = getMember(oApp, "sap|app.dataSources")110 }111 if(getMember(oApp, "sap|app.id")) {112 sAppId = getMember(oApp, "sap|app.id");113 }114 oInbound.tileResolutionResult = {115 appId: sAppId,116 title: oInbound.title,117 subTitle: oInbound.subTitle,118 icon: oInbound.icon,119 size: sTileSize,120 info: oInbound.info,121 tileComponentLoadInfo: oTempTileComponent,122 indicatorDataSource: indicatorDataSource,123 dataSources: oDataSource,124 description : sTileDescription,125 technicalInformation : sTileTechnicalInformation,126 deviceTypes: oInbound.deviceTypes127 };128 oInbound.tileResolutionResult.isCustomTile = bIsCustomTile;129 if (oTargetOutbound) {130 oInbound.tileResolutionResult.targetOutbound = oTargetOutbound;131 }132 return oInbound;133 }134 /**135 * Extracts a valid <code>applicationType</code> field for136 * ClientSideTargetResolution from the site application resolution result.137 *138 * @param {object} oResolutionResult139 * The application resolution result. An object like:140 * <pre>141 * {142 * "sap.platform.runtime": { ... },143 * "sap.gui": { ... } // or "sap.wda" for wda applications144 * }145 * </pre>146 * @param {object} oApp147 * A site application object148 *149 * @returns {string}150 * One of the following application types compatible with151 * ClientSideTargetResolution service: "TR", "SAPUI5", "WDA", "URL".152 */153 function formatApplicationType (oResolutionResult, oApp) {154 var sApplicationType = oResolutionResult.applicationType;155 if (sApplicationType) {156 return sApplicationType;157 }158 var sComponentName = getMember(oApp, "sap|platform|runtime.componentProperties.self.name") || getMember(oApp, "sap|ui5.componentName");159 if (getMember(oApp, "sap|flp.appType") === "UI5" ||160 getMember(oApp, "sap|ui.technology") === "UI5") {161 oResolutionResult.applicationType = "SAPUI5";162 oResolutionResult.additionalInformation = "SAPUI5.Component=" + sComponentName;163 oResolutionResult.url = getMember(oApp, "sap|platform|runtime.componentProperties.url");164 oResolutionResult.applicationDependencies = getMember(oApp, "sap|platform|runtime.componentProperties");165 return "SAPUI5";166 }167 if (getMember(oApp, "sap|ui.technology") === "GUI") {168 oResolutionResult.applicationType = "TR";169 //oResult.url = getMember(oApp,"sap|platform|runtime.uri");170 oResolutionResult["sap.gui"] = getMember(oApp, "sap|gui");171 oResolutionResult.systemAlias = getMember(oApp, "sap|app.destination.name");172 return "TR";173 }174 if (getMember(oApp, "sap|ui.technology") === "WDA") {175 oResolutionResult.applicationType = "WDA";176 //oResult.url = getMember(oApp,"sap|platform|runtime.uri");177 oResolutionResult["sap.wda"] = getMember(oApp, "sap|wda");178 oResolutionResult.systemAlias = getMember(oApp, "sap|app.destination.name");179 return "WDA";180 }181 if (getMember(oApp, "sap|ui.technology") === "URL") {182 oResolutionResult.applicationType = "URL";183 oResolutionResult.systemAlias = getMember(oApp, "sap|app.destination.name");184 }185 return "URL";186 }187 /**188 * Formats the target mappings contained in the CDM site projection into inbounds189 *190 * @param {object} oSite191 * the CDM site projection192 *193 * @return {object[]}194 * <p>195 * an array of inbounds suitable for ClientSideTargetResolution service196 * consumption.197 * </p>198 */199 function formatSite (oSite) {200 var that = this;201 if (!oSite) {202 return [];203 }204 var aInbounds = [];205 try {206 var aSiteApplications = Object.keys(oSite.applications || {}).sort();207 aSiteApplications.forEach(function(sApplicationKey) {208 try {209 var oApp = oSite.applications[sApplicationKey];210 var oApplicationInbounds = getMember(oApp, "sap|app.crossNavigation.inbounds");211 if (oApplicationInbounds) {212 var lst2 = Object.keys(oApplicationInbounds).sort();213 lst2.forEach(function(sInboundKey) {214 var oInbound = oApplicationInbounds[sInboundKey];215 var r = that.mapOne(sInboundKey, oInbound, oApp);216 if (r) {217 aInbounds.push(r);218 }219 });220 }221 } catch (oError1) {222 // this is here until validation on the CDM site is done223 jQuery.sap.log.error(224 "Error in application " + sApplicationKey + ": " + oError1,...
Using AI Code Generation
1import {getMember} from 'ng-mocks';2import {MockBuilder} from 'ng-mocks';3import {MockRender} from 'ng-mocks';4import {MockInstance} from 'ng-mocks';5describe('AppComponent', () => {6 MockBuilder(AppComponent);7 MockInstance(WelcomeService, 'welcome', () => 'Hello World');8 const fixture = MockRender(AppComponent);9 const component = getMember(fixture.debugElement.componentInstance, 'component');10 const title = getMember(component, 'title');11 const welcomeService = getMember(component, 'welcomeService');12 it('should create the app', () => {13 expect(component).toBeTruthy();14 });15 it(`should have as title 'ng-mocks'`, () => {16 expect(title).toEqual('ng-mocks');17 });18 it('should render title', () => {19 fixture.detectChanges();20 const compiled = fixture.debugElement.nativeElement;21 expect(compiled.querySelector('.content span').textContent).toContain('ng-mocks app is running!');22 });23 it('should render welcome', () => {24 fixture.detectChanges();25 const compiled = fixture.debugElement.nativeElement;26 expect(compiled.querySelector('.content p').textContent).toContain('Hello World');27 });28});29import { Component, OnInit } from '@angular/core';30import { WelcomeService } from './welcome.service';31@Component({32})33export class AppComponent implements OnInit {34 title = 'ng-mocks';35 welcomeService: WelcomeService;36 constructor(welcomeService: WelcomeService) {37 this.welcomeService = welcomeService;38 }39 ngOnInit() {40 this.title = this.welcomeService.welcome();41 }42}43import { Injectable } from '@
Using AI Code Generation
1import { getMember } from 'ng-mocks';2import { AppComponent } from './app.component';3describe('AppComponent', () => {4 it('should have a title', () => {5 const component = getMember(AppComponent, 'title');6 expect(component).toEqual('app');7 });8});
Using AI Code Generation
1import { getMember } from 'ng-mocks';2import { getMock } from 'ng-mocks';3describe('TestComponent', () => {4 let component: TestComponent;5 let fixture: ComponentFixture<TestComponent>;6 let mockService: MockService;7 beforeEach(async(() => {8 TestBed.configureTestingModule({9 {10 useValue: getMock(Service)11 }12 })13 .compileComponents();14 }));15 beforeEach(() => {16 fixture = TestBed.createComponent(TestComponent);17 component = fixture.componentInstance;18 mockService = getMember(component, 'service');19 fixture.detectChanges();20 });21 it('should create', () => {22 expect(component).toBeTruthy();23 });24 it('should call method of service', () => {25 mockService.method.and.returnValue('test');26 expect(component.callService()).toEqual('test');27 });28});29import { Component, OnInit } from '@angular/core';30import { Service } from './service';31@Component({32})33export class TestComponent implements OnInit {34 constructor(public service: Service) { }35 ngOnInit() {36 }37 callService() {38 return this.service.method();39 }40}41import { Injectable } from '@angular/core';42@Injectable({43})44export class Service {45 constructor() { }46 method() {47 return 'service method';48 }49}50import { getMock } from 'ng-mocks';51import { Service } from './service';52describe('Service', () => {53 let service: Service;54 beforeEach(() => {55 service = getMock(Service);56 });57 it('should create', () => {58 expect(service).toBeTruthy();59 });60 it('should return test', () => {61 spyOn(service, 'method').and.returnValue('test');62 expect(service.method()).toEqual('test');63 });64});65 at new TestComponent (test.component.ts:9)66 at createClass (
Using AI Code Generation
1import { getMember } from 'ng-mocks';2import { Component, NgModule } from '@angular/core';3import { TestBed } from '@angular/core/testing';4@Component({5})6export class MyComponent {}7@NgModule({8})9export class MyModule {}10describe('getMember', () => {11 beforeEach(() => {12 TestBed.configureTestingModule({13 imports: [MyModule],14 });15 });16 it('should return a member', () => {17 const myComponent = getMember(MyModule, 'MyComponent');18 expect(myComponent).toBe(MyComponent);19 });20});21import 'zone.js/dist/zone-testing';22import { getTestBed } from '@angular/core/testing';23import {24} from '@angular/platform-browser-dynamic/testing';25getTestBed().initTestEnvironment(26 platformBrowserDynamicTesting(),27);28{29 "compilerOptions": {30 },31}32{33 "compilerOptions": {34 "importHelpers": true,35 },36 "angularCompilerOptions": {37 }38}39var webpackConfig = require('./webpack.config.js');40module.exports = function (config) {41 config.set({42 require('k
Using AI Code Generation
1import { getMember } from 'ng-mocks';2import { MyComponent } from './my.component';3const fixture = MockRender(MyComponent);4const component = getMember(fixture.debugElement.componentInstance, 'myComponent');5import { getMember } from 'ng-mocks';6import { MyComponent } from './my.component';7const fixture = MockRender(MyComponent);8const component = getMember(fixture.debugElement.componentInstance, 'myComponent');9import { getMember } from 'ng-mocks';10import { MyComponent } from './my.component';11const fixture = MockRender(MyComponent);12const component = getMember(fixture.debugElement.componentInstance, 'myComponent');13import { getMember } from 'ng-mocks';14import { MyComponent } from './my.component';15const fixture = MockRender(MyComponent);16const component = getMember(fixture.debugElement.componentInstance, 'myComponent');17import { getMember } from 'ng-mocks';18import { MyComponent } from './my.component';19const fixture = MockRender(MyComponent);20const component = getMember(fixture.debugElement.componentInstance, 'myComponent');21import { getMember } from 'ng-mocks';22import { MyComponent } from './my.component';23const fixture = MockRender(MyComponent);24const component = getMember(fixture.debugElement.componentInstance, 'myComponent');25import { getMember } from 'ng-mocks';26import { MyComponent } from './my.component';27const fixture = MockRender(MyComponent);28const component = getMember(fixture.debugElement.componentInstance, 'myComponent');29import { getMember } from 'ng-mocks';30import { MyComponent } from './my.component';31const fixture = MockRender(MyComponent);32const component = getMember(fixture.debugElement.componentInstance, 'myComponent');33import { getMember } from 'ng-mocks';34import { MyComponent } from './my.component';35const fixture = MockRender(MyComponent);36const component = getMember(fixture.debugElement.componentInstance, 'myComponent');37import { getMember
Using AI Code Generation
1import { getMember } from 'ng-mocks';2import { AppComponent } from './app.component';3const appComponent = getMember(AppComponent, 'title');4console.log(appComponent);5getMembers()6import { getMembers } from 'ng-mocks';7import { AppComponent } from './app.component';8const appComponent = getMembers(AppComponent, 'title');9console.log(appComponent);10getOutput()11import { getOutput } from 'ng-mocks';12import { AppComponent } from './app.component';13const appComponent = getOutput(AppComponent, 'title', 0);14console.log(appComponent);15getOutputs()16import { getOutputs } from 'ng-mocks';17import { AppComponent } from './app.component';18const appComponent = getOutputs(AppComponent, 'title');19console.log(appComponent);20getProvider()
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!