How to use getProperty method in Puppeteer

Best JavaScript code snippet using puppeteer

ODataTreeBinding.qunit.js

Source:ODataTreeBinding.qunit.js Github

copy

Full Screen

...60 // contexts should be now loaded61 var aContexts = oBinding.getRootContexts();62 assert.equal(aContexts.length, 5, "TreeBinding rootContexts length");63 oContext = aContexts[0];64 assert.equal(oModel.getProperty("FirstName", oContext), "Nancy", "TreeBinding root content");65 assert.equal(oModel.getProperty("LastName", oContext), "Davolio", "TreeBinding root content");66 oContext = aContexts[1];67 assert.equal(oModel.getProperty("FirstName", oContext), "Janet", "TreeBinding root content");68 assert.equal(oModel.getProperty("LastName", oContext), "Leverling", "TreeBinding root content");69 oContext = aContexts[2];70 assert.equal(oModel.getProperty("FirstName", oContext), "Margaret", "TreeBinding root content");71 assert.equal(oModel.getProperty("LastName", oContext), "Peacock", "TreeBinding root content");72 oContext = aContexts[3];73 assert.equal(oModel.getProperty("FirstName", oContext), "Steven", "TreeBinding root content");74 assert.equal(oModel.getProperty("LastName", oContext), "Buchanan", "TreeBinding root content");75 oContext = aContexts[4];76 assert.equal(oModel.getProperty("FirstName", oContext), "Laura", "TreeBinding root content");77 assert.equal(oModel.getProperty("LastName", oContext), "Callahan", "TreeBinding root content");78 oBinding.detachChange(handler1);79 oBinding.attachChange(handler2);80 oContext = aContexts[3];81 oBinding.getNodeContexts(oContext);82 };83 var handler2 = function(oEvent) {84 // contexts should be now loaded85 var aContexts = oBinding.getNodeContexts(oContext);86 assert.equal(aContexts.length, 3, "TreeBinding nodeContexts length");87 assert.equal(oBinding.getChildCount(oContext), 3, "TreeBinding childcount");88 oContext = aContexts[0];89 assert.equal(oModel.getProperty("FirstName", oContext), "Michael", "TreeBinding node content");90 assert.equal(oModel.getProperty("LastName", oContext), "Suyama", "TreeBinding node content");91 oContext = aContexts[1];92 assert.equal(oModel.getProperty("FirstName", oContext), "Robert", "TreeBinding node content");93 assert.equal(oModel.getProperty("LastName", oContext), "King", "TreeBinding node content");94 oContext = aContexts[2];95 assert.equal(oModel.getProperty("FirstName", oContext), "Anne", "TreeBinding node content");96 assert.equal(oModel.getProperty("LastName", oContext), "Dodsworth", "TreeBinding node content");97 oBinding.detachChange(handler2);98 done();99 };100 oBinding.attachChange(handler1);101 oBinding.getRootContexts();102 });103 QUnit.test("Display root node", function(assert){104 var done = assert.async();105 createTreeBinding("/Employees(2)", null, [], {106 navigation: {107 Employees: "Employees1",108 Employees1: "Employees1"109 },110 displayRootNode: true111 });112 var oContext;113 var handler1 = function(oEvent) {114 // contexts should be now loaded115 var aContexts = oBinding.getRootContexts();116 assert.equal(aContexts.length, 1, "TreeBinding rootContexts length");117 oContext = aContexts[0];118 assert.equal(oModel.getProperty("FirstName", oContext), "Andrew", "TreeBinding root content");119 assert.equal(oModel.getProperty("LastName", oContext), "Fuller", "TreeBinding root content");120 aContexts = oBinding.getNodeContexts(oContext);121 assert.equal(aContexts.length, 5, "TreeBinding rootContexts length");122 oContext = aContexts[0];123 assert.equal(oModel.getProperty("FirstName", oContext), "Nancy", "TreeBinding root content");124 assert.equal(oModel.getProperty("LastName", oContext), "Davolio", "TreeBinding root content");125 oContext = aContexts[1];126 assert.equal(oModel.getProperty("FirstName", oContext), "Janet", "TreeBinding root content");127 assert.equal(oModel.getProperty("LastName", oContext), "Leverling", "TreeBinding root content");128 oContext = aContexts[2];129 assert.equal(oModel.getProperty("FirstName", oContext), "Margaret", "TreeBinding root content");130 assert.equal(oModel.getProperty("LastName", oContext), "Peacock", "TreeBinding root content");131 oContext = aContexts[3];132 assert.equal(oModel.getProperty("FirstName", oContext), "Steven", "TreeBinding root content");133 assert.equal(oModel.getProperty("LastName", oContext), "Buchanan", "TreeBinding root content");134 oContext = aContexts[4];135 assert.equal(oModel.getProperty("FirstName", oContext), "Laura", "TreeBinding root content");136 assert.equal(oModel.getProperty("LastName", oContext), "Callahan", "TreeBinding root content");137 oBinding.detachChange(handler1);138 done();139 };140 oBinding.attachChange(handler1);141 oBinding.getRootContexts();142 });143 QUnit.test("Number of expanded levels", function(assert){144 var done = assert.async();145 createTreeBinding("/Employees(2)", null, [], {146 navigation: {147 Employees: "Employees1",148 Employees1: "Employees1"149 },150 displayRootNode: true,151 numberOfExpandedLevels: 2152 });153 var oContext;154 var handler1 = function(oEvent) {155 oBinding.detachChange(handler1);156 // contexts should be now loaded157 var aContexts = oBinding.getRootContexts();158 var aSubContexts;159 assert.equal(aContexts.length, 1, "TreeBinding rootContexts length");160 //Level 0161 oContext = aContexts[0];162 assert.equal(oModel.getProperty("FirstName", oContext), "Andrew", "TreeBinding root content");163 assert.equal(oModel.getProperty("LastName", oContext), "Fuller", "TreeBinding root content");164 //Level 0.0165 aContexts = oBinding.getNodeContexts(oContext);166 assert.equal(aContexts.length, 5, "TreeBinding nodeContexts length");167 oContext = aContexts[0];168 assert.equal(oModel.getProperty("FirstName", oContext), "Nancy", "TreeBinding root content");169 assert.equal(oModel.getProperty("LastName", oContext), "Davolio", "TreeBinding root content");170 //Level 0.0.0171 aSubContexts = oBinding.getNodeContexts(oContext);172 assert.equal(aSubContexts.length, 0, "TreeBinding nodeContexts length");173 //Level 0.1174 oContext = aContexts[3];175 assert.equal(oModel.getProperty("FirstName", oContext), "Steven", "TreeBinding root content");176 assert.equal(oModel.getProperty("LastName", oContext), "Buchanan", "TreeBinding root content");177 aSubContexts = oBinding.getNodeContexts(oContext);178 assert.equal(aSubContexts.length, 3, "TreeBinding nodeContexts length");179 oContext = aSubContexts[0];180 assert.equal(oModel.getProperty("FirstName", oContext), "Michael", "TreeBinding root content");181 assert.equal(oModel.getProperty("LastName", oContext), "Suyama", "TreeBinding root content");182 oContext = aSubContexts[2];183 assert.equal(oModel.getProperty("FirstName", oContext), "Anne", "TreeBinding root content");184 assert.equal(oModel.getProperty("LastName", oContext), "Dodsworth", "TreeBinding root content");185 done();186 };187 oBinding.attachChange(handler1);188 oBinding.getRootContexts();189 });190 QUnit.test("Has Children", function(assert){191 var done = assert.async();192 createTreeBinding("/Employees(2)", null, [], {193 navigation: {194 Employees: "Employees1",195 Employees1: "Employees1"196 },197 displayRootNode: true,198 numberOfExpandedLevels: 2199 });200 var handler1 = function(oEvent) {201 oBinding.detachChange(handler1);202 // contexts should be now loaded203 var aContexts = oBinding.getRootContexts();204 assert.ok(oBinding.hasChildren(aContexts[0]), " root context should have children");205 //Level 0.0206 aContexts = oBinding.getNodeContexts(aContexts[0]);207 assert.ok(!oBinding.hasChildren(aContexts[0]), " node context should not have children");208 assert.ok(oBinding.hasChildren(aContexts[3]), " node context should have children");209 oBinding.getNodeContexts(aContexts[3]);210 assert.ok(oBinding.hasChildren(aContexts[3]), " node context should have children");211 done();212 };213 oBinding.attachChange(handler1);214 oBinding.getRootContexts();215 });216 QUnit.test("Bind an aggregation", function(assert){217 var done = assert.async();218 createTreeBinding("/Employees", null, [], {219 navigation: {220 Employees: "Employees1",221 Employees1: "Employees1"222 }223 });224 var oContext;225 var handler1 = function(oEvent) {226 // contexts should be now loaded227 var aContexts = oBinding.getRootContexts();228 assert.equal(aContexts.length, 9, "TreeBinding rootContexts length");229 oContext = aContexts[0];230 assert.equal(oModel.getProperty("FirstName", oContext), "Nancy", "TreeBinding root content");231 assert.equal(oModel.getProperty("LastName", oContext), "Davolio", "TreeBinding root content");232 oContext = aContexts[1];233 assert.equal(oModel.getProperty("FirstName", oContext), "Andrew", "TreeBinding root content");234 assert.equal(oModel.getProperty("LastName", oContext), "Fuller", "TreeBinding root content");235 oContext = aContexts[2];236 assert.equal(oModel.getProperty("FirstName", oContext), "Janet", "TreeBinding root content");237 assert.equal(oModel.getProperty("LastName", oContext), "Leverling", "TreeBinding root content");238 oContext = aContexts[3];239 assert.equal(oModel.getProperty("FirstName", oContext), "Margaret", "TreeBinding root content");240 assert.equal(oModel.getProperty("LastName", oContext), "Peacock", "TreeBinding root content");241 oContext = aContexts[4];242 assert.equal(oModel.getProperty("FirstName", oContext), "Steven", "TreeBinding root content");243 assert.equal(oModel.getProperty("LastName", oContext), "Buchanan", "TreeBinding root content");244 oContext = aContexts[5];245 assert.equal(oModel.getProperty("FirstName", oContext), "Michael", "TreeBinding root content");246 assert.equal(oModel.getProperty("LastName", oContext), "Suyama", "TreeBinding root content");247 oContext = aContexts[6];248 assert.equal(oModel.getProperty("FirstName", oContext), "Robert", "TreeBinding root content");249 assert.equal(oModel.getProperty("LastName", oContext), "King", "TreeBinding root content");250 oContext = aContexts[7];251 assert.equal(oModel.getProperty("FirstName", oContext), "Laura", "TreeBinding root content");252 assert.equal(oModel.getProperty("LastName", oContext), "Callahan", "TreeBinding root content");253 oContext = aContexts[8];254 assert.equal(oModel.getProperty("FirstName", oContext), "Anne", "TreeBinding root content");255 assert.equal(oModel.getProperty("LastName", oContext), "Dodsworth", "TreeBinding root content");256 oContext = aContexts[1];257 aContexts = oBinding.getNodeContexts(oContext);258 assert.equal(aContexts.length, 5, "TreeBinding rootContexts length");259 oContext = aContexts[0];260 assert.equal(oModel.getProperty("FirstName", oContext), "Nancy", "TreeBinding root content");261 assert.equal(oModel.getProperty("LastName", oContext), "Davolio", "TreeBinding root content");262 oContext = aContexts[1];263 assert.equal(oModel.getProperty("FirstName", oContext), "Janet", "TreeBinding root content");264 assert.equal(oModel.getProperty("LastName", oContext), "Leverling", "TreeBinding root content");265 oContext = aContexts[2];266 assert.equal(oModel.getProperty("FirstName", oContext), "Margaret", "TreeBinding root content");267 assert.equal(oModel.getProperty("LastName", oContext), "Peacock", "TreeBinding root content");268 oContext = aContexts[3];269 assert.equal(oModel.getProperty("FirstName", oContext), "Steven", "TreeBinding root content");270 assert.equal(oModel.getProperty("LastName", oContext), "Buchanan", "TreeBinding root content");271 oContext = aContexts[4];272 assert.equal(oModel.getProperty("FirstName", oContext), "Laura", "TreeBinding root content");273 assert.equal(oModel.getProperty("LastName", oContext), "Callahan", "TreeBinding root content");274 oBinding.detachChange(handler1);275 done();276 };277 oBinding.attachChange(handler1);278 oBinding.getRootContexts();279 });280 QUnit.test("Refresh", function(assert){281 var done = assert.async();282 createTreeBinding("/Employees(2)", null, [], {283 navigation: {284 Employees: "Employees1",285 Employees1: "Employees1"286 }287 });288 var oContext;289 var handler1 = function(oEvent) {290 // contexts should be now loaded291 var aContexts = oBinding.getRootContexts();292 assert.equal(aContexts.length, 5, "TreeBinding rootContexts length");293 oContext = aContexts[0];294 assert.equal(oModel.getProperty("FirstName", oContext), "Nancy", "TreeBinding root content");295 assert.equal(oModel.getProperty("LastName", oContext), "Davolio", "TreeBinding root content");296 oContext = aContexts[1];297 assert.equal(oModel.getProperty("FirstName", oContext), "Janet", "TreeBinding root content");298 assert.equal(oModel.getProperty("LastName", oContext), "Leverling", "TreeBinding root content");299 oContext = aContexts[2];300 assert.equal(oModel.getProperty("FirstName", oContext), "Margaret", "TreeBinding root content");301 assert.equal(oModel.getProperty("LastName", oContext), "Peacock", "TreeBinding root content");302 oContext = aContexts[3];303 assert.equal(oModel.getProperty("FirstName", oContext), "Steven", "TreeBinding root content");304 assert.equal(oModel.getProperty("LastName", oContext), "Buchanan", "TreeBinding root content");305 oContext = aContexts[4];306 assert.equal(oModel.getProperty("FirstName", oContext), "Laura", "TreeBinding root content");307 assert.equal(oModel.getProperty("LastName", oContext), "Callahan", "TreeBinding root content");308 assert.deepEqual(oBinding.oKeys, {309 "/Employees(2)/Employees1": [310 "Employees(1)",311 "Employees(3)",312 "Employees(4)",313 "Employees(5)",314 "Employees(8)"315 ]316 }, "Keys object has value for root");317 assert.deepEqual(oBinding.oLengths, {318 "/Employees(2)/Employees1": 5319 }, "Lengths object has value for root");320 assert.deepEqual(oBinding.oFinalLengths, {321 "/Employees(2)/Employees1": true322 }, "FinalLengths object has value for root");323 oBinding.detachChange(handler1);324 oBinding.attachChange(handler2);325 oBinding.refresh();326 assert.deepEqual(oBinding.oKeys, {}, "Keys object has been reset");327 assert.deepEqual(oBinding.oLengths, {}, "Lengths object has value for root");328 assert.deepEqual(oBinding.oFinalLengths, {}, "FinalLengths object has value for root");329 };330 var handler2 = function(oEvent) {331 // contexts should be now loaded332 var aContexts = oBinding.getRootContexts();333 assert.equal(aContexts.length, 0, "No contexts are available data has been reset");334 oBinding.detachChange(handler2);335 oBinding.attachChange(handler3);336 };337 var handler3 = function(oEvent) {338 // contexts should be now loaded339 var aContexts = oBinding.getRootContexts();340 assert.equal(aContexts.length, 5, "TreeBinding rootContexts length");341 oContext = aContexts[0];342 assert.equal(oModel.getProperty("FirstName", oContext), "Nancy", "TreeBinding root content");343 assert.equal(oModel.getProperty("LastName", oContext), "Davolio", "TreeBinding root content");344 oContext = aContexts[1];345 assert.equal(oModel.getProperty("FirstName", oContext), "Janet", "TreeBinding root content");346 assert.equal(oModel.getProperty("LastName", oContext), "Leverling", "TreeBinding root content");347 oContext = aContexts[2];348 assert.equal(oModel.getProperty("FirstName", oContext), "Margaret", "TreeBinding root content");349 assert.equal(oModel.getProperty("LastName", oContext), "Peacock", "TreeBinding root content");350 oContext = aContexts[3];351 assert.equal(oModel.getProperty("FirstName", oContext), "Steven", "TreeBinding root content");352 assert.equal(oModel.getProperty("LastName", oContext), "Buchanan", "TreeBinding root content");353 oContext = aContexts[4];354 assert.equal(oModel.getProperty("FirstName", oContext), "Laura", "TreeBinding root content");355 assert.equal(oModel.getProperty("LastName", oContext), "Callahan", "TreeBinding root content");356 assert.deepEqual(oBinding.oKeys, {357 "/Employees(2)/Employees1": [358 "Employees(1)",359 "Employees(3)",360 "Employees(4)",361 "Employees(5)",362 "Employees(8)"363 ]364 }, "Keys object has value for root");365 assert.deepEqual(oBinding.oLengths, {366 "/Employees(2)/Employees1": 5367 }, "Lengths object has value for root");368 assert.deepEqual(oBinding.oFinalLengths, {369 "/Employees(2)/Employees1": true370 }, "FinalLengths object has value for root");371 oBinding.detachChange(handler3);372 done();373 };374 oBinding.attachChange(handler1);375 oBinding.getRootContexts();376 });377 QUnit.test("No navigation object specified", function(assert) {378 var iErrorCount = 0,379 sErrorMessage = "";380 this.stub(Log, "error", function(sMsg) {381 iErrorCount++;382 sErrorMessage = sMsg;383 });384 createTreeBinding("/Employees(2)");385 assert.equal(iErrorCount, 1, "TreeBinding one error should have occured");386 assert.equal(sErrorMessage, "A navigation paths parameter object has to be defined", "TreeBinding navigation error was thrown");387 });388 QUnit.test("Tried filtering", function(assert) {389 var iWarningCount = 0,390 sMessage = "";391 this.stub(Log, "warning", function(sMsg) {392 iWarningCount++;393 sMessage = sMsg;394 });395 createTreeBinding("/Employees(2)", null, [], {396 navigation: {}397 });398 oBinding.filter(new Filter("FirstName", "EQ", "Tom"));399 assert.equal(iWarningCount, 1, "One warning (that filtering is not enabled) should have fired");400 assert.equal(sMessage, "Filtering is currently not possible in the ODataTreeBinding", "Check warning message");401 });402 QUnit.test("Paging", function(assert) {403 var done = assert.async();404 createTreeBinding("/Employees", null, [], {405 navigation: {406 Employees: "Employees1",407 Employees1: "Employees1"408 },409 displayRootNode: true410 });411 var oContext;412 var handler1 = function(oEvent) {413 // contexts should be now loaded414 var aContexts = oBinding.getRootContexts(1, 4);415 assert.equal(aContexts.length, 4, "TreeBinding returned rootContexts length");416 //Wait for fix of Mock Server417 //assert.equal(oBinding.getChildCount(null), 9, "TreeBinding actual rootContexts length");418 oContext = aContexts[0];419 assert.equal(oModel.getProperty("FirstName", oContext), "Andrew", "TreeBinding root content");420 assert.equal(oModel.getProperty("LastName", oContext), "Fuller", "TreeBinding root content");421 oContext = aContexts[1];422 assert.equal(oModel.getProperty("FirstName", oContext), "Janet", "TreeBinding root content");423 assert.equal(oModel.getProperty("LastName", oContext), "Leverling", "TreeBinding root content");424 oContext = aContexts[2];425 assert.equal(oModel.getProperty("FirstName", oContext), "Margaret", "TreeBinding root content");426 assert.equal(oModel.getProperty("LastName", oContext), "Peacock", "TreeBinding root content");427 oContext = aContexts[3];428 assert.equal(oModel.getProperty("FirstName", oContext), "Steven", "TreeBinding root content");429 assert.equal(oModel.getProperty("LastName", oContext), "Buchanan", "TreeBinding root content");430 oContext = aContexts[0];431 aContexts = oBinding.getNodeContexts(oContext, 2, 3);432 assert.equal(aContexts.length, 3, "TreeBinding rootContexts length");433 //Wait for fix of Mock Server434 //assert.equal(oBinding.getChildCount(oContext), 5, "TreeBinding actual rootContexts length");435 oContext = aContexts[0];436 assert.equal(oModel.getProperty("FirstName", oContext), "Margaret", "TreeBinding root content");437 assert.equal(oModel.getProperty("LastName", oContext), "Peacock", "TreeBinding root content");438 oContext = aContexts[1];439 assert.equal(oModel.getProperty("FirstName", oContext), "Steven", "TreeBinding root content");440 assert.equal(oModel.getProperty("LastName", oContext), "Buchanan", "TreeBinding root content");441 oContext = aContexts[2];442 assert.equal(oModel.getProperty("FirstName", oContext), "Laura", "TreeBinding root content");443 assert.equal(oModel.getProperty("LastName", oContext), "Callahan", "TreeBinding root content");444 oBinding.detachChange(handler1);445 done();446 };447 oBinding.attachChange(handler1);448 oBinding.getRootContexts(1, 4);449 });450 QUnit.module("ODataTreeBinding with annotations", {451 beforeEach: function() {452 oAnnotationMockServer.start();453 oModel = new ODataModel('/metadata/', true);454 },455 afterEach: function() {456 oAnnotationMockServer.stop();457 oModel.destroy();458 }459 });460 QUnit.test("Properties", function(assert){461 createTreeBinding("/GLAccountHierarchyInChartOfAccountsSet(P_MANDT='902',P_VERSN='INT',P_KTOPL='INT')/Result", null, [], {462 navigation: {}463 });464 assert.ok(oBinding instanceof ODataTreeBinding, "treeBinding class check");465 assert.equal(oBinding.getPath(), "/GLAccountHierarchyInChartOfAccountsSet(P_MANDT='902',P_VERSN='INT',P_KTOPL='INT')/Result", "TreeBinding path");466 assert.equal(oBinding.getModel(), oModel, "TreeBinding model");467 assert.equal(oBinding.bHasTreeAnnotations, true, "TreeBinding Metadata should be available");468 });469 QUnit.test("TreeBinding getRootContexts getNodeContexts", function(assert){470 var done = assert.async();471 createTreeBinding("/GLAccountHierarchyInChartOfAccountsSet(P_MANDT='902',P_VERSN='INT',P_KTOPL='INT')/Result");472 var oContext;473 var iHandleCounter = 0;474 var handler1 = function(oEvent) {475 iHandleCounter++;476 // contexts should be now loaded477 var aContexts = oBinding.getRootContexts();478 if (iHandleCounter == 2) {479 assert.equal(aContexts.length, 9, "TreeBinding rootContexts length");480 oContext = aContexts[0];481 assert.equal(oModel.getProperty("FinStatementHierarchyLevelVal", oContext), "02", "TreeBinding node content");482 assert.equal(oModel.getProperty("HierarchyNode", oContext), "000002", "TreeBinding node content");483 assert.equal(oModel.getProperty("ParentNode", oContext), "000001", "TreeBinding node content");484 assert.equal(oModel.getProperty("FinancialStatementItem", oContext), "1000000", "TreeBinding node content");485 oContext = aContexts[1];486 assert.equal(oModel.getProperty("FinStatementHierarchyLevelVal", oContext), "02", "TreeBinding node content");487 assert.equal(oModel.getProperty("HierarchyNode", oContext), "000362", "TreeBinding node content");488 assert.equal(oModel.getProperty("ParentNode", oContext), "000001", "TreeBinding node content");489 assert.equal(oModel.getProperty("FinancialStatementItem", oContext), "2000000", "TreeBinding node content");490 oContext = aContexts[8];491 assert.equal(oModel.getProperty("FinStatementHierarchyLevelVal", oContext), "02", "TreeBinding node content");492 assert.equal(oModel.getProperty("HierarchyNode", oContext), "001180", "TreeBinding node content");493 assert.equal(oModel.getProperty("ParentNode", oContext), "000001", "TreeBinding node content");494 assert.equal(oModel.getProperty("FinancialStatementItem", oContext), "1", "TreeBinding node content");495 oBinding.detachChange(handler1);496 done();497 }498 };499 oBinding.attachChange(handler1);500 oBinding.getRootContexts();501 });502 QUnit.test("Display root node", function(assert){503 var done = assert.async();504 createTreeBinding("/GLAccountHierarchyInChartOfAccountsSet(P_MANDT='902',P_VERSN='INT',P_KTOPL='INT')/Result", [], null, {505 displayRootNode: true506 });507 var oContext;508 var handler1 = function(oEvent) {509 // contexts should be now loaded510 var aContexts = oBinding.getRootContexts();511 assert.equal(aContexts.length, 1, "TreeBinding rootContexts length");512 oContext = aContexts[0];513 assert.equal(oModel.getProperty("FinStatementHierarchyLevelVal", oContext), "01", "TreeBinding root content");514 assert.equal(oModel.getProperty("HierarchyNode", oContext), "000001", "TreeBinding root content");515 assert.equal(oModel.getProperty("FinancialStatementItem", oContext), "INT", "TreeBinding root content");516 oBinding.detachChange(handler1);517 oBinding.attachChange(handler2);518 oContext = aContexts[0];519 oBinding.getNodeContexts(oContext);520 };521 var handler2 = function(oEvent) {522 // contexts should be now loaded523 var aContexts = oBinding.getNodeContexts(oContext);524 assert.equal(aContexts.length, 9, "TreeBinding nodeContexts length");525 //Wait for fix of Mock Server526 //assert.equal(oBinding.getChildCount(oContext), 9, "TreeBinding childcount");527 oContext = aContexts[0];528 assert.equal(oModel.getProperty("FinStatementHierarchyLevelVal", oContext), "02", "TreeBinding node content");529 assert.equal(oModel.getProperty("HierarchyNode", oContext), "000002", "TreeBinding node content");530 assert.equal(oModel.getProperty("ParentNode", oContext), "000001", "TreeBinding node content");531 assert.equal(oModel.getProperty("FinancialStatementItem", oContext), "1000000", "TreeBinding node content");532 oContext = aContexts[1];533 assert.equal(oModel.getProperty("FinStatementHierarchyLevelVal", oContext), "02", "TreeBinding node content");534 assert.equal(oModel.getProperty("HierarchyNode", oContext), "000362", "TreeBinding node content");535 assert.equal(oModel.getProperty("ParentNode", oContext), "000001", "TreeBinding node content");536 assert.equal(oModel.getProperty("FinancialStatementItem", oContext), "2000000", "TreeBinding node content");537 oContext = aContexts[8];538 assert.equal(oModel.getProperty("FinStatementHierarchyLevelVal", oContext), "02", "TreeBinding node content");539 assert.equal(oModel.getProperty("HierarchyNode", oContext), "001180", "TreeBinding node content");540 assert.equal(oModel.getProperty("ParentNode", oContext), "000001", "TreeBinding node content");541 assert.equal(oModel.getProperty("FinancialStatementItem", oContext), "1", "TreeBinding node content");542 oBinding.detachChange(handler2);543 done();544 };545 oBinding.attachChange(handler1);546 oBinding.getRootContexts();547 });548 QUnit.test("Number of expanded levels", function(assert){549 var done = assert.async();550 createTreeBinding("/GLAccountHierarchyInChartOfAccountsSet(P_MANDT='902',P_VERSN='INT',P_KTOPL='INT')/Result", [], null, {551 displayRootNode: true,552 numberOfExpandedLevels: 2553 });554 var oContext;555 var handler1 = function(oEvent) {556 oBinding.detachChange(handler1);557 // contexts should be now loaded558 var aContexts = oBinding.getRootContexts();559 var aSubContexts;560 assert.equal(aContexts.length, 1, "TreeBinding rootContexts length");561 //Level 0562 oContext = aContexts[0];563 assert.equal(oModel.getProperty("FinStatementHierarchyLevelVal", oContext), "01", "TreeBinding root content");564 assert.equal(oModel.getProperty("HierarchyNode", oContext), "000001", "TreeBinding root content");565 assert.equal(oModel.getProperty("FinancialStatementItem", oContext), "INT", "TreeBinding root content");566 //Level 0.0567 aContexts = oBinding.getNodeContexts(oContext);568 assert.equal(aContexts.length, 9, "TreeBinding nodeContexts length");569 oContext = aContexts[0];570 assert.equal(oModel.getProperty("FinStatementHierarchyLevelVal", oContext), "02", "TreeBinding node content");571 assert.equal(oModel.getProperty("HierarchyNode", oContext), "000002", "TreeBinding node content");572 assert.equal(oModel.getProperty("ParentNode", oContext), "000001", "TreeBinding node content");573 assert.equal(oModel.getProperty("FinancialStatementItem", oContext), "1000000", "TreeBinding node content");574 //Level 0.0.0575 aSubContexts = oBinding.getNodeContexts(oContext);576 assert.equal(aSubContexts.length, 7, "TreeBinding nodeContexts length");577 oContext = aSubContexts[0];578 assert.equal(oModel.getProperty("FinStatementHierarchyLevelVal", oContext), "03", "TreeBinding node content");579 assert.equal(oModel.getProperty("HierarchyNode", oContext), "000003", "TreeBinding node content");580 assert.equal(oModel.getProperty("ParentNode", oContext), "000002", "TreeBinding node content");581 assert.equal(oModel.getProperty("FinancialStatementItem", oContext), "1010000", "TreeBinding node content");582 oContext = aSubContexts[6];583 assert.equal(oModel.getProperty("FinStatementHierarchyLevelVal", oContext), "03", "TreeBinding node content");584 assert.equal(oModel.getProperty("HierarchyNode", oContext), "000360", "TreeBinding node content");585 assert.equal(oModel.getProperty("ParentNode", oContext), "000002", "TreeBinding node content");586 assert.equal(oModel.getProperty("FinancialStatementItem", oContext), "1070000", "TreeBinding node content");587 //Level 0.1588 oContext = aContexts[7];589 assert.equal(oModel.getProperty("FinStatementHierarchyLevelVal", oContext), "02", "TreeBinding node content");590 assert.equal(oModel.getProperty("HierarchyNode", oContext), "001179", "TreeBinding node content");591 assert.equal(oModel.getProperty("ParentNode", oContext), "000001", "TreeBinding node content");592 assert.equal(oModel.getProperty("FinancialStatementItem", oContext), "8000000", "TreeBinding node content");593 aSubContexts = oBinding.getNodeContexts(oContext);594 assert.equal(aSubContexts.length, 0, "TreeBinding nodeContexts length - no children anymore");595 done();596 };597 oBinding.attachChange(handler1);598 oBinding.getRootContexts();599 });600 QUnit.test("Paging", function(assert) {601 var done = assert.async();602 createTreeBinding("/GLAccountHierarchyInChartOfAccountsSet(P_MANDT='902',P_VERSN='INT',P_KTOPL='INT')/Result");603 var oContext;604 var iHandleCounter = 0;605 var handler1 = function(oEvent) {606 iHandleCounter++;607 // contexts should be now loaded608 var aContexts = oBinding.getRootContexts(1, 4);609 if (iHandleCounter == 2) {610 assert.equal(aContexts.length, 4, "TreeBinding returned rootContexts length");611 //Wait for fix of Mock Server612 //assert.equal(oBinding.getChildCount(null), 9, "TreeBinding actual rootContexts length");613 oContext = aContexts[0];614 assert.equal(oModel.getProperty("FinStatementHierarchyLevelVal", oContext), "02", "TreeBinding node content");615 assert.equal(oModel.getProperty("HierarchyNode", oContext), "000362", "TreeBinding node content");616 assert.equal(oModel.getProperty("ParentNode", oContext), "000001", "TreeBinding node content");617 assert.equal(oModel.getProperty("FinancialStatementItem", oContext), "2000000", "TreeBinding node content");618 oContext = aContexts[1];619 assert.equal(oModel.getProperty("FinStatementHierarchyLevelVal", oContext), "02", "TreeBinding node content");620 assert.equal(oModel.getProperty("HierarchyNode", oContext), "000682", "TreeBinding node content");621 assert.equal(oModel.getProperty("ParentNode", oContext), "000001", "TreeBinding node content");622 assert.equal(oModel.getProperty("FinancialStatementItem", oContext), "3000000", "TreeBinding node content");623 oContext = aContexts[2];624 assert.equal(oModel.getProperty("FinStatementHierarchyLevelVal", oContext), "02", "TreeBinding node content");625 assert.equal(oModel.getProperty("HierarchyNode", oContext), "001073", "TreeBinding node content");626 assert.equal(oModel.getProperty("ParentNode", oContext), "000001", "TreeBinding node content");627 assert.equal(oModel.getProperty("FinancialStatementItem", oContext), "4000000", "TreeBinding node content");628 oContext = aContexts[3];629 assert.equal(oModel.getProperty("FinStatementHierarchyLevelVal", oContext), "02", "TreeBinding node content");630 assert.equal(oModel.getProperty("HierarchyNode", oContext), "001131", "TreeBinding node content");631 assert.equal(oModel.getProperty("ParentNode", oContext), "000001", "TreeBinding node content");632 assert.equal(oModel.getProperty("FinancialStatementItem", oContext), "5000000", "TreeBinding node content");633 oBinding.detachChange(handler1);634 oContext = aContexts[0];635 oBinding.attachChange(handler2);636 oBinding.getNodeContexts(oContext, 2, 3);637 }638 };639 var handler2 = function(oEvent) {640 // contexts should be now loaded641 var aContexts = oBinding.getNodeContexts(oContext, 2, 3);642 assert.equal(aContexts.length, 3, "TreeBinding rootContexts length");643 //Wait for fix of Mock Server644 //assert.equal(oBinding.getChildCount(oContext), 5, "TreeBinding actual rootContexts length");645 oContext = aContexts[0];646 assert.equal(oModel.getProperty("FinStatementHierarchyLevelVal", oContext), "03", "TreeBinding node content");647 assert.equal(oModel.getProperty("HierarchyNode", oContext), "000413", "TreeBinding node content");648 assert.equal(oModel.getProperty("ParentNode", oContext), "000362", "TreeBinding node content");649 assert.equal(oModel.getProperty("FinancialStatementItem", oContext), "2030000", "TreeBinding node content");650 oContext = aContexts[1];651 assert.equal(oModel.getProperty("FinStatementHierarchyLevelVal", oContext), "03", "TreeBinding node content");652 assert.equal(oModel.getProperty("HierarchyNode", oContext), "000447", "TreeBinding node content");653 assert.equal(oModel.getProperty("ParentNode", oContext), "000362", "TreeBinding node content");654 assert.equal(oModel.getProperty("FinancialStatementItem", oContext), "2040000", "TreeBinding node content");655 oContext = aContexts[2];656 assert.equal(oModel.getProperty("FinStatementHierarchyLevelVal", oContext), "03", "TreeBinding node content");657 assert.equal(oModel.getProperty("HierarchyNode", oContext), "000680", "TreeBinding node content");658 assert.equal(oModel.getProperty("ParentNode", oContext), "000362", "TreeBinding node content");659 assert.equal(oModel.getProperty("FinancialStatementItem", oContext), "2050000", "TreeBinding node content");660 oBinding.detachChange(handler2);661 done();662 };663 oBinding.attachChange(handler1);664 oBinding.getRootContexts(1, 4);665 });666 QUnit.test("Tried filtering", function(assert) {667 var iWarningCount = 0,668 sMessage = "";669 this.stub(Log, "warning", function(sMsg) {670 iWarningCount++;671 sMessage = sMsg;672 });673 createTreeBinding("/GLAccountHierarchyInChartOfAccountsSet(P_MANDT='902',P_VERSN='INT',P_KTOPL='INT')/Result");...

Full Screen

Full Screen

XMLTreeBinding.qunit.js

Source:XMLTreeBinding.qunit.js Github

copy

Full Screen

...67 assert.equal(treeBinding.getModel(), this.oModel, "TreeBinding model");68 contexts = treeBinding.getRootContexts();69 assert.equal(contexts.length, 1, "TreeBinding rootContexts length");70 context = contexts[0];71 assert.equal(this.oModel.getProperty("@name",context), "Peter Cliff", "TreeBinding root content");72 contexts = treeBinding.getNodeContexts(context);73 assert.equal(contexts.length, 3, "TreeBinding nodeContexts length");74 context = contexts[0];75 assert.equal(this.oModel.getProperty("@name",context), "Inga Horst", "TreeBinding node content");76 context = contexts[2];77 assert.equal(this.oModel.getProperty("@name",context), "Catherine Platte", "TreeBinding node content");78 assert.equal(treeBinding.getChildCount(contexts[0]), 3, "TreeBinding childcount");79 contexts = treeBinding.getNodeContexts(contexts[0]);80 assert.equal(contexts.length, 3, "TreeBinding nodeContexts length");81 context = contexts[1];82 assert.equal(this.oModel.getProperty("@name",context), "Frank Wallace", "TreeBinding node content");83 });84 QUnit.test("TreeBinding relative getRootContexts getNodeContexts", function(assert) {85 var treeBinding = this.createTreeBinding("orgStructure"),86 contexts,87 context;88 treeBinding.setContext(this.oModel.getContext("/"));89 assert.equal(treeBinding.getPath(), "orgStructure", "TreeBinding path");90 assert.equal(treeBinding.getModel(), this.oModel, "TreeBinding model");91 contexts = treeBinding.getRootContexts();92 assert.equal(contexts.length, 1, "TreeBinding rootContexts length");93 context = contexts[0];94 assert.equal(this.oModel.getProperty("@name",context), "Peter Cliff", "TreeBinding root content");95 contexts = treeBinding.getNodeContexts(context);96 assert.equal(contexts.length, 3, "TreeBinding nodeContexts length");97 context = contexts[0];98 assert.equal(this.oModel.getProperty("@name",context), "Inga Horst", "TreeBinding node content");99 context = contexts[2];100 assert.equal(this.oModel.getProperty("@name",context), "Catherine Platte", "TreeBinding node content");101 assert.equal(treeBinding.getChildCount(contexts[0]), 3, "TreeBinding childcount");102 contexts = treeBinding.getNodeContexts(contexts[0]);103 assert.equal(contexts.length, 3, "TreeBinding nodeContexts length");104 context = contexts[1];105 assert.equal(this.oModel.getProperty("@name",context), "Frank Wallace", "TreeBinding node content");106 });107 QUnit.test("TreeBinding getRootContexts getNodeContexts", function(assert) {108 var treeBinding = this.createTreeBinding("/orgStructure"),109 contexts,110 context;111 assert.ok(treeBinding instanceof XMLTreeBinding, "treeBinding class check");112 contexts = treeBinding.getRootContexts();113 assert.equal(contexts.length, 1, "TreeBinding rootContexts length");114 var newData = "<root>" +115 "<orgStructure>" +116 "<level00 name=\"root1\">" +117 "<level10 name=\"subnode1\">" +118 "<level20 name=\"subsubnode1\"></level20>" +119 "</level10>" +120 "</level00>" +121 "<level01 name=\"root2\">" +122 "<level10 name=\"subnode2\">" +123 "</level10>" +124 "</level01>" +125 "</orgStructure>" +126 "</root>";127 this.oModel.setXML(newData);128 treeBinding = this.createTreeBinding("/orgStructure");129 contexts = treeBinding.getRootContexts();130 assert.equal(contexts.length, 2, "TreeBinding rootContexts length");131 context = contexts[1];132 assert.equal(this.oModel.getProperty("@name", context), "root2", "TreeBinding node content");133 contexts = treeBinding.getNodeContexts(context);134 assert.equal(contexts.length, 1, "TreeBinding nodeContexts length");135 context = contexts[0];136 assert.equal(this.oModel.getProperty("@name", context), "subnode2", "TreeBinding node content");137 this.oModel.createBindingContext("/orgStructure/level00", null, function(newContext){138 context = newContext;139 });140 assert.equal(this.oModel.getProperty("@name", context), "root1", "TreeBinding node content");141 this.oModel.createBindingContext("/orgStructure/level00/level10", null, function(newContext){142 context = newContext;143 });144 assert.equal(this.oModel.getProperty("@name", context), "subnode1", "TreeBinding node content");145 this.oModel.createBindingContext("/orgStructure/level00/level10/level20", null, function(newContext){146 context = newContext;147 });148 assert.equal(this.oModel.getProperty("@name", context), "subsubnode1", "TreeBinding node content");149 });150 QUnit.test("TreeBinding filters and setData again", function(assert) {151 var treeBinding = this.createTreeBinding("/orgStructure");152 this.oModel.addBinding(treeBinding);153 // Filter for node with name containing 'in'154 var oFilter1 = new Filter("@name", FilterOperator.Contains, "alla");155 treeBinding.filter(oFilter1);156 var filteredContext = treeBinding.getRootContexts();157 assert.equal(filteredContext.length, 1, "TreeBinding rootContexts length");158 assert.equal(treeBinding.getChildCount(), 1, "TreeBinding rootContexts length");159 assert.equal(treeBinding.getChildCount(filteredContext[0]), 1, "TreeBinding rootContexts length");160 var nodeContexts1 = treeBinding.getNodeContexts(filteredContext[0]);161 assert.equal(nodeContexts1.length, 1, "TreeBinding nodeContexts length");162 assert.equal(treeBinding.getChildCount(nodeContexts1[0]), 2, "TreeBinding nodeContexts length");163 var nodeContexts2 = treeBinding.getNodeContexts(nodeContexts1[0]);164 assert.equal(nodeContexts2.length, 2, "TreeBinding nodeContexts length");165 assert.equal(treeBinding.getChildCount(nodeContexts2[0]), 0, "TreeBinding nodeContexts length");166 assert.equal(treeBinding.getChildCount(nodeContexts2[1]), 0, "TreeBinding nodeContexts length");167 assert.equal(this.oModel.getProperty("@name", nodeContexts2[0]), "John Wallace", "TreeBinding filter value");168 assert.equal(this.oModel.getProperty("@name", nodeContexts2[1]), "Frank Wallace", "TreeBinding filter value");169 var newData = "<root>" +170 "<orgStructure>" +171 "<level00 name=\"Peter Cliffs\" gender=\"male\">" +172 "<level11 name=\"Mason Storm\" gender=\"male\">" +173 "</level11>" +174 "<level12 name=\"Catherine Pallate\" gender=\"female\">" +175 "</level12>" +176 "</level00>" +177 "</orgStructure></root>";178 this.oModel.setXML(newData);179 // check if filter got reapplied:180 filteredContext = treeBinding.getRootContexts();181 assert.equal(filteredContext.length, 1, "TreeBinding rootContexts length");182 assert.equal(treeBinding.getChildCount(filteredContext[0]), 1, "TreeBinding rootContexts length");183 nodeContexts1 = treeBinding.getNodeContexts(filteredContext[0]);184 assert.equal(nodeContexts1.length, 1, "TreeBinding nodeContexts length");185 assert.equal(treeBinding.getChildCount(nodeContexts1[0]), 0, "TreeBinding nodeContexts length");186 assert.equal(this.oModel.getProperty("@name", nodeContexts1[0]), "Catherine Pallate", "TreeBinding filter value");187 this.oModel.removeBinding(treeBinding);188 });189 QUnit.test("TreeBinding multi filters", function(assert) {190 var treeBinding = this.createTreeBinding("/orgStructure");191 var oFilter1 = new Filter("@name", FilterOperator.Contains, "in");192 var oFilter2 = new Filter("@name", FilterOperator.Contains, "al");193 var oMultiFilter1 = new Filter([oFilter1, oFilter2], false);194 var oFilter3 = new Filter("@gender", FilterOperator.EQ, "female");195 var oMultiFilter2 = new Filter([oMultiFilter1, oFilter3], true);196 treeBinding.filter([oMultiFilter2]);197 var filteredContext = treeBinding.getRootContexts();198 assert.equal(filteredContext.length, 1, "TreeBinding rootContexts length");199 var nodeContexts1 = treeBinding.getNodeContexts(filteredContext[0]);200 assert.equal(nodeContexts1.length, 2, "TreeBinding nodeContexts length");201 var nodeContexts2 = treeBinding.getNodeContexts(nodeContexts1[0]);202 assert.equal(nodeContexts2.length, 1, "TreeBinding nodeContexts length");203 assert.equal(this.oModel.getProperty("@name", nodeContexts2[0]), "Gina Rush", "TreeBinding filter value");204 assert.equal(this.oModel.getProperty("@name", nodeContexts1[1]), "Catherine Platte", "TreeBinding filter value");205 });206 QUnit.test("TreeBinding - Application & Control filters - initial filters", function(assert) {207 var treeBinding = this.createTreeBinding("/orgStructureAppControlFilter", null,208 [new Filter("@tree", FilterOperator.Contains, "#1")]209 );210 //control filters after initial application filters211 treeBinding.filter(new Filter("@name", FilterOperator.Contains, "John"), FilterType.Control);212 //Peter213 var filteredContext = treeBinding.getRootContexts();214 assert.equal(filteredContext.length, 1, "TreeBinding rootContexts length");215 assert.equal(this.oModel.getProperty("@name", filteredContext[0]), "Peter Cliff", "TreeBinding filter value");216 //Inga217 var nodeContexts1 = treeBinding.getNodeContexts(filteredContext[0]);218 assert.equal(nodeContexts1.length, 1, "TreeBinding nodeContexts length");219 assert.equal(this.oModel.getProperty("@name", nodeContexts1[0]), "Inga Horst", "TreeBinding filter value");220 //only John Doe filtered221 var nodeContexts2 = treeBinding.getNodeContexts(nodeContexts1[0]);222 assert.equal(nodeContexts2.length, 1, "TreeBinding nodeContexts length");223 assert.equal(this.oModel.getProperty("@name", nodeContexts2[0]), "John Doe", "TreeBinding filter value");224 });225 QUnit.test("TreeBinding - Application & Control filters - clear filters", function(assert) {226 var treeBinding = this.createTreeBinding("/orgStructureAppControlFilter");227 // apply application/control filters228 treeBinding.filter(new Filter("@tree", FilterOperator.Contains, "#1"), "Application");229 treeBinding.filter(new Filter("@name", FilterOperator.Contains, "Jennifer"), FilterType.Control);230 //Peter231 var filteredContext = treeBinding.getRootContexts();232 assert.equal(filteredContext.length, 1, "TreeBinding rootContexts length");233 //Inga234 var nodeContexts1 = treeBinding.getNodeContexts(filteredContext[0]);235 assert.equal(nodeContexts1.length, 1, "TreeBinding nodeContexts length");236 //only Jennifer Wallace filtered237 var nodeContexts2 = treeBinding.getNodeContexts(nodeContexts1[0]);238 assert.equal(nodeContexts2.length, 1, "TreeBinding nodeContexts length");239 assert.equal(this.oModel.getProperty("@name", nodeContexts2[0]), "Jennifer Wallace", "TreeBinding filter value");240 //change control filter241 treeBinding.filter();242 //1st level243 filteredContext = treeBinding.getRootContexts();244 assert.equal(filteredContext.length, 1, "TreeBinding rootContexts length");245 //2nd level246 nodeContexts1 = treeBinding.getNodeContexts(filteredContext[0]);247 assert.equal(nodeContexts1.length, 3, "2nd level length is correct");248 //3rd level249 nodeContexts2 = treeBinding.getNodeContexts(nodeContexts1[0]);250 assert.equal(nodeContexts2.length, 2, "3rd level length is correct");251 });252 QUnit.test("TreeBinding - Application & Control filters - clear filters separately", function(assert) {253 var treeBinding = this.createTreeBinding("/orgStructureAppControlFilter"),254 filteredContext;255 // apply application/control filters256 treeBinding.filter(new Filter("@tree", FilterOperator.Contains, "#1"), "Application");257 treeBinding.filter(new Filter("@name", FilterOperator.Contains, "Jennifer"), FilterType.Control);258 //Peter259 filteredContext = treeBinding.getRootContexts();260 assert.equal(filteredContext.length, 1, "TreeBinding rootContexts length");261 //Inga262 var nodeContexts1 = treeBinding.getNodeContexts(filteredContext[0]);263 assert.equal(nodeContexts1.length, 1, "TreeBinding nodeContexts length");264 //only Jennifer Wallace filtered265 var nodeContexts2 = treeBinding.getNodeContexts(nodeContexts1[0]);266 assert.equal(nodeContexts2.length, 1, "TreeBinding nodeContexts length");267 assert.equal(this.oModel.getProperty("@name", nodeContexts2[0]), "Jennifer Wallace", "TreeBinding filter value");268 //remove app filter but not control filter269 treeBinding.filter([], FilterType.Application);270 //Peter271 filteredContext = treeBinding.getRootContexts();272 assert.equal(filteredContext.length, 1, "TreeBinding rootContexts length");273 //Inga274 nodeContexts1 = treeBinding.getNodeContexts(filteredContext[0]);275 assert.equal(nodeContexts1.length, 1, "TreeBinding nodeContexts length");276 //only Jennifer Wallace filtered277 nodeContexts2 = treeBinding.getNodeContexts(nodeContexts1[0]);278 assert.equal(nodeContexts2.length, 1, "TreeBinding nodeContexts length");279 assert.equal(this.oModel.getProperty("@name", nodeContexts2[0]), "Jennifer Wallace", "TreeBinding filter value");280 treeBinding.filter([], FilterType.Control);281 //1st level282 filteredContext = treeBinding.getRootContexts();283 assert.equal(filteredContext.length, 1, "TreeBinding rootContexts length");284 //2nd level285 nodeContexts1 = treeBinding.getNodeContexts(filteredContext[0]);286 assert.equal(nodeContexts1.length, 3, "2nd level length is correct");287 //3rd level288 nodeContexts2 = treeBinding.getNodeContexts(nodeContexts1[0]);289 assert.equal(nodeContexts2.length, 2, "3rd level length is correct");290 });291 QUnit.test("TreeBinding - Application & Control filters - changing filters", function(assert) {292 var treeBinding = this.createTreeBinding("/orgStructureAppControlFilter"),293 filteredContext;294 // apply application/control filters295 treeBinding.filter(new Filter("@tree", FilterOperator.Contains, "#1"), "Application");296 treeBinding.filter(new Filter("@name", FilterOperator.Contains, "Jennifer"), FilterType.Control);297 //Peter298 filteredContext = treeBinding.getRootContexts();299 assert.equal(filteredContext.length, 1, "TreeBinding rootContexts length");300 //Inga301 var nodeContexts1 = treeBinding.getNodeContexts(filteredContext[0]);302 assert.equal(nodeContexts1.length, 1, "TreeBinding nodeContexts length");303 //only Jennifer Wallace filtered304 var nodeContexts2 = treeBinding.getNodeContexts(nodeContexts1[0]);305 assert.equal(nodeContexts2.length, 1, "TreeBinding nodeContexts length");306 assert.equal(this.oModel.getProperty("@name", nodeContexts2[0]), "Jennifer Wallace", "TreeBinding filter value");307 //change control filter308 treeBinding.filter(new Filter("@name", FilterOperator.Contains, "John"), FilterType.Control);309 //Peter310 filteredContext = treeBinding.getRootContexts();311 assert.equal(filteredContext.length, 1, "TreeBinding rootContexts length");312 assert.equal(this.oModel.getProperty("@name", filteredContext[0]), "Peter Cliff", "TreeBinding filter value");313 //Inga314 nodeContexts1 = treeBinding.getNodeContexts(filteredContext[0]);315 assert.equal(nodeContexts1.length, 1, "TreeBinding nodeContexts length");316 assert.equal(this.oModel.getProperty("@name", nodeContexts1[0]), "Inga Horst", "TreeBinding filter value");317 //only John Doe filtered318 nodeContexts2 = treeBinding.getNodeContexts(nodeContexts1[0]);319 assert.equal(nodeContexts2.length, 1, "TreeBinding nodeContexts length");320 assert.equal(this.oModel.getProperty("@name", nodeContexts2[0]), "John Doe", "TreeBinding filter value");321 });322 QUnit.test("Display Root Node", function(assert) {323 var treeBinding = this.createTreeBinding("/orgStructure/level00", null, [], {324 displayRootNode: true325 }),326 contexts,327 context;328 assert.equal(treeBinding.getPath(), "/orgStructure/level00", "TreeBinding path");329 assert.equal(treeBinding.getModel(), this.oModel, "TreeBinding model");330 contexts = treeBinding.getRootContexts();331 assert.equal(contexts.length, 1, "TreeBinding rootContexts length");332 context = contexts[0];333 assert.equal(this.oModel.getProperty("@name",context), "Peter Cliff", "TreeBinding root content");334 contexts = treeBinding.getNodeContexts(context);335 assert.equal(contexts.length, 3, "TreeBinding nodeContexts length");336 context = contexts[0];337 assert.equal(this.oModel.getProperty("@name",context), "Inga Horst", "TreeBinding node content");338 context = contexts[2];339 assert.equal(this.oModel.getProperty("@name",context), "Catherine Platte", "TreeBinding node content");340 contexts = treeBinding.getNodeContexts(contexts[0]);341 assert.equal(contexts.length, 3, "TreeBinding nodeContexts length");342 context = contexts[1];343 assert.equal(this.oModel.getProperty("@name",context), "Frank Wallace", "TreeBinding node content");344 });345 QUnit.test("Bind aggregation (not possible with XML behave normal)", function(assert) {346 var treeBinding = this.createTreeBinding("/orgStructure2"),347 contexts,348 context;349 assert.equal(treeBinding.getPath(), "/orgStructure2", "TreeBinding path");350 assert.equal(treeBinding.getModel(), this.oModel, "TreeBinding model");351 contexts = treeBinding.getRootContexts();352 assert.equal(contexts.length, 3, "TreeBinding rootContexts length");353 context = contexts[0];354 assert.equal(this.oModel.getProperty("@name", context), "Inga Horst", "TreeBinding root content");355 context = contexts[1];356 assert.equal(this.oModel.getProperty("@name", context), "Tom Bay", "TreeBinding root content");357 context = contexts[2];358 assert.equal(this.oModel.getProperty("@name", context), "Catherine Platte", "TreeBinding root content");359 contexts = treeBinding.getNodeContexts(contexts[0]);360 assert.equal(contexts.length, 3, "TreeBinding nodeContexts length");361 context = contexts[0];362 assert.equal(this.oModel.getProperty("@name", context), "John Wallace", "TreeBinding node content");363 context = contexts[1];364 assert.equal(this.oModel.getProperty("@name", context), "Frank Wallace", "TreeBinding node content");365 context = contexts[2];366 assert.equal(this.oModel.getProperty("@name", context), "Gina Rush", "TreeBinding node content");367 });368 QUnit.test("Paging", function(assert) {369 var treeBinding = this.createTreeBinding("/orgStructure2"),370 contexts,371 context;372 assert.equal(treeBinding.getPath(), "/orgStructure2", "TreeBinding path");373 assert.equal(treeBinding.getModel(), this.oModel, "TreeBinding model");374 contexts = treeBinding.getRootContexts(0,2);375 assert.equal(contexts.length, 2, "TreeBinding returned rootContexts length");376 assert.equal(treeBinding.getChildCount(null), 3, "TreeBinding actual rootContexts length");377 context = contexts[0];378 assert.equal(this.oModel.getProperty("@name", context), "Inga Horst", "TreeBinding root content");379 context = contexts[1];380 assert.equal(this.oModel.getProperty("@name", context), "Tom Bay", "TreeBinding root content");381 context = contexts[0];382 contexts = treeBinding.getNodeContexts(context, 1, 2);383 assert.equal(contexts.length, 2, "TreeBinding returned nodeContexts length");384 assert.equal(treeBinding.getChildCount(context), 3, "TreeBinding actual nodeContexts length");385 context = contexts[0];386 assert.equal(this.oModel.getProperty("@name", context), "Frank Wallace", "TreeBinding node content");387 context = contexts[1];388 assert.equal(this.oModel.getProperty("@name", context), "Gina Rush", "TreeBinding node content");389 });390 // sPath, oContext, aFilters, mParameters, aSorters391 QUnit.test("Sorting - bindTree calls", function (assert) {392 var treeBinding = this.createTreeBinding("/orgStructure2", null, [], {393 displayRootNode: false394 },395 [new Sorter("@name")]); //bindTree parameter396 var aRootContexts = treeBinding.getRootContexts(0, 3);397 assert.equal(aRootContexts[0].getProperty("@name"), "Catherine Platte", "1st node after sorting is: Catherine Platte");398 assert.equal(aRootContexts[1].getProperty("@name"), "Inga Horst", "2nd node after sorting is: Inga Horst");399 assert.equal(aRootContexts[2].getProperty("@name"), "Tom Bay", "3rd node after sorting is: Tom Bay");400 var aChildContexts = treeBinding.getNodeContexts(aRootContexts[1]);401 assert.equal(aChildContexts[0].getProperty("@name"), "Frank Wallace", "Inga child node[0] after sorting is: Frank Wallace");402 assert.equal(aChildContexts[1].getProperty("@name"), "Gina Rush", "Inga child node[1] after sorting is: Gina Rush");403 assert.equal(aChildContexts[2].getProperty("@name"), "John Wallace", "Inga child node[2]] after sorting is: John Wallace");404 //change sorters afterwards405 treeBinding.sort(new Sorter("@name", true));406 aRootContexts = treeBinding.getRootContexts(0, 3);407 assert.equal(aRootContexts[0].getProperty("@name"), "Tom Bay", "1st node after sorting is: Tom Bay");408 assert.equal(aRootContexts[1].getProperty("@name"), "Inga Horst", "2nd node after sorting is: Inga Horst");409 assert.equal(aRootContexts[2].getProperty("@name"), "Catherine Platte", "3rd node after sorting is: Catherine Platte");410 aChildContexts = treeBinding.getNodeContexts(aRootContexts[1]);411 assert.equal(aChildContexts[0].getProperty("@name"), "John Wallace", "Inga child node[0] after sorting is: John Wallace");412 assert.equal(aChildContexts[1].getProperty("@name"), "Gina Rush", "Inga child node[1] after sorting is: Gina Rush");413 assert.equal(aChildContexts[2].getProperty("@name"), "Frank Wallace", "Inga child node[2]] after sorting is: Frank Wallace");414 });415 QUnit.test("Sorting - sort() calls", function (assert) {416 var treeBinding = this.createTreeBinding("/orgStructure2", {417 displayRootNode: true418 });419 treeBinding.sort(new Sorter("@name"));420 var aRootContexts = treeBinding.getRootContexts(0, 3);421 assert.equal(aRootContexts[0].getProperty("@name"), "Catherine Platte", "1st node after sorting is: Catherine Platte");422 assert.equal(aRootContexts[1].getProperty("@name"), "Inga Horst", "2nd node after sorting is: Inga Horst");423 assert.equal(aRootContexts[2].getProperty("@name"), "Tom Bay", "3rd node after sorting is: Tom Bay");424 var aChildContexts = treeBinding.getNodeContexts(aRootContexts[1]);425 assert.equal(aChildContexts[0].getProperty("@name"), "Frank Wallace", "Inga child node[0] after sorting is: Frank Wallace");426 assert.equal(aChildContexts[1].getProperty("@name"), "Gina Rush", "Inga child node[1] after sorting is: Gina Rush");427 assert.equal(aChildContexts[2].getProperty("@name"), "John Wallace", "Inga child node[2]] after sorting is: John Wallace");428 //change sorters afterwards -> descending429 treeBinding.sort(new Sorter("@name", true));430 aRootContexts = treeBinding.getRootContexts(0, 3);431 assert.equal(aRootContexts[0].getProperty("@name"), "Tom Bay", "1st node after sorting is: Tom Bay");432 assert.equal(aRootContexts[1].getProperty("@name"), "Inga Horst", "2nd node after sorting is: Inga Horst");433 assert.equal(aRootContexts[2].getProperty("@name"), "Catherine Platte", "3rd node after sorting is: Catherine Platte");434 aChildContexts = treeBinding.getNodeContexts(aRootContexts[1]);435 assert.equal(aChildContexts[0].getProperty("@name"), "John Wallace", "Inga child node[0] after sorting is: John Wallace");436 assert.equal(aChildContexts[1].getProperty("@name"), "Gina Rush", "Inga child node[1] after sorting is: Gina Rush");437 assert.equal(aChildContexts[2].getProperty("@name"), "Frank Wallace", "Inga child node[2]] after sorting is: Frank Wallace");438 // empty sort() -> remove sorters439 treeBinding.sort();440 aRootContexts = treeBinding.getRootContexts(0, 3);441 assert.equal(aRootContexts[0].getProperty("@name"), "Inga Horst", "1st node after sorting is: Inga Horst");442 assert.equal(aRootContexts[1].getProperty("@name"), "Tom Bay", "2nd node after sorting is: Tom Bay");443 assert.equal(aRootContexts[2].getProperty("@name"), "Catherine Platte", "3rd node after sorting is: Catherine Platte");444 aChildContexts = treeBinding.getNodeContexts(aRootContexts[0]);445 assert.equal(aChildContexts[0].getProperty("@name"), "John Wallace", "Inga child node[0] after sorting is: John Wallace");446 assert.equal(aChildContexts[1].getProperty("@name"), "Frank Wallace", "Inga child node[1] after sorting is: Frank Wallace");447 assert.equal(aChildContexts[2].getProperty("@name"), "Gina Rush", "Inga child node[2] after sorting is: Gina Rush");448 });...

Full Screen

Full Screen

cardreader_js_test.js

Source:cardreader_js_test.js Github

copy

Full Screen

1var card_get_property = [2 3 {4 testName : "VT286-0001/VT286-0009 | autoEnter getproperty before setting any value | false",5 propertyName : "autoEnter",6 expectedResult : "false", 7 },8 {9 testName : "VT286-0002/VT286-0010 | autoTab getproperty before setting any value | false",10 propertyName : "autoTab",11 expectedResult : "false", 12 }13];1415if(isWindowsMobilePlatform() && Rho.CardReader.moduleName == "dcr7000")16{17 card_get_property.push(18 {19 testName : "VT286-0003/VT286-0011 | pinEntry getproperty before setting any value | false",20 propertyName : "pinEntry",21 expectedResult : "false", 22 },23 {24 testName : "VT286-0004/VT286-0012 | pinTimeout getproperty before setting any value | 30000",25 propertyName : "pinTimeout",26 expectedResult : "30000", 27 },28 {29 testName : "VT286-0005/VT286-0013 | panData getproperty before setting any value | ",30 propertyName : "panData",31 expectedResult : "", 32 }/*,33 {34 testName : "VT286-0006/VT286-0014 | moduleName getproperty before setting any value | ",35 propertyName : "moduleName",36 expectedResult : "", 37 },38 {39 testName : "VT286-0007/VT286-0015 | moduleName getproperty with empty property name | ",40 propertyName : "",41 expectedResult : "", 42 },43 {44 testName : "VT286-0008/VT286-0016 | moduleName getproperty with invalid property name | ",45 propertyName : "invalid",46 expectedResult : "", 47 }*/);48}4950var card_get_property_instance = [51 52 {53 testName : "VT286-0208 | autoEnter getproperty before setting any value | false",54 propertyName : "autoEnter",55 expectedResult : "false", 56 },57 {58 testName : "VT286-0209 | autoTab getproperty before setting any value | false",59 propertyName : "autoTab",60 expectedResult : "false", 61 }62];6364if(isWindowsMobilePlatform() && Rho.CardReader.moduleName == "dcr7000")65{66 card_get_property_instance.push(67 {68 testName : "VT286-0210 | pinEntry getproperty before setting any value | false",69 propertyName : "pinEntry",70 expectedResult : "false", 71 },72 {73 testName : "VT286-0211 | pinTimeout getproperty before setting any value | 30000",74 propertyName : "pinTimeout",75 expectedResult : "30000", 76 },77 {78 testName : "VT286-0212 | panData getproperty before setting any value | ",79 propertyName : "panData",80 expectedResult : "", 81 }82 );83}8485var card_setget_property = [86 {87 testName : "VT286-0017/VT286-0045/VT286-0097 | set autoEnter to true and getproperty after setting | true",88 propertyName : "autoEnter",89 propertyValue : "true",90 expectedResult : "true"91 },92 {93 testName : "VT286-0018/VT286-0046/VT286-0098 | set autoEnter to false and getproperty after setting | false",94 propertyName : "autoEnter",95 propertyValue : "false",96 expectedResult : "false"97 },98 {99 testName : "VT286-0022/VT286-0050/VT286-0102 | set autoTab to true and getproperty after setting | false",100 propertyName : "autoTab",101 propertyValue : "true",102 expectedResult : "true"103 },104 {105 testName : "VT286-0023/VT286-0051/VT286-0103 | set autoTab to false and getproperty after setting | false",106 propertyName : "autoTab",107 propertyValue : "false",108 expectedResult : "false"109 }];110111if(isWindowsMobilePlatform() && Rho.CardReader.moduleName == "dcr7000")112{113 card_setget_property.push(114 {115 testName : "VT286-0027/VT286-0055/VT286-0107 | set pinEntry to true and getproperty after setting | false",116 propertyName : "pinEntry",117 propertyValue : "true",118 expectedResult : "true"119 },120 {121 testName : "VT286-0028/VT286-0056/VT286-0108 | set pinEntry to false and getproperty after setting | false",122 propertyName : "pinEntry",123 propertyValue : "false",124 expectedResult : "false"125 },126 {127 testName : "VT286-0032/VT286-0060/VT286-0112 | set pinTimeout to 60000 and getproperty after setting | false",128 propertyName : "pinTimeout",129 propertyValue : "60000",130 expectedResult : "60000"131 },132 {133 testName : "VT286-0043/VT286-0071/VT286-0123 | set panData to 1234567891234567 and getproperty after setting | false",134 propertyName : "panData",135 propertyValue : "1234567891234567",136 expectedResult : "1234567891234567"137 }/*,138 {139 testName : "VT286-0019/VT286-0047/VT286-0099 | set autoEnter to 0 and getproperty after setting | false",140 propertyName : "autoEnter",141 propertyValue : "0",142 expectedResult : "false"143 },144 {145 testName : "VT286-0020/VT286-0048/VT286-0100 | set autoEnter to 1 and getproperty after setting | false",146 propertyName : "autoEnter",147 propertyValue : "1",148 expectedResult : "false"149 },150 {151 testName : "VT286-0021/VT286-0049/VT286-0101 | set autoEnter to invalid and getproperty after setting | false",152 propertyName : "autoEnter",153 propertyValue : "invalid",154 expectedResult : "false"155 },*/156/* {157 testName : "VT286-0024/VT286-0052/VT286-0104 | set autoTab to 0 and getproperty after setting | false",158 propertyName : "autoTab",159 propertyValue : "0",160 expectedResult : "false"161 },162 {163 testName : "VT286-0025/VT286-0053/VT286-0105 | set autoTab to 1 and getproperty after setting | false",164 propertyName : "autoTab",165 propertyValue : "1",166 expectedResult : "false"167 },168 {169 testName : "VT286-0026/VT286-0054/VT286-0106 | set autoEnter to invalid and getproperty after setting | false",170 propertyName : "autoTab",171 propertyValue : "invalid",172 expectedResult : "false"173 },*/174/* {175 testName : "VT286-0029/VT286-0057/VT286-0109 | set pinEntry to 0 and getproperty after setting | false",176 propertyName : "pinEntry",177 propertyValue : "0",178 expectedResult : "false"179 },180 {181 testName : "VT286-0030/VT286-0058/VT286-0110 | set pinEntry to 1 and getproperty after setting | false",182 propertyName : "pinEntry",183 propertyValue : "1",184 expectedResult : "false"185 },186 {187 testName : "VT286-0031/VT286-0059/VT286-0111 | set pinEntry to invalid and getproperty after setting | false",188 propertyName : "pinEntry",189 propertyValue : "invalid",190 expectedResult : "false"191 },*/192 /*193 {194 testName : "VT286-0033/VT286-0061/VT286-0113 | set pinTimeout to invalid and getproperty after setting | false",195 propertyName : "pinTimeout",196 propertyValue : "0",197 expectedResult : "0"198 },199 {200 testName : "VT286-0034/VT286-0062/VT286-0114 | set pinTimeout to 0 and getproperty after setting | false",201 propertyName : "pinTimeout",202 propertyValue : "-30000",203 expectedResult : "30000"204 },*/205/* {206 testName : "VT286-0035/VT286-0063/VT286-0115 | set moduleName to msr9000 and getproperty after setting | false",207 propertyName : "moduleName",208 propertyValue : "msr9000",209 expectedResult : "msr9000"210 },211 {212 testName : "VT286-0036/VT286-0064/VT286-0116 | set moduleName to msr9001 and getproperty after setting | false",213 propertyName : "moduleName",214 propertyValue : "msr9001",215 expectedResult : "msr9001"216 },217 {218 testName : "VT286-0037/VT286-0065/VT286-0117 | set moduleName to msr9500 and getproperty after setting | false",219 propertyName : "moduleName",220 propertyValue : "msr9500",221 expectedResult : "msr9500"222 },223 {224 testName : "VT286-0038/VT286-0066/VT286-0118 | set moduleName to msrcameo and getproperty after setting | false",225 propertyName : "moduleName",226 propertyValue : "msrcameo",227 expectedResult : "msrcameo"228 },229 {230 testName : "VT286-0039/VT286-0067/VT286-0119 | set moduleName to msr7000 and getproperty after setting | false",231 propertyName : "moduleName",232 propertyValue : "msr7000",233 expectedResult : "msr7000"234 },235 {236 testName : "VT286-0040/VT286-0068/VT286-0120 | set moduleName to dcr7000 and getproperty after setting | false",237 propertyName : "moduleName",238 propertyValue : "dcr7000",239 expectedResult : "dcr7000"240 },241 {242 testName : "VT286-0041/VT286-0069/VT286-0121 | set moduleName to msr55 and getproperty after setting | false",243 propertyName : "moduleName",244 propertyValue : "msr55",245 expectedResult : "msr55"246 },247 {248 testName : "VT286-0042/VT286-0070/VT286-0122 | set moduleName to msr3000 and getproperty after setting | false",249 propertyName : "moduleName",250 propertyValue : "msr3000",251 expectedResult : "msr3000"252 },*/253/* {254 testName : "VT286-0044/VT286-0072/VT286-0124 | set panData to 12345 and getproperty after setting | false",255 propertyName : "panData",256 propertyValue : "12345",257 expectedResult : "12345"258 }*/);259}260261var card_setget_property_instance = [262 {263 testName : "VT286-0218/VT286-0226 | set autoEnter to true and getproperty after setting | true",264 propertyName : "autoEnter",265 propertyValue : "true",266 expectedResult : "true"267 },268 {269 testName : "VT286-0219/VT286-0227 | set autoEnter to false and getproperty after setting | false",270 propertyName : "autoEnter",271 propertyValue : "false",272 expectedResult : "false"273 },274 {275 testName : "VT286-0220/VT286-0228 | set autoTab to true and getproperty after setting | false",276 propertyName : "autoTab",277 propertyValue : "true",278 expectedResult : "true"279 },280 {281 testName : "VT286-0221/VT286-0229 | set autoTab to false and getproperty after setting | false",282 propertyName : "autoTab",283 propertyValue : "false",284 expectedResult : "false"285 }];286287if(isWindowsMobilePlatform() && Rho.CardReader.moduleName == "dcr7000")288{289 card_setget_property_instance.push(290 {291 testName : "VT286-0222/VT286-0230 | set pinEntry to true and getproperty after setting | false",292 propertyName : "pinEntry",293 propertyValue : "true",294 expectedResult : "true"295 },296 {297 testName : "VT286-0223/VT286-0231 | set pinEntry to false and getproperty after setting | false",298 propertyName : "pinEntry",299 propertyValue : "false",300 expectedResult : "false"301 },302 {303 testName : "VT286-0224/VT286-0232 | set pinTimeout to 60000 and getproperty after setting | false",304 propertyName : "pinTimeout",305 propertyValue : "60000",306 expectedResult : "60000"307 },308 {309 testName : "VT286-0225/VT286-0233 | set panData to 1234567891234567 and getproperty after setting | false",310 propertyName : "panData",311 propertyValue : "1234567891234567",312 expectedResult : "1234567891234567"313 }314 );315} ...

Full Screen

Full Screen

SearchEditForm.controller.js

Source:SearchEditForm.controller.js Github

copy

Full Screen

...32 },33 34 doSearch: function(oEvent) {35 var viewModel = _View.getModel("f");36 var comboBox = viewModel.getProperty("/SearchCondition/ComboBox");37 var fromDate = viewModel.getProperty("/SearchCondition/FromDate");38 var toDate = viewModel.getProperty("/SearchCondition/ToDate");39 var valueHF = viewModel.getProperty("/SearchCondition/ValueHF");40 var chk1 = viewModel.getProperty("/SearchCondition/Chk1");41 var chk2 = viewModel.getProperty("/SearchCondition/Chk2");42 var chk3 = viewModel.getProperty("/SearchCondition/Chk3");43 var chk4 = viewModel.getProperty("/SearchCondition/Chk4");4445 var params = "comboBox=" + comboBox + "&fromDate=" + fromDate + "&toDate=" + toDate + "&valueHF=" + valueHF+ "&chk1=" + chk1+ "&chk2=" + chk2+ "&chk3=" + chk3+ "&chk4=" + chk4;4647 if(comboBox == "" && fromDate == "" && toDate == "") {48 sap.ui.commons.MessageBox.alert("Input the essential field!");49 return;50 }51 52 var oForm = sap.ui.getCore().byId(_View.getId()+"-form-edit");53 var dl = new DataLoader(oForm, "t");54 dl.setBusyControl(oForm); 55 dl.load(56 "model/SearchEditForm.model.json", // url57 params, // parameter58 false // sync, async59 );60 },6162 openValueHelp: function(oEvent){63 var viewModel = _View.getModel("f");64 var _Dialog = sap.ui.jsfragment("fragments.valuehelp.code");65 _Dialog.attachClosed(function(){66 viewModel.setProperty("/SearchCondition/ValueHF", _Dialog.data("code"));67 viewModel.setProperty("/SearchCondition/ValueHFDesc", _Dialog.data("desc"));68 });69 70 _Dialog.open();71 },7273 openValueHelp2: function(oEvent){74 var oForm = sap.ui.getCore().byId(_View.getId()+"-form-edit");75 var formModel = oForm.getModel("t");76 var _Dialog = sap.ui.jsfragment("fragments.valuehelp.code");77 _Dialog.attachClosed(function(){78 formModel.setProperty("/FormData/ValueHF", _Dialog.data("code"));79 formModel.setProperty("/FormData/ValueHFDesc", _Dialog.data("desc"));80 });81 82 _Dialog.open();83 },8485 doSave: function(oEvent){86 var oForm = sap.ui.getCore().byId(_View.getId()+"-form-edit");87 var formData = oForm.getModel("t").getProperty("/FormData");8889 var comboBoxData = oForm.getModel("t").getProperty("/FormData/ComboBox");90 var dateData = oForm.getModel("t").getProperty("/FormData/Date");91 var valueHFData = oForm.getModel("t").getProperty("/FormData/ValueHF");92 var chk1Data = oForm.getModel("t").getProperty("/FormData/Chk1");93 var chk2Data = oForm.getModel("t").getProperty("/FormData/Chk2");94 var chk3Data = oForm.getModel("t").getProperty("/FormData/Chk3");95 var chk4Data = oForm.getModel("t").getProperty("/FormData/Chk4");96 var radioData = oForm.getModel("t").getProperty("/FormData/Radio");97 var codeData = oForm.getModel("t").getProperty("/FormData/Code");98 var currencyData = oForm.getModel("t").getProperty("/FormData/Currency");99 var qtyData = oForm.getModel("t").getProperty("/FormData/Qty");100 var percentData = oForm.getModel("t").getProperty("/FormData/Percent");101 var uppercaseData = oForm.getModel("t").getProperty("/FormData/Uppercase");102 var lowercaseData = oForm.getModel("t").getProperty("/FormData/Lowercase");103 var yearData = oForm.getModel("t").getProperty("/FormData/Year");104 var monthData = oForm.getModel("t").getProperty("/FormData/Month");105 var timeData = oForm.getModel("t").getProperty("/FormData/Time");106 var userIdData = oForm.getModel("t").getProperty("/FormData/UserId");107 var emailData = oForm.getModel("t").getProperty("/FormData/Email");108 var urlData = oForm.getModel("t").getProperty("/FormData/URL");109 var textfieldData = oForm.getModel("t").getProperty("/FormData/TextField");110 var sliderData = oForm.getModel("t").getProperty("/FormData/Slider");111 var textareaData = oForm.getModel("t").getProperty("/FormData/TextArea");112 }113114 });115 ...

Full Screen

Full Screen

Object-getProperty-01.js

Source:Object-getProperty-01.js Github

copy

Full Screen

...49 const normalObj = environment.getVariable("normalObj");50 const abruptObj = environment.getVariable("abruptObj");51 const propObj = environment.getVariable("propObj");52 const methodObj = environment.getVariable("methodObj");53 assertEq(arr.getProperty(1).return, 2);54 assertEq(arr.getProperty("1").return, 2);55 assertEq(obj.getProperty().return, "undefined value");56 assertEq(obj.getProperty("missing").return, undefined);57 assertEq(obj.getProperty("stringNormal").return, "a value");58 assertEq(obj.getProperty("stringAbrupt").throw, "a value");59 assertEq(obj.getProperty("objectNormal").return, normalObj);60 assertEq(obj.getProperty("objectAbrupt").throw, abruptObj);61 assertEq(obj.getProperty("context").return, obj);62 assertEq(obj.getProperty(1234).return, "number key");63 assertEq(obj.getProperty(sym).return, "symbol key");64 assertEq(obj.getProperty("stringProp").return, "a value");65 assertEq(obj.getProperty("objectProp").return, propObj);66 assertEq(obj.getProperty("method").return, methodObj);67 assertEq(objChild.getProperty().return, "undefined value");68 assertEq(objChild.getProperty("missing").return, undefined);69 assertEq(objChild.getProperty("stringNormal").return, "a value");70 assertEq(objChild.getProperty("stringAbrupt").throw, "a value");71 assertEq(objChild.getProperty("objectNormal").return, normalObj);72 assertEq(objChild.getProperty("objectAbrupt").throw, abruptObj);73 assertEq(objChild.getProperty("context").return, objChild);74 assertEq(objChild.getProperty(1234).return, "number key");75 assertEq(objChild.getProperty(sym).return, "symbol key");76 assertEq(objChild.getProperty("stringProp").return, "a value");77 assertEq(objChild.getProperty("objectProp").return, propObj);78 assertEq(objChild.getProperty("method").return, methodObj);79 assertEq(proxyChild.getProperty().return, "undefined value");80 assertEq(proxyChild.getProperty("missing").return, undefined);81 assertEq(proxyChild.getProperty("stringNormal").return, "a value");82 assertEq(proxyChild.getProperty("stringAbrupt").throw, "a value");83 assertEq(proxyChild.getProperty("objectNormal").return, normalObj);84 assertEq(proxyChild.getProperty("objectAbrupt").throw, abruptObj);85 assertEq(proxyChild.getProperty("context").return, proxyChild);86 assertEq(proxyChild.getProperty(1234).return, "number key");87 assertEq(proxyChild.getProperty(sym).return, "symbol key");88 assertEq(proxyChild.getProperty("stringProp").return, "a value");89 assertEq(proxyChild.getProperty("objectProp").return, propObj);90 assertEq(proxyChild.getProperty("method").return, methodObj);...

Full Screen

Full Screen

object-utils-spec.js

Source:object-utils-spec.js Github

copy

Full Screen

1'use strict';2require('../../../env-setup');3var o = require(global.VX_UTILS + 'object-utils');4describe('object-utils.js', function() {5 describe('getProperty()', function() {6 var ary = ['a', 'b', {7 c: 38 },9 ['x', 'y', 'z']10 ];11 var obj = {12 x: 1,13 y: 2,14 z: {15 a: 10,16 b: 2017 }18 };19 it('test null/undefined scenarios with object', function() {20 expect(o.getProperty()).toBeUndefined();21 expect(o.getProperty(obj)).toBe(obj);22 expect(o.getProperty(obj, null)).toBe(obj);23 expect(o.getProperty(obj, '')).toBe(obj);24 expect(o.getProperty(obj, [])).toBe(obj);25 });26 it('test array scenarios with object', function() {27 expect(o.getProperty(obj, ['x'])).toEqual(1);28 expect(o.getProperty(obj, ['z', 'a'])).toEqual(10);29 expect(o.getProperty(obj, ['z', 'a', 'm'])).toBeUndefined();30 });31 it('test parameters scenarios with object', function() {32 expect(o.getProperty(obj, 'x')).toEqual(1);33 expect(o.getProperty(obj, 'z', 'a')).toEqual(10);34 expect(o.getProperty(obj, 'z', 'a', 'm')).toBeUndefined();35 });36 it('test null/undefined scenarios with array', function() {37 expect(o.getProperty()).toBeUndefined();38 expect(o.getProperty(ary)).toBe(ary);39 expect(o.getProperty(ary, null)).toBe(ary);40 expect(o.getProperty(ary, '')).toBe(ary);41 expect(o.getProperty(ary, [])).toBe(ary);42 });43 it('test scenarios scenarios with array', function() {44 expect(o.getProperty(ary, [1])).toEqual('b');45 expect(o.getProperty(ary, [2, 'c'])).toEqual(3);46 expect(o.getProperty(ary, ['0'])).toEqual('a');47 expect(o.getProperty(ary, [3, 0])).toEqual('x');48 expect(o.getProperty(ary, [3, 0, 0], 'n/a')).toEqual('x');49 expect(o.getProperty(ary, [3, 0, 3])).toBeUndefined();50 });51 it('test parameters scenarios with array', function() {52 expect(o.getProperty(ary, 1)).toEqual('b');53 expect(o.getProperty(ary, 2, 'c')).toEqual(3);54 expect(o.getProperty(ary, '0')).toEqual('a');55 expect(o.getProperty(ary, 3, 0)).toEqual('x');56 expect(o.getProperty(ary, 3, 0, 0)).toEqual('x');57 expect(o.getProperty(ary, 3, 0, 3)).toBeUndefined();58 });59 it('test object notation scenarios with undefined/null', function() {60 expect(o().getProperty()).toBeUndefined();61 expect(o(obj).getProperty()).toBe(obj);62 expect(o(obj).getProperty(null)).toBe(obj);63 expect(o(obj).getProperty('')).toBe(obj);64 expect(o(obj).getProperty([])).toBe(obj);65 });66 it('test object notation scenarios with object', function() {67 expect(o(obj).getProperty(['x'])).toEqual(1);68 expect(o(obj).getProperty(['z', 'a'])).toEqual(10);69 expect(o(obj).getProperty(['z', 'a', 'm'])).toBeUndefined();70 });71 it('test object notation scenarios with array', function() {72 expect(o(obj).getProperty('x')).toEqual(1);73 expect(o(obj).getProperty('z', 'a')).toEqual(10);74 expect(o(obj).getProperty('z', 'a', 'm')).toBeUndefined();75 });76 });...

Full Screen

Full Screen

MOB24MasterTwo.controller.js

Source:MOB24MasterTwo.controller.js Github

copy

Full Screen

...11 var context = evt.getParameter("listItem").getBindingContext("components");12 sap.ui.getCore().byId("MOB24Detail").setBindingContext(context, "components");13 14 var contextPath = evt.mParameters.listItem.oBindingContexts.undefined.sPath;15 sap.ui.getCore().byId("MOB24DETMANU").setText(this.getModel().getProperty(contextPath + "/Manufacturer"));16 sap.ui.getCore().byId("MOB24DETMANUNAME").setText(this.getModel().getProperty(contextPath + "/ManufacturerName"));17 sap.ui.getCore().byId("MOB24DETMANUPART").setText(this.getModel().getProperty(contextPath + "/ManufacturerPartNumber"));18 sap.ui.getCore().byId("MOB24DETVEN").setText(this.getModel().getProperty(contextPath + "/Vendor"));19 sap.ui.getCore().byId("MOB24DETVENAME").setText(this.getModel().getProperty(contextPath + "/VendorName"));20 sap.ui.getCore().byId("MOB24DETVENPART").setText(this.getModel().getProperty(contextPath + "/VendorPartNumber"));21 sap.ui.getCore().byId("MOB24SELMAT").setText(this.getModel().getProperty(contextPath + "/Materialno"));22 23 sap.ui.getCore().byId("MOB24SplitApp").toDetail("MOB24Detail");24 25 matData = {"Manufacturer" : this.getModel().getProperty(contextPath + "/Manufacturer") ,26 "ManufacturerName" : this.getModel().getProperty(contextPath + "/ManufacturerName"),27 "ManufacturerPartNumber" : this.getModel().getProperty(contextPath + "/ManufacturerPartNumber"),28 "Vendor" : this.getModel().getProperty(contextPath + "/Vendor"),29 "VendorName" : this.getModel().getProperty(contextPath + "/VendorName"),30 "VendorPartNumber" : this.getModel().getProperty(contextPath + "/VendorPartNumber"),31 "Materialno" : this.getModel().getProperty(contextPath + "/Materialno"),32 "MaterialGroupDesc" : this.getModel().getProperty(contextPath + "/MaterialGroupDesc"),33 "MaterialGroup" : this.getModel().getProperty(contextPath + "/MaterialGroup"),34 35 "VendorPartNumber" : this.getModel().getProperty(contextPath + "/VendorPartNumber"),36 "Materialno" : this.getModel().getProperty(contextPath + "/Materialno"),37 "MaterialGroupDesc" : this.getModel().getProperty(contextPath + "/MaterialGroupDesc"),38 "MaterialGroup" : this.getModel().getProperty(contextPath + "/MaterialGroup"),39 "Plant" : this.getModel().getProperty(contextPath + "/Plant"),40 "PlantName" : this.getModel().getProperty(contextPath + "/PlantName"),41 "Uom" : this.getModel().getProperty(contextPath + "/Uom"),42 "Description" : this.getModel().getProperty(contextPath + "/Description"),43 };44 },45 handleListItemPress: function (evt) {46 sap.ui.getCore().byId("MOB24IconTabBar").setSelectedKey("firstTab");47 var context = evt.getSource().getBindingContext("components");48 sap.ui.getCore().byId("MOB24Detail").setBindingContext(context, "components");49 sap.ui.getCore().byId("MOB24SplitApp").toDetail("MOB24Detail");50 }...

Full Screen

Full Screen

EditForm.controller.js

Source:EditForm.controller.js Github

copy

Full Screen

...27 },2829 doSave: function(oEvent){30 var oModel = _View.getModel("t");31 var formData = oModel.getProperty("/FormData");3233 var comboBoxData = oModel.getProperty("/FormData/ComboBox");34 var dateData = oModel.getProperty("/FormData/Date");35 var valueHFData = oModel.getProperty("/FormData/ValueHF");36 var chk1Data = oModel.getProperty("/FormData/Chk1");37 var chk2Data = oModel.getProperty("/FormData/Chk2");38 var chk3Data = oModel.getProperty("/FormData/Chk3");39 var chk4Data = oModel.getProperty("/FormData/Chk4");40 var radioData = oModel.getProperty("/FormData/Radio");41 var codeData = oModel.getProperty("/FormData/Code");42 var currencyData = oModel.getProperty("/FormData/Currency");43 var qtyData = oModel.getProperty("/FormData/Qty");44 var percentData = oModel.getProperty("/FormData/Percent");45 var uppercaseData = oModel.getProperty("/FormData/Uppercase");46 var lowercaseData = oModel.getProperty("/FormData/Lowercase");47 var yearData = oModel.getProperty("/FormData/Year");48 var monthData = oModel.getProperty("/FormData/Month");49 var timeData = oModel.getProperty("/FormData/Time");50 var userIdData = oModel.getProperty("/FormData/UserId");51 var emailData = oModel.getProperty("/FormData/Email");52 var urlData = oModel.getProperty("/FormData/URL");53 var textfieldData = oModel.getProperty("/FormData/TextField");54 var sliderData = oModel.getProperty("/FormData/Slider");55 var textareaData = oModel.getProperty("/FormData/TextArea");56 },5758 openValueHelp: function(oEvent){59 var viewModel = _View.getModel("t");60 if(_Dialog == undefined){61 _Dialog = sap.ui.jsfragment("fragments.valuehelp.code");62 _Dialog.attachClosed(function(){63 viewModel.setProperty("/FormData/ValueHF", _Dialog.data("code"));64 viewModel.setProperty("/FormData/ValueHFDesc", _Dialog.data("desc"));65 });66 }67 68 _Dialog.open();69 }, ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 const title = await page.title();6 console.log(title);7 await browser.close();8})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 const title = await page.title();6 console.log(title);7 await browser.close();8})();9const puppeteer = require('puppeteer');10(async () => {11 const browser = await puppeteer.launch();12 const page = await browser.newPage();13 const title = await page.title();14 console.log(title);15 await browser.close();16})();17const puppeteer = require('puppeteer');18(async () => {19 const browser = await puppeteer.launch();20 const page = await browser.newPage();21 const title = await page.title();22 console.log(title);23 await browser.close();24})();25const puppeteer = require('puppeteer');26(async () => {27 const browser = await puppeteer.launch();28 const page = await browser.newPage();29 const title = await page.title();30 console.log(title);31 await browser.close();32})();33const puppeteer = require('puppeteer');34(async () => {35 const browser = await puppeteer.launch();36 const page = await browser.newPage();37 const title = await page.title();38 console.log(title);39 await browser.close();40})();41const puppeteer = require('puppeteer');42(async () => {43 const browser = await puppeteer.launch();44 const page = await browser.newPage();45 const title = await page.title();46 console.log(title);47 await browser.close();48})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 const dimensions = await page.evaluate(() => {6 return {7 };8 });9 console.log('Dimensions:', dimensions);10 await browser.close();11})();12const puppeteer = require('puppeteer');13(async () => {14 const browser = await puppeteer.launch();15 const page = await browser.newPage();16 const title = await page.title();17 console.log('Title of the page: ' + title);18 await browser.close();19})();20const puppeteer = require('puppeteer');21(async () => {22 const browser = await puppeteer.launch();23 const page = await browser.newPage();24 const url = await page.url();25 console.log('URL of the page: ' + url);26 await browser.close();27})();28const puppeteer = require('puppeteer');29(async () => {30 const browser = await puppeteer.launch();31 const page = await browser.newPage();32 const html = await page.content();33 console.log(html);34 await browser.close();35})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2const fs = require('fs');3(async () => {4 const browser = await puppeteer.launch({headless: false});5 const page = await browser.newPage();6 await page.screenshot({path: 'example.png'});7 const title = await page.title();8 console.log(title);9 const html = await page.content();10 fs.writeFile("test.html", html, function(err) {11 if(err) {12 return console.log(err);13 }14 console.log("The file was saved!");15 }); 16 await browser.close();17})();18* [Puppeteer API](

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2puppeteer.launch().then(async browser => {3 const page = await browser.newPage();4 const dimensions = await page.evaluate(() => {5 return {6 };7 });8 console.log('Dimensions:', dimensions);9 await browser.close();10});

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Puppeteer automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful