How to use fragment method in wpt

Best JavaScript code snippet using wpt

Fragment.qunit.js

Source:Fragment.qunit.js Github

copy

Full Screen

...19 var oModel = new JSONModel();20 oModel.setData(data);21 sap.ui.getCore().setModel(oModel);22 // inline JS Fragment definition23 sap.ui.jsfragment("example.fragment.jstest", {24 createContent: function(oController) {25 var oJSFragBtn = new Button("jsfragbtn", {26 text: "This is a JS Fragment",27 press: oController.doSomething28 });29 return oJSFragBtn;30 }31 });32 // View definition33 sap.ui.jsview("example.fragment.test", {34 getControllerName: function() {35 return "example.fragment.test";36 },37 createContent: function(oController) {38 var oPanel = new Panel(this.createId("myPanel"));39 var oJsFragment = sap.ui.fragment("example.fragment.jstest", "JS", oController);40 oPanel.addContent(oJsFragment);41 var myXml = '<Button xmlns="sap.ui.commons" id="xmlfragbtn" text="This is an XML Fragment" press="doSomething"></Button>';42 var oXmlFragment = sap.ui.xmlfragment({43 fragmentContent: myXml44 }, oController);45 oPanel.addContent(oXmlFragment);46 var myHtml = '<div id="htmlfragbtn" data-sap-ui-type="sap.ui.commons.Button" data-text="This is an HTML Fragment" data-press="doSomething"></div>';47 var oHtmlFragment = sap.ui.htmlfragment({48 fragmentContent: myHtml49 }, oController);50 oPanel.addContent(oHtmlFragment);51 return [oPanel];52 }53 });54 // Controller definition55 sap.ui.controller("example.fragment.test", {56 onInit: function() {},57 doSomething: function(oEvent) {58 assert.ok(true, "Controller method 'doSomething' called");59 }60 });61 // TESTS62 QUnit.module("External Fragments");63 var oDummyController = {64 doSomething: function() {65 assert.ok(true, "Dummy Controller method 'doSomething' called");66 }67 };68 QUnit.test("XML Fragment loaded from file", function(assert) {69 var oFragment = sap.ui.xmlfragment("testdata.fragments.XMLTestFragment", oDummyController);70 oFragment.placeAt("content1");71 sap.ui.getCore().applyChanges();72 var id = oFragment.getId();73 assert.equal(id.substr(0, 8), "__layout", "Fragment ID should be generated");74 assert.ok(document.getElementById(id), "XML Fragment should be rendered");75 var aContent = oFragment.getContent();76 var btn1 = aContent[0];77 var btn2 = aContent[1];78 assert.equal(btn1.getId(), "btnInXmlFragment", "Button with given ID should have exactly this ID");79 assert.equal(btn2.getId().substr(0, 8), "__button", "Button with no given ID should have a generated ID");80 // Data binding81 assert.equal(btn2.$().text(), DATABOUND_TEXT, "Second Button should have text from data binding");82 // find controls by ID83 var btn = sap.ui.getCore().byId("btnInXmlFragment");84 assert.ok(btn, "Button should be found by ID");85 assert.ok(btn instanceof Button, "Button should be found by ID");86 });87 QUnit.test("XML Fragment loaded from file with given Fragment ID", function(assert) {88 var oFragment = sap.ui.xmlfragment("myXmlFrag", "testdata.fragments.XMLTestFragment", oDummyController);89 oFragment.placeAt("content1");90 sap.ui.getCore().applyChanges();91 var id = oFragment.getId();92 assert.equal(id.substr(0, 8), "__layout", "Fragment ID should be generated");93 assert.ok(document.getElementById(id), "XML Fragment should be rendered");94 var aContent = oFragment.getContent();95 var btn1 = aContent[0];96 var btn2 = aContent[1];97 assert.equal(btn1.getId(), "myXmlFrag--btnInXmlFragment", "Button with given ID should have this ID with Fragment ID prefix");98 assert.equal(btn2.getId().substr(0, 8), "__button", "Button with no given ID should have a generated ID");99 // Data binding100 assert.equal(btn2.$().text(), DATABOUND_TEXT, "Second Button should have text from data binding");101 // find controls by ID102 var btn = sap.ui.core.Fragment.byId("myXmlFrag", "btnInXmlFragment");103 assert.ok(btn, "Button should be found by ID");104 assert.ok(btn instanceof Button, "Button should be found by ID");105 });106 QUnit.test("XML Fragment loaded from file with given Fragment ID and root control ID", function(assert) {107 var oFragment = sap.ui.xmlfragment("myXmlFrag1", "testdata.fragments.XMLTestFragmentWithId", oDummyController);108 oFragment.placeAt("content1");109 sap.ui.getCore().applyChanges();110 var id = oFragment.getId();111 assert.equal(id, "myXmlFrag1--layout", "Root control ID should be prefixed");112 // find controls by ID113 var oLayout = sap.ui.core.Fragment.byId("myXmlFrag1", "layout");114 assert.ok(oLayout, "Layout should be found by ID");115 assert.ok(oLayout instanceof HorizontalLayout, "Found object should be instance of layout");116 });117 QUnit.test("HTML Fragment loaded from file", function(assert) {118 var oFragment = sap.ui.htmlfragment("testdata.fragments.HTMLTestFragment", oDummyController);119 oFragment.placeAt("content1");120 sap.ui.getCore().applyChanges();121 var id = oFragment.getId();122 assert.equal(id.substr(0, 8), "__layout", "Fragment ID should be generated");123 assert.ok(document.getElementById(id), "HTML Fragment should be rendered");124 var aContent = oFragment.getContent();125 var btn1 = aContent[0];126 var btn2 = aContent[1];127 assert.equal(btn1.getId(), "btnInHtmlFragment", "Button with given ID should have exactly this ID");128 assert.equal(btn2.getId().substr(0, 8), "__button", "Button with no given ID should have a generated ID");129 // Data binding130 assert.equal(btn2.$().text(), DATABOUND_TEXT, "Second Button should have text from data binding");131 // find controls by ID132 var btn = sap.ui.getCore().byId("btnInHtmlFragment");133 assert.ok(btn, "Button should be found by ID");134 assert.ok(btn instanceof Button, "Button should be found by ID");135 });136 QUnit.test("HTML Fragment loaded from file with given Fragment ID", function(assert) {137 var oFragment = sap.ui.htmlfragment("myHtmlFrag", "testdata.fragments.HTMLTestFragment", oDummyController);138 oFragment.placeAt("content1");139 sap.ui.getCore().applyChanges();140 var id = oFragment.getId();141 assert.equal(id.substr(0, 8), "__layout", "Fragment ID should be generated");142 assert.ok(document.getElementById(id), "HTML Fragment should be rendered");143 var aContent = oFragment.getContent();144 var btn1 = aContent[0];145 var btn2 = aContent[1];146 assert.equal(btn1.getId(), "myHtmlFrag--btnInHtmlFragment", "Button with given ID should have this ID with Fragment ID prefix");147 assert.equal(btn2.getId().substr(0, 8), "__button", "Button with no given ID should have a generated ID");148 // Data binding149 assert.equal(btn2.$().text(), DATABOUND_TEXT, "Second Button should have text from data binding");150 // find controls by ID151 var btn = sap.ui.core.Fragment.byId("myHtmlFrag", "btnInHtmlFragment");152 assert.ok(btn, "Button should be found by ID");153 assert.ok(btn instanceof Button, "Button should be found by ID");154 });155 QUnit.test("HTML Fragment loaded from file with given Fragment ID and root control ID", function(assert) {156 var oFragment = sap.ui.htmlfragment("myHtmlFrag1", "testdata.fragments.HTMLTestFragmentWithId", oDummyController);157 oFragment.placeAt("content1");158 sap.ui.getCore().applyChanges();159 var id = oFragment.getId();160 assert.equal(id, "myHtmlFrag1--layout", "Root control ID should be prefixed");161 // find controls by ID162 var oLayout = sap.ui.core.Fragment.byId("myHtmlFrag1", "layout");163 assert.ok(oLayout, "Layout should be found by ID");164 assert.ok(oLayout instanceof HorizontalLayout, "Found object should be instance of layout");165 });166 QUnit.test("JS Fragment loaded from file", function(assert) {167 var oFragment = sap.ui.jsfragment("testdata.fragments.JSTestFragment", oDummyController);168 oFragment.placeAt("content1");169 sap.ui.getCore().applyChanges();170 var id = oFragment.getId();171 assert.equal(id.substr(0, 8), "__layout", "Fragment ID should be generated");172 assert.ok(document.getElementById(id), "JS Fragment should be rendered");173 var aContent = oFragment.getContent();174 var btn1 = aContent[0];175 var btn2 = aContent[1];176 assert.equal(btn1.getId(), "btnInJsFragment", "Button with given ID should have exactly this ID");177 assert.equal(btn2.getId().substr(0, 8), "__button", "Button with no given ID should have a generated ID");178 // Data binding179 assert.equal(btn2.$().text(), DATABOUND_TEXT, "Second Button should have text from data binding");180 // find controls by ID181 var btn = sap.ui.getCore().byId("btnInJsFragment");182 assert.ok(btn, "Button should be found by ID");183 assert.ok(btn instanceof Button, "Button should be found by ID");184 });185 QUnit.test("JS Fragment loaded from file with given Fragment ID", function(assert) {186 var oFragment = sap.ui.jsfragment("myJsFrag", "testdata.fragments.JSTestFragment", oDummyController);187 oFragment.placeAt("content1");188 sap.ui.getCore().applyChanges();189 var id = oFragment.getId();190 assert.equal(id.substr(0, 8), "__layout", "Fragment ID should be generated");191 assert.ok(document.getElementById(id), "JS Fragment should be rendered");192 var aContent = oFragment.getContent();193 var btn1 = aContent[0];194 var btn2 = aContent[1];195 assert.equal(btn1.getId(), "myJsFrag--btnInJsFragment", "Button with given ID should have this ID with Fragment ID prefix");196 assert.equal(btn2.getId().substr(0, 8), "__button", "Button with no given ID should have a generated ID");197 // Data binding198 assert.equal(btn2.$().text(), DATABOUND_TEXT, "Second Button should have text from data binding");199 // find controls by ID200 var btn = sap.ui.core.Fragment.byId("myJsFrag", "btnInJsFragment");201 assert.ok(btn, "Button should be found by ID");202 assert.ok(btn instanceof Button, "Button should be found by ID");203 });204 QUnit.test("JS Fragment loaded from file with given Fragment ID and root control ID", function(assert) {205 var oFragment = sap.ui.jsfragment("myJsFrag1", "testdata.fragments.JSTestFragmentWithId", oDummyController);206 oFragment.placeAt("content1");207 sap.ui.getCore().applyChanges();208 var id = oFragment.getId();209 assert.equal(id, "myJsFrag1--layout", "Root control ID should be prefixed");210 // find controls by ID211 var oLayout = sap.ui.core.Fragment.byId("myJsFrag1", "layout");212 assert.ok(oLayout, "Layout should be found by ID");213 assert.ok(oLayout instanceof HorizontalLayout, "Found object should be instance of layout");214 });215 QUnit.module("Inline Fragments");216 var oViewWithFragments;217 QUnit.test("Inline Fragments preconditions", function(assert) {218 assert.ok(!document.getElementById("jsfragbtn"), "Fragment should not be rendered");219 assert.ok(!document.getElementById("xmlfragbtn"), "Fragment should not be rendered");220 assert.ok(!document.getElementById("htmlfragbtn"), "Fragment should not be rendered");221 });222 QUnit.test("JSView creation with Fragments used inside", function(assert) {223 oViewWithFragments = sap.ui.jsview("myView", "example.fragment.test");224 oViewWithFragments.placeAt("content2");225 sap.ui.getCore().applyChanges();226 assert.ok(document.getElementById("myView"), "JSView should be rendered");227 });228 QUnit.test("Inline JS Fragment", function(assert) {229 assert.expect(2); // incl. Button click handler230 assert.ok(document.getElementById("jsfragbtn"), "Fragment should be rendered");231 // Fragment knows Controller, Fragment calling Controller methods232 QUnitUtils.triggerEvent("click", "jsfragbtn");233 });234 QUnit.test("Inline XML Fragment", function(assert) {235 assert.expect(2); // incl. Button click handler236 assert.ok(document.getElementById("xmlfragbtn"), "Fragment should be rendered");237 // Fragment knows Controller, Fragment calling Controller methods238 QUnitUtils.triggerEvent("click", "xmlfragbtn");239 });240 QUnit.test("Inline HTML Fragment", function(assert) {241 assert.expect(2); // incl. Button click handler242 assert.ok(document.getElementById("htmlfragbtn"), "Fragment should be rendered");243 // Fragment knows Controller, Fragment calling Controller methods244 QUnitUtils.triggerEvent("click", "htmlfragbtn");245 });246 QUnit.module("Fragments referenced from XMLViews");247 var oXmlView, oXmlFragmentInXmlView, oXmlFragmentWithIdInXmlView, oHtmlFragmentInXmlView,248 oHtmlFragmentWithIdInXmlView, oJsFragmentInXmlView, oJsFragmentWithIdInXmlView;249 var DATABOUND_TEXT_IN_VIEW = "Text from Databinding in View";250 QUnit.test("XMLView Rendering", function(assert) {251 oXmlView = sap.ui.xmlview("testdata.fragments.XMLViewWithFragments");252 oXmlView.placeAt("content3");253 sap.ui.getCore().applyChanges();254 var data = {255 someText: DATABOUND_TEXT_IN_VIEW256 };257 var oModel = new JSONModel();258 oModel.setData(data);259 oXmlView.setModel(oModel);260 sap.ui.getCore().applyChanges(); // update data binding in DOM261 var aContent = oXmlView.getContent();262 oXmlFragmentInXmlView = aContent[1];263 oXmlFragmentWithIdInXmlView = aContent[2];264 oJsFragmentInXmlView = aContent[4];265 oJsFragmentWithIdInXmlView = aContent[5];266 oHtmlFragmentInXmlView = aContent[7];267 oHtmlFragmentWithIdInXmlView = aContent[8];268 assert.ok(document.getElementById(oXmlView.getId()), "XMLView should be rendered");269 });270 QUnit.test("XML Fragment in XMLView", function(assert) {271 assert.expect(8); // incl. Controller function on press272 var id = oXmlFragmentInXmlView.getId();273 assert.ok(document.getElementById(id), "XML Fragment should be rendered");274 assert.equal(id.substr(0, 8), "__layout", "Fragment ID should be generated, with no View prefix");275 var btn1id = oXmlFragmentInXmlView.getContent()[0].getId();276 assert.equal(btn1id, "__xmlview0--btnInXmlFragment", "static Control ID inside Fragment should be prefixed by View ID");277 QUnitUtils.triggerEvent("click", btn1id);278 var btn2 = oXmlFragmentInXmlView.getContent()[1];279 assert.equal(btn2.getId().substr(0, 8), "__button", "Second Button ID should be generated, with no View prefix");280 assert.equal(btn2.$().text(), DATABOUND_TEXT_IN_VIEW, "Second Button should have text from data binding");281 // find controls by ID282 var btn = oXmlView.byId("btnInXmlFragment");283 assert.ok(btn, "Button should be found by ID");284 assert.ok(btn instanceof Button, "Button should be found by ID");285 });286 QUnit.test("XML Fragment in XMLView with given Fragment ID", function(assert) {287 assert.expect(8); // incl. Controller function on press288 var id = oXmlFragmentWithIdInXmlView.getId();289 assert.ok(document.getElementById(id), "Fragment should be rendered");290 assert.equal(id.substr(0, 8), "__layout", "Fragment ID should be generated, with no View prefix");291 var btn1id = oXmlFragmentWithIdInXmlView.getContent()[0].getId();292 assert.equal(btn1id, "__xmlview0--xmlInXml--btnInXmlFragment", "static Control ID inside Fragment should be prefixed by View ID and Fragment ID");293 QUnitUtils.triggerEvent("click", btn1id);294 var btn2 = oXmlFragmentWithIdInXmlView.getContent()[1];295 assert.equal(btn2.getId().substr(0, 8), "__button", "Second Button ID should be generated, with no View prefix");296 assert.equal(btn2.$().text(), DATABOUND_TEXT_IN_VIEW, "Second Button should have text from data binding");297 // find controls by ID298 var btn = oXmlView.byId(sap.ui.core.Fragment.createId("xmlInXml", "btnInXmlFragment"));299 assert.ok(btn, "Button should be found by ID");300 assert.ok(btn instanceof Button, "Button should be found by ID");301 });302 QUnit.test("JS Fragment in XMLView", function(assert) {303 assert.expect(8); // incl. Controller function on press304 var id = oJsFragmentInXmlView.getId();305 assert.ok(document.getElementById(id), "Fragment should be rendered");306 assert.equal(id.substr(0, 8), "__layout", "Fragment ID should be generated, with no View prefix");307 var btn1id = oJsFragmentInXmlView.getContent()[0].getId();308 assert.equal(btn1id, "__xmlview0--btnInJsFragment", "static Control ID inside Fragment should be prefixed by View ID");309 QUnitUtils.triggerEvent("click", btn1id);310 var btn2 = oJsFragmentInXmlView.getContent()[1];311 assert.equal(btn2.getId().substr(0, 8), "__button", "Second Button ID should be generated, with no View prefix");312 assert.equal(btn2.$().text(), DATABOUND_TEXT_IN_VIEW, "Second Button should have text from data binding");313 // find controls by ID314 var btn = oXmlView.byId("btnInJsFragment");315 assert.ok(btn, "Button should be found by ID");316 assert.ok(btn instanceof Button, "Button should be found by ID");317 });318 QUnit.test("JS Fragment in XMLView with given Fragment ID", function(assert) {319 assert.expect(8); // incl. Controller function on press320 var id = oJsFragmentWithIdInXmlView.getId();321 assert.ok(document.getElementById(id), "Fragment should be rendered");322 assert.equal(id.substr(0, 8), "__layout", "Fragment ID should be generated, with no View prefix");323 var btn1id = oJsFragmentWithIdInXmlView.getContent()[0].getId();324 assert.equal(btn1id, "__xmlview0--jsInXml--btnInJsFragment", "static Control ID inside Fragment should be prefixed by View ID and Fragment ID");325 QUnitUtils.triggerEvent("click", btn1id);326 var btn2 = oJsFragmentWithIdInXmlView.getContent()[1];327 assert.equal(btn2.getId().substr(0, 8), "__button", "Second Button ID should be generated, with no View prefix");328 assert.equal(btn2.$().text(), DATABOUND_TEXT_IN_VIEW, "Second Button should have text from data binding");329 // find controls by ID330 var btn = oXmlView.byId(sap.ui.core.Fragment.createId("jsInXml", "btnInJsFragment"));331 assert.ok(btn, "Button should be found by ID");332 assert.ok(btn instanceof Button, "Button should be found by ID");333 });334 QUnit.test("HTML Fragment in XMLView", function(assert) {335 assert.expect(8); // incl. Controller function on press336 var id = oHtmlFragmentInXmlView.getId();337 assert.ok(document.getElementById(id), "Fragment should be rendered");338 assert.equal(id.substr(0, 8), "__layout", "Fragment ID should be generated, with no View prefix");339 var btn1id = oHtmlFragmentInXmlView.getContent()[0].getId();340 assert.equal(btn1id, "__xmlview0--btnInHtmlFragment", "static Control ID inside Fragment should be prefixed by View ID");341 QUnitUtils.triggerEvent("click", btn1id);342 var btn2 = oHtmlFragmentInXmlView.getContent()[1];343 assert.equal(btn2.getId().substr(0, 8), "__button", "Second Button ID should be generated, with no View prefix");344 assert.equal(btn2.$().text(), DATABOUND_TEXT_IN_VIEW, "Second Button should have text from data binding");345 // find controls by ID346 var btn = oXmlView.byId("btnInHtmlFragment");347 assert.ok(btn, "Button should be found by ID");348 assert.ok(btn instanceof Button, "Button should be found by ID");349 });350 QUnit.test("HTML Fragment in XMLView with given Fragment ID", function(assert) {351 assert.expect(8); // incl. Controller function on press352 var id = oHtmlFragmentWithIdInXmlView.getId();353 assert.ok(document.getElementById(id), "Fragment should be rendered");354 assert.equal(id.substr(0, 8), "__layout", "Fragment ID should be generated, with no View prefix");355 var btn1id = oHtmlFragmentWithIdInXmlView.getContent()[0].getId();356 assert.equal(btn1id, "__xmlview0--htmlInXml--btnInHtmlFragment", "static Control ID inside Fragment should be prefixed by View ID and Fragment ID");357 QUnitUtils.triggerEvent("click", btn1id);358 var btn2 = oHtmlFragmentWithIdInXmlView.getContent()[1];359 assert.equal(btn2.getId().substr(0, 8), "__button", "Second Button ID should be generated, with no View prefix");360 assert.equal(btn2.$().text(), DATABOUND_TEXT_IN_VIEW, "Second Button should have text from data binding");361 // find controls by ID362 var btn = oXmlView.byId(sap.ui.core.Fragment.createId("htmlInXml", "btnInHtmlFragment"));363 assert.ok(btn, "Button should be found by ID");364 assert.ok(btn instanceof Button, "Button should be found by ID");365 });366 QUnit.module("Dialog Fragments");367 var DATABOUND_TEXT_IN_DIALOG = "Text from Databinding in Dialog";368 var data = {369 dialogText: DATABOUND_TEXT_IN_DIALOG370 };371 var oDialogModel = new JSONModel();372 oDialogModel.setData(data);373 QUnit.test("JS Fragment as Dialog", function(assert) {374 var done = assert.async();375 var oDialog = sap.ui.jsfragment("testdata.fragments.JSFragmentDialog", {376 closeDialog: function() {377 oDialog.close();378 }379 });380 assert.ok(!document.getElementById("jsDialog"), "Fragment should not yet be rendered");381 oDialog.open();382 assert.ok(document.getElementById("jsDialog"), "Fragment should be rendered now");383 window.setTimeout(function() {384 assert.ok(oDialog.isOpen(), "Dialog should be open now");385 assert.equal(jQuery("#jsDialogTxt").text(), DATABOUND_GLOBAL_TEXT_IN_DIALOG, "TextView should have text from global data binding");386 oDialog.setModel(oDialogModel);387 sap.ui.getCore().applyChanges();388 assert.equal(jQuery("#jsDialogTxt").text(), DATABOUND_TEXT_IN_DIALOG, "TextView should have text from Dialog data binding");389 QUnitUtils.triggerEvent("click", "jsDialogBtn"); // close it390 window.setTimeout(function() {391 assert.ok(!oDialog.isOpen(), "Dialog should be closed now");392 oDialog.destroy();393 done();394 }, 600);395 }, 600);396 });397 QUnit.test("XML Fragment as Dialog", function(assert) {398 var done = assert.async();399 var oDialog = sap.ui.xmlfragment("testdata.fragments.XMLFragmentDialog", {400 closeDialog: function() {401 oDialog.close();402 }403 });404 assert.ok(!document.getElementById("xmlDialog"), "Fragment should not yet be rendered");405 oDialog.open();406 assert.ok(document.getElementById("xmlDialog"), "Fragment should be rendered now");407 window.setTimeout(function() {408 assert.ok(oDialog.isOpen(), "Dialog should be open now");409 assert.equal(jQuery("#xmlDialogTxt").text(), DATABOUND_GLOBAL_TEXT_IN_DIALOG, "TextView should have text from global data binding");410 oDialog.setModel(oDialogModel);411 sap.ui.getCore().applyChanges();412 assert.equal(jQuery("#xmlDialogTxt").text(), DATABOUND_TEXT_IN_DIALOG, "TextView should have text from Dialog data binding");413 QUnitUtils.triggerEvent("click", "xmlDialogBtn"); // close it414 window.setTimeout(function() {415 assert.ok(!oDialog.isOpen(), "Dialog should be closed now");416 oDialog.destroy();417 done();418 }, 600);419 }, 600);420 });421 QUnit.test("HTML Fragment as Dialog", function(assert) {422 var done = assert.async();423 var oDialog = sap.ui.htmlfragment("testdata.fragments.HTMLFragmentDialog", {424 closeDialog: function() {425 oDialog.close();426 }427 });428 assert.ok(!document.getElementById("htmlDialog"), "Fragment should not yet be rendered");429 oDialog.open();430 assert.ok(document.getElementById("htmlDialog"), "Fragment should be rendered now");431 window.setTimeout(function() {432 assert.ok(oDialog.isOpen(), "Dialog should be open now");433 assert.equal(jQuery("#htmlDialogTxt").text(), DATABOUND_GLOBAL_TEXT_IN_DIALOG, "TextView should have text from global data binding");434 oDialog.setModel(oDialogModel);435 sap.ui.getCore().applyChanges();436 assert.equal(jQuery("#htmlDialogTxt").text(), DATABOUND_TEXT_IN_DIALOG, "TextView should have text from Dialog data binding");437 QUnitUtils.triggerEvent("click", "htmlDialogBtn"); // close it438 window.setTimeout(function() {439 assert.ok(!oDialog.isOpen(), "Dialog should be closed now");440 oDialog.destroy();441 done();442 }, 600);443 }, 600);444 });445 QUnit.module("Fragments with no Controller");446 QUnit.test("XML Fragment loaded from file", function(assert) {447 assert.expect(2);448 var oFragment = sap.ui.xmlfragment("testdata.fragments.XMLTestFragmentNoController");449 oFragment.placeAt("content4");450 sap.ui.getCore().applyChanges();451 var id = oFragment.getId();452 assert.ok(document.getElementById(id), "Fragment should be rendered");453 var aContent = oFragment.getContent();454 var btn1 = aContent[0];455 assert.equal(btn1.getId().substr(0, 8), "__button", "Button with no given ID should have a generated ID");456 });457 QUnit.test("JS Fragment loaded from file", function(assert) {458 assert.expect(3); // including one check in the View' createContent method459 var oFragment = sap.ui.jsfragment("testdata.fragments.JSTestFragmentNoController");460 oFragment.placeAt("content4");461 sap.ui.getCore().applyChanges();462 var id = oFragment.getId();463 assert.ok(document.getElementById(id), "Fragment should be rendered");464 var aContent = oFragment.getContent();465 var btn1 = aContent[0];466 assert.equal(btn1.getId().substr(0, 8), "__button", "Button with no given ID should have a generated ID");467 });468 QUnit.test("HTML Fragment loaded from file", function(assert) {469 assert.expect(2);470 var oFragment = sap.ui.htmlfragment("testdata.fragments.HTMLTestFragmentNoController");471 oFragment.placeAt("content4");472 sap.ui.getCore().applyChanges();473 var id = oFragment.getId();474 assert.ok(document.getElementById(id), "Fragment should be rendered");475 var aContent = oFragment.getContent();476 var btn1 = aContent[0];477 assert.equal(btn1.getId().substr(0, 8), "__button", "Button with no given ID should have a generated ID");478 });479 QUnit.module("DataBinding", {480 beforeEach: function() {},481 afterEach: function() {482 jQuery("#binding").empty();483 }484 });...

Full Screen

Full Screen

Fragment.js

Source:Fragment.js Github

copy

Full Screen

...215 * Instantiate a Fragment - this method loads the Fragment content, instantiates it, and returns this content.216 * The Fragment object itself is not an entity which has further significance beyond this constructor.217 *218 * To instantiate an existing Fragment, call this method as:219 * sap.ui.fragment(sName, sType, [oController]);220 * The sName must correspond to an XML Fragment which can be loaded221 * via the module system (fragmentName + suffix ".fragment.[typeextension]") and which defines the Fragment content.222 * If oController is given, the (event handler) methods referenced in the Fragment will be called on this controller.223 * Note that Fragments may require a Controller to be given and certain methods to be available.224 *225 * The Fragment types "XML", "JS" and "HTML" are available by default; additional Fragment types can be implemented226 * and added using the sap.ui.core.Fragment.registerType() function.227 *228 *229 * Advanced usage:230 * To instantiate a Fragment and give further configuration options, call this method as:231 * sap.ui.fragment(oFragmentConfig, [oController]);232 * The oFragmentConfig object can have the following properties:233 * - "fragmentName": the name of the Fragment, as above234 * - "fragmentContent": the definition of the Fragment content itself. When this property is given, any given name is ignored.235 * The type of this property depends on the Fragment type, e.g. it could be a string for XML Fragments.236 * - "type": the type of the Fragment, as above (mandatory)237 * - "id": the ID of the Fragment (optional)238 * Further properties may be supported by future or custom Fragment types. Any given properties239 * will be forwarded to the Fragment implementation.240 *241 * If you want to give a fixed ID for the Fragment, please use the advanced version of this method call with the242 * configuration object or use the typed factories like sap.ui.xmlfragment(...) or sap.ui.jsfragment(...).243 * Otherwise the Fragment ID is generated. In any case, the Fragment ID will be used as prefix for the ID of244 * all contained controls.245 *246 * @param {string} sName the Fragment name247 * @param {string} sType the Fragment type, e.g. "XML", "JS", or "HTML"248 * @param {sap.ui.core.mvc.Controller} [oController] the Controller which should be used by the controls in the Fragment.249 * Note that some Fragments may not need a Controller and other may need one - and even rely on certain methods implemented in the Controller.250 * @public251 * @static252 * @deprecated since 1.58, use {@link sap.ui.core.Fragment.load} instead253 * @return {sap.ui.core.Control|sap.ui.core.Control[]} the root Control(s) of the Fragment content254 */255 sap.ui.fragment = function (sName, sType, oController) {256 var sFragmentType;257 if (typeof (sType) === "string") {258 sFragmentType = sType.toLowerCase();259 } else if (typeof (sType) === "object" && typeof (sType.fragmentName) === "string") {260 sFragmentType = sType.fragmentName.toLowerCase();261 } else {262 sFragmentType = "";263 }264 Log.info("Do not use deprecated factory function 'sap.ui." + sFragmentType + "fragment'. Require 'sap/ui/core/Fragment' and use 'load()' instead", "sap.ui." + sFragmentType + "fragment", null, function () {265 return {266 type: "sap.ui." + sFragmentType + "fragment",267 name: sFragmentType ? sName + ".fragment." + sFragmentType : sName268 };269 });270 return fragmentFactory(sName, sType, oController);271 };272 /**273 * @see sap.ui.core.Fragment.load274 */275 function fragmentFactory(vName, vType, oController) {276 var mSettings = {};277 if (typeof (vName) === "string") { // normal call278 mSettings.fragmentName = vName;279 mSettings.oController = oController;280 mSettings.type = vType;281 } else if (typeof (vName) === "object") { // advanced call with config object282 mSettings = vName; // pass all config parameters to the implementation283 if (vType) { // second parameter "vType" is in this case the optional Controller284 mSettings.oController = vType;285 }286 } else {287 Log.error("sap.ui.fragment() must be called with Fragment name or config object as first parameter, but is: " + vName);288 }289 return new Fragment(mSettings);290 }291 /**292 * Loads and instantiates a Fragment.293 * A Promise is returned, which resolves with the Fragments content.294 *295 * The Fragment object itself is not an entity with significance beyond this factory.296 *297 * The Fragment types "XML", "JS" and "HTML" are available by default; additional Fragment types can be added using298 * the sap.ui.core.Fragment.registerType() function.299 *300 * Further properties may be supported by future or custom Fragment types. Any given properties301 * will be forwarded to the Fragment implementation.302 *303 * If no fixed ID is given, the Fragment ID is generated. In any case, the Fragment ID will be used as prefix for the IDs of304 * all contained controls.305 *306 * @param {object} mOptions options map307 * @param {string} [mOptions.name] must be supplied if no "definition" parameter is given. The Fragment name must correspond to an XML Fragment which308 * can be loaded via the module system309 * (fragmentName + suffix ".fragment.[typeextension]") and which contains the Fragment definition.310 * If "mOptions.controller" is supplied, the (event handler-) methods referenced in the Fragment will be called on this Controller.311 * Note that Fragments may require a Controller to be given and certain methods to be implemented by it.312 * @param {string} [mOptions.type=XML] the Fragment type, e.g. "XML", "JS", or "HTML" (see above). Default is "XML"313 * @param {string} [mOptions.definition] definition of the Fragment content. When this property is supplied, the "name" parameter must not be used.314 * The type of this property depends on the Fragment type, e.g. it could be a string for XML Fragments.315 * @param {string} [mOptions.id] the ID of the Fragment316 * @param {sap.ui.core.mvc.Controller} [mOptions.controller] the Controller which should be used by the controls in the Fragment.317 * Note that some Fragments may not need a Controller while others may need one and certain methods to be implemented by it.318 * @public319 * @static320 * @since 1.58321 * @returns {Promise} resolves with the resulting {sap.ui.core.Control|sap.ui.core.Control[]} after fragment parsing and instantiation322 */323 Fragment.load = function(mOptions) {324 var mParameters = Object.assign({}, mOptions);325 mParameters.type = mParameters.type || "XML";326 // map new parameter names to classic API, delete new names to avoid assertion failures327 mParameters.fragmentName = mParameters.name;328 mParameters.fragmentContent = mParameters.definition;329 mParameters.oController = mParameters.controller;330 delete mParameters.name;331 delete mParameters.definition;332 delete mParameters.controller;333 return Promise.resolve(fragmentFactory(mParameters));334 };335 /**336 * Instantiates an XML-based Fragment.337 *338 * To instantiate a Fragment, call this method as:339 * sap.ui.xmlfragment([sId], sFragmentName, [oController]);340 * The Fragment instance ID is optional and will be used as prefix for the ID of all341 * contained controls. If no ID is passed, controls will not be prefixed.342 * The sFragmentName must correspond to an XML Fragment which can be loaded343 * via the module system (fragmentName + ".fragment.xml") and which defines the Fragment.344 * If oController is given, the methods referenced in the Fragment will be called on this controller.345 * Note that Fragments may require a Controller to be given and certain methods to be available.346 *347 *348 * Advanced usage:349 * To instantiate a Fragment and optionally directly give the XML definition instead of loading it from a file,350 * call this method as:351 * sap.ui.xmlfragment(oFragmentConfig, [oController]);352 * The oFragmentConfig object can either have a "fragmentName" or a "fragmentContent" property.353 * fragmentContent is optional and can hold the Fragment definition as XML string; if not354 * given, fragmentName must be given and the Fragment content definition is loaded by the module system.355 * Again, if oController is given, the methods referenced in the Fragment will be called on this controller.356 *357 * @param {string} [sId] id of the newly created Fragment358 * @param {string | object} vFragment name of the Fragment (or Fragment configuration as described above, in this case no sId may be given. Instead give the id inside the config object, if desired)359 * @param {sap.ui.core.mvc.Controller} [oController] a Controller to be used for event handlers in the Fragment360 * @public361 * @static362 * @deprecated since 1.58, use {@link sap.ui.core.Fragment.load} instead363 * @return {sap.ui.core.Control|sap.ui.core.Control[]} the root Control(s) of the created Fragment instance364 */365 sap.ui.xmlfragment = function(sId, vFragment, oController) {366 if (typeof (sId) === "string") { // basic call367 if (typeof (vFragment) === "string") { // with ID368 return sap.ui.fragment({fragmentName: vFragment, sId: sId, type: "XML"}, oController);369 } else { // no ID, sId is actually the name and vFragment the optional Controller370 return sap.ui.fragment(sId, "XML", vFragment);371 }372 } else { // advanced call373 sId.type = "XML";374 return sap.ui.fragment(sId, vFragment); // second parameter "vFragment" is the optional Controller375 }376 };377 /**378 * Defines OR instantiates an HTML-based Fragment.379 *380 * To define a JS Fragment, call this method as:381 * sap.ui.jsfragment(sName, oFragmentDefinition)382 * Where:383 * - "sName" is the name by which this fragment can be found and instantiated. If defined in its own file,384 * in order to be found by the module loading system, the file location and name must correspond to sName385 * (path + file name must be: fragmentName + ".fragment.js").386 * - "oFragmentDefinition" is an object at least holding the "createContent(oController)" method which defines387 * the Fragment content. If given during instantiation, the createContent method receives a Controller388 * instance (otherwise oController is undefined) and the return value must be one sap.ui.core.Control389 * (which could have any number of children).390 *391 *392 * To instantiate a JS Fragment, call this method as:393 * sap.ui.jsfragment([sId], sFragmentName, [oController]);394 * The Fragment ID is optional (generated if not given) and the Fragment implementation CAN use it395 * to make contained controls unique (this depends on the implementation: some JS Fragments may choose396 * not to support multiple instances within one application and not use the ID prefixing).397 * The sFragmentName must correspond to a JS Fragment which can be loaded398 * via the module system (fragmentName + ".fragment.js") and which defines the Fragment.399 * If oController is given, the methods referenced in the Fragment will be called on this controller.400 * Note that Fragments may require a Controller to be given and certain methods to be available.401 *402 *403 * @param {string} [sId] id of the newly created Fragment404 * @param {string | object} sFragmentName name of the Fragment (or Fragment configuration as described above, in this case no sId may be given. Instead give the id inside the config object, if desired)405 * @param {sap.ui.core.mvc.Controller} [oController] a Controller to be used for event handlers in the Fragment406 * @public407 * @static408 * @deprecated since 1.58, use {@link sap.ui.core.Fragment.load} instead409 * @return {sap.ui.core.Control|sap.ui.core.Control[]} the root Control(s) of the created Fragment instance410 */411 sap.ui.jsfragment = function(sName, oFragmentDefinition) { // definition of a JS Fragment412 if (typeof (sName) === "string" && typeof (oFragmentDefinition) === "object") {413 if (oFragmentDefinition.createContent) {414 // Fragment DEFINITON415 mRegistry[sName] = oFragmentDefinition;416 sap.ui.loader._.declareModule(sName.replace(/\./g, "/") + ".fragment.js");417 // TODO: return value?418 } else {419 // plain instantiation: name[+oController]420 return sap.ui.fragment(sName, "JS", oFragmentDefinition);421 }422 } else if (typeof (sName) === "string" && oFragmentDefinition === undefined) {423 // plain instantiation: name only424 return sap.ui.fragment(sName, "JS");425 } else { // ID+name[+Controller] or oConfig+[oController]426 if (typeof (sName) === "object") {427 // advanced mode: oConfig+[oController]428 sName.type = "JS";429 return sap.ui.fragment(sName, oFragmentDefinition);430 } else if (arguments && arguments.length >= 3) {431 // must be plain instantiation mode: ID+Name[+Controller]432 return sap.ui.fragment({id: sName, fragmentName: oFragmentDefinition, type: "JS"}, arguments[2]);433 } else {434 Log.error("sap.ui.jsfragment() was called with wrong parameter set: " + sName + " + " + oFragmentDefinition);435 }436 }437 };438 /**439 * Instantiates an HTML-based Fragment.440 *441 * To instantiate a Fragment, call this method as:442 * sap.ui.htmlfragment([sId], sFragmentName, [oController]);443 * The Fragment instance ID is optional and will be used as prefix for the ID of all444 * contained controls. If no ID is passed, controls will not be prefixed.445 * The sFragmentName must correspond to an HTML Fragment which can be loaded446 * via the module system (fragmentName + ".fragment.html") and which defines the Fragment.447 * If oController is given, the methods referenced in the Fragment will be called on this controller.448 * Note that Fragments may require a Controller to be given and certain methods to be available.449 *450 *451 * Advanced usage:452 * To instantiate a Fragment and optionally directly give the HTML definition instead of loading it from a file,453 * call this method as:454 * sap.ui.htmlfragment(oFragmentConfig, [oController]);455 * The oFragmentConfig object can either have a "fragmentName" or a "fragmentContent" property.456 * fragmentContent is optional and can hold the Fragment definition as XML string; if not457 * given, fragmentName must be given and the Fragment content definition is loaded by the module system.458 * Again, if oController is given, the methods referenced in the Fragment will be called on this controller.459 *460 * @param {string} [sId] id of the newly created Fragment461 * @param {string | object} vFragment name of the Fragment (or Fragment configuration as described above, in this case no sId may be given. Instead give the id inside the config object, if desired.)462 * @param {sap.ui.core.mvc.Controller} [oController] a Controller to be used for event handlers in the Fragment463 * @public464 * @static465 * @deprecated since 1.58, use {@link sap.ui.core.Fragment.load} instead466 * @return {sap.ui.core.Control|sap.ui.core.Control[]} the root Control(s) of the created Fragment instance467 */468 sap.ui.htmlfragment = function(sId, vFragment, oController) {469 if (typeof (sId) === "string") { // basic call470 if (typeof (vFragment) === "string") { // with ID471 return sap.ui.fragment({fragmentName: vFragment, sId: sId, type: "HTML"}, oController);472 } else { // no ID, sId is actually the name and vFragment the optional Controller473 return sap.ui.fragment(sId, "HTML", vFragment);474 }475 } else { // advanced call476 sId.type = "HTML";477 return sap.ui.fragment(sId, vFragment); // second parameter "vFragment" is the optional Controller478 }479 };480 // ### FRAGMENT TYPES ###481 // ### XML Fragments ###482 Fragment.registerType("XML" , {483 init: function(mSettings) {484 // use specified content or load the content definition485 if (mSettings.fragmentContent) {486 if (typeof (mSettings.fragmentContent) === "string") {487 this._xContent = jQuery.parseXML(mSettings.fragmentContent).documentElement;488 } else {489 this._xContent = mSettings.fragmentContent;490 }491 } else {...

Full Screen

Full Screen

Fragment-dbg.js

Source:Fragment-dbg.js Github

copy

Full Screen

...219 * Instantiate a Fragment - this method loads the Fragment content, instantiates it, and returns this content.220 * The Fragment object itself is not an entity which has further significance beyond this constructor.221 * 222 * To instantiate an existing Fragment, call this method as:223 * sap.ui.fragment(sName, sType, [oController]);224 * The sName must correspond to an XML Fragment which can be loaded225 * via the module system (fragmentName + suffix ".fragment.[typeextension]") and which defines the Fragment content.226 * If oController is given, the (event handler) methods referenced in the Fragment will be called on this controller.227 * Note that Fragments may require a Controller to be given and certain methods to be available.228 * 229 * The Fragment types "XML", "JS" and "HTML" are available by default; additional Fragment types can be implemented 230 * and added using the sap.ui.core.Fragment.registerType() function.231 *232 *233 * Advanced usage:234 * To instantiate a Fragment and give further configuration options, call this method as:235 * sap.ui.fragment(oFragmentConfig, [oController]);236 * The oFragmentConfig object can have the following properties:237 * - "fragmentName": the name of the Fragment, as above238 * - "fragmentContent": the definition of the Fragment content itself. When this property is given, any given name is ignored.239 * The type of this property depends on the Fragment type, e.g. it could be a string for XML Fragments.240 * - "type": the type of the Fragment, as above (mandatory)241 * - "id": the ID of the Fragment (optional)242 * Further properties may be supported by future or custom Fragment types. Any given properties 243 * will be forwarded to the Fragment implementation.244 *245 * If you want to give a fixed ID for the Fragment, please use the advanced version of this method call with the 246 * configuration object or use the typed factories like sap.ui.xmlfragment(...) or sap.ui.jsfragment(...). 247 * Otherwise the Fragment ID is generated. In any case, the Fragment ID will be used as prefix for the ID of 248 * all contained controls.249 * 250 * @param {string} sName the Fragment name251 * @param {string} sType the Fragment type, e.g. "XML", "JS", or "HTML"252 * @param {sap.ui.core.Controller} [oController] the Controller which should be used by the controls in the Fragment. Note that some Fragments may not need a Controller and other may need one - and even rely on certain methods implemented in the Controller.253 * @public254 * @static255 * @return {sap.ui.core.Control|sap.ui.core.Control[]} the root Control(s) of the Fragment content256 */257 sap.ui.fragment = function(sName, sType, oController) {258 var mSettings = {};259 if (typeof (sName) === "string") { // normal call260 mSettings.fragmentName = sName;261 mSettings.oController = oController;262 mSettings.type = sType;263 264 } else if (typeof (sName) === "object") { // advanced call with config object265 mSettings = sName; // pass all config parameters to the implementation266 if (sType) { // second parameter "sType" is in this case the optional Controller267 mSettings.oController = sType;268 }269 } else {270 jQuery.sap.log.error("sap.ui.fragment() must be called with Fragment name or config object as first parameter, but is: " + sName);271 }272 return new Fragment(mSettings);273 };274 /**275 * Instantiates an XML-based Fragment.276 *277 * To instantiate a Fragment, call this method as:278 * sap.ui.xmlfragment([sId], sFragmentName, [oController]);279 * The Fragment instance ID is optional (generated if not given) and will be used as prefix for the ID of all280 * contained controls. The sFragmentName must correspond to an XML Fragment which can be loaded281 * via the module system (fragmentName + ".fragment.xml") and which defines the Fragment.282 * If oController is given, the methods referenced in the Fragment will be called on this controller.283 * Note that Fragments may require a Controller to be given and certain methods to be available.284 * 285 * 286 * Advanced usage:287 * To instantiate a Fragment and optionally directly give the XML definition instead of loading it from a file,288 * call this method as:289 * sap.ui.xmlfragment(oFragmentConfig, [oController]);290 * The oFragmentConfig object can have a either a "fragmentName" or a "fragmentContent" property. 291 * fragmentContent is optional and can hold the Fragment definition as XML string; if not292 * given, fragmentName must be given and the Fragment content definition is loaded by the module system.293 * Again, if oController is given, the methods referenced in the Fragment will be called on this controller.294 *295 * @param {string} [sId] id of the newly created Fragment296 * @param {string | object} vFragment name of the Fragment (or Fragment configuration as described above, in this case no sId may be given. Instead give the id inside the config object, if desired)297 * @param {sap.ui.core.mvc.Controller} [oController] a Controller to be used for event handlers in the Fragment298 * @public299 * @static300 * @return {sap.ui.core.Control|sap.ui.core.Control[]} the root Control(s) of the created Fragment instance301 */302 sap.ui.xmlfragment = function(sId, vFragment, oController) {303 if (typeof (sId) === "string") { // basic call304 if (typeof (vFragment) === "string") { // with ID305 return sap.ui.fragment({fragmentName: vFragment, sId: sId, type: "XML"}, oController);306 307 } else { // no ID, sId is actually the name and vFragment the optional Controller308 return sap.ui.fragment(sId, "XML", vFragment);309 }310 } else { // advanced call311 sId.type = "XML";312 return sap.ui.fragment(sId, vFragment); // second parameter "vFragment" is the optional Controller313 }314 };315 316 /**317 * Defines OR instantiates an HTML-based Fragment.318 * 319 * To define a JS Fragment, call this method as:320 * sap.ui.jsfragment(sName, oFragmentDefinition)321 * Where:322 * - "sName" is the name by which this fragment can be found and instantiated. If defined in its own file,323 * in order to be found by the module loading system, the file location and name must correspond to sName 324 * (path + file name must be: fragmentName + ".fragment.js").325 * - "oFragmentDefinition" is an object at least holding the "createContent(oController)" method which defines326 * the Fragment content. If given during instantiation, the createContent method receives a Controller327 * instance (otherwise oController is undefined) and the return value must be one sap.ui.core.Control328 * (which could have any number of children).329 * 330 * 331 * To instantiate a JS Fragment, call this method as:332 * sap.ui.jsfragment([sId], sFragmentName, [oController]);333 * The Fragment ID is optional (generated if not given) and the Fragment implementation CAN use it334 * to make contained controls unique (this depends on the implementation: some JS Fragments may choose 335 * not to support multiple instances within one application and not use the ID prefixing).336 * The sFragmentName must correspond to a JS Fragment which can be loaded337 * via the module system (fragmentName + ".fragment.js") and which defines the Fragment.338 * If oController is given, the methods referenced in the Fragment will be called on this controller.339 * Note that Fragments may require a Controller to be given and certain methods to be available.340 * 341 * 342 * @param {string} [sId] id of the newly created Fragment343 * @param {string | object} sFragmentName name of the Fragment (or Fragment configuration as described above, in this case no sId may be given. Instead give the id inside the config object, if desired)344 * @param {sap.ui.core.mvc.Controller} [oController] a Controller to be used for event handlers in the Fragment345 * @public346 * @static347 * @return {sap.ui.core.Control|sap.ui.core.Control[]} the root Control(s) of the created Fragment instance348 */349 sap.ui.jsfragment = function(sName, oFragmentDefinition) { // definition of a JS Fragment350 if (typeof (sName) === "string" && typeof (oFragmentDefinition) === "object") {351 if (oFragmentDefinition.createContent) {352 // Fragment DEFINITON353 mRegistry[sName] = oFragmentDefinition;354 jQuery.sap.declare({modName: sName, type:"fragment"}, false);355 // TODO: return value?356 357 } else {358 // plain instantiation: name[+oController]359 return sap.ui.fragment(sName, "JS", oFragmentDefinition);360 }361 362 } else if (typeof (sName) === "string" && oFragmentDefinition === undefined) {363 // plain instantiation: name only364 return sap.ui.fragment(sName, "JS");365 366 } else { // ID+name[+Controller] or oConfig+[oController]367 if (typeof (sName) === "object") {368 // advanced mode: oConfig+[oController]369 sName.type = "JS";370 return sap.ui.fragment(sName, oFragmentDefinition);371 372 } else if (arguments && arguments.length >= 3) {373 // must be plain instantiation mode: ID+Name[+Controller]374 return sap.ui.fragment({id: sName, fragmentName: oFragmentDefinition, type: "JS"}, arguments[2]);375 } else {376 jQuery.sap.log.error("sap.ui.jsfragment() was called with wrong parameter set: " + sName + " + " + oFragmentDefinition);377 }378 }379 };380 /**381 * Instantiates an HTML-based Fragment.382 *383 * To instantiate a Fragment, call this method as:384 * sap.ui.htmlfragment([sId], sFragmentName, [oController]);385 * The Fragment instance ID is optional (generated if not given) and will be used as prefix for the ID of all386 * contained controls. The sFragmentName must correspond to an HTML Fragment which can be loaded387 * via the module system (fragmentName + ".fragment.html") and which defines the Fragment.388 * If oController is given, the methods referenced in the Fragment will be called on this controller.389 * Note that Fragments may require a Controller to be given and certain methods to be available.390 * 391 * 392 * Advanced usage:393 * To instantiate a Fragment and optionally directly give the HTML definition instead of loading it from a file, 394 * call this method as:395 * sap.ui.htmlfragment(oFragmentConfig, [oController]);396 * The oFragmentConfig object can have a either a "fragmentName" or a "fragmentContent" property. 397 * fragmentContent is optional and can hold the Fragment definition as XML string; if not398 * given, fragmentName must be given and the Fragment content definition is loaded by the module system.399 * Again, if oController is given, the methods referenced in the Fragment will be called on this controller.400 *401 * @param {string} [sId] id of the newly created Fragment402 * @param {string | object} vFragment name of the Fragment (or Fragment configuration as described above, in this case no sId may be given. Instead give the id inside the config object, if desired.)403 * @param {sap.ui.core.mvc.Controller} [oController] a Controller to be used for event handlers in the Fragment404 * @public405 * @static406 * @return {sap.ui.core.Control|sap.ui.core.Control[]} the root Control(s) of the created Fragment instance407 */408 sap.ui.htmlfragment = function(sId, vFragment, oController) {409 if (typeof (sId) === "string") { // basic call410 if (typeof (vFragment) === "string") { // with ID411 return sap.ui.fragment({fragmentName: vFragment, sId: sId, type: "HTML"}, oController);412 413 } else { // no ID, sId is actually the name and vFragment the optional Controller414 return sap.ui.fragment(sId, "HTML", vFragment);415 }416 } else { // advanced call417 sId.type = "HTML";418 return sap.ui.fragment(sId, vFragment); // second parameter "vFragment" is the optional Controller419 }420 };421 // ### FRAGMENT TYPES ###422 423 424 // ### XML Fragments ###425 426 Fragment.registerType("XML" , {427 init: function(mSettings) {428 // use specified content or load the content definition429 if (mSettings.fragmentContent) {430 if (typeof (mSettings.fragmentContent) === "string") {431 this._xContent = jQuery.parseXML(mSettings.fragmentContent).documentElement;432 } else {...

Full Screen

Full Screen

ShaderChunk.js

Source:ShaderChunk.js Github

copy

Full Screen

1import alphamap_fragment from './ShaderChunk/alphamap_fragment.glsl';2import alphamap_pars_fragment from './ShaderChunk/alphamap_pars_fragment.glsl';3import alphatest_fragment from './ShaderChunk/alphatest_fragment.glsl';4import aomap_fragment from './ShaderChunk/aomap_fragment.glsl';5import aomap_pars_fragment from './ShaderChunk/aomap_pars_fragment.glsl';6import begin_vertex from './ShaderChunk/begin_vertex.glsl';7import beginnormal_vertex from './ShaderChunk/beginnormal_vertex.glsl';8import bsdfs from './ShaderChunk/bsdfs.glsl';9import bumpmap_pars_fragment from './ShaderChunk/bumpmap_pars_fragment.glsl';10import clipping_planes_fragment from './ShaderChunk/clipping_planes_fragment.glsl';11import clipping_planes_pars_fragment from './ShaderChunk/clipping_planes_pars_fragment.glsl';12import clipping_planes_pars_vertex from './ShaderChunk/clipping_planes_pars_vertex.glsl';13import clipping_planes_vertex from './ShaderChunk/clipping_planes_vertex.glsl';14import color_fragment from './ShaderChunk/color_fragment.glsl';15import color_pars_fragment from './ShaderChunk/color_pars_fragment.glsl';16import color_pars_vertex from './ShaderChunk/color_pars_vertex.glsl';17import color_vertex from './ShaderChunk/color_vertex.glsl';18import common from './ShaderChunk/common.glsl';19import cube_uv_reflection_fragment from './ShaderChunk/cube_uv_reflection_fragment.glsl';20import defaultnormal_vertex from './ShaderChunk/defaultnormal_vertex.glsl';21import displacementmap_pars_vertex from './ShaderChunk/displacementmap_pars_vertex.glsl';22import displacementmap_vertex from './ShaderChunk/displacementmap_vertex.glsl';23import emissivemap_fragment from './ShaderChunk/emissivemap_fragment.glsl';24import emissivemap_pars_fragment from './ShaderChunk/emissivemap_pars_fragment.glsl';25import encodings_fragment from './ShaderChunk/encodings_fragment.glsl';26import encodings_pars_fragment from './ShaderChunk/encodings_pars_fragment.glsl';27import envmap_fragment from './ShaderChunk/envmap_fragment.glsl';28import envmap_pars_fragment from './ShaderChunk/envmap_pars_fragment.glsl';29import envmap_pars_vertex from './ShaderChunk/envmap_pars_vertex.glsl';30import envmap_vertex from './ShaderChunk/envmap_vertex.glsl';31import fog_vertex from './ShaderChunk/fog_vertex.glsl';32import fog_pars_vertex from './ShaderChunk/fog_pars_vertex.glsl';33import fog_fragment from './ShaderChunk/fog_fragment.glsl';34import fog_pars_fragment from './ShaderChunk/fog_pars_fragment.glsl';35import gradientmap_pars_fragment from './ShaderChunk/gradientmap_pars_fragment.glsl';36import lightmap_fragment from './ShaderChunk/lightmap_fragment.glsl';37import lightmap_pars_fragment from './ShaderChunk/lightmap_pars_fragment.glsl';38import lights_lambert_vertex from './ShaderChunk/lights_lambert_vertex.glsl';39import lights_pars_begin from './ShaderChunk/lights_pars_begin.glsl';40import lights_pars_maps from './ShaderChunk/lights_pars_maps.glsl';41import lights_phong_fragment from './ShaderChunk/lights_phong_fragment.glsl';42import lights_phong_pars_fragment from './ShaderChunk/lights_phong_pars_fragment.glsl';43import lights_physical_fragment from './ShaderChunk/lights_physical_fragment.glsl';44import lights_physical_pars_fragment from './ShaderChunk/lights_physical_pars_fragment.glsl';45import lights_fragment_begin from './ShaderChunk/lights_fragment_begin.glsl';46import lights_fragment_maps from './ShaderChunk/lights_fragment_maps.glsl';47import lights_fragment_end from './ShaderChunk/lights_fragment_end.glsl';48import logdepthbuf_fragment from './ShaderChunk/logdepthbuf_fragment.glsl';49import logdepthbuf_pars_fragment from './ShaderChunk/logdepthbuf_pars_fragment.glsl';50import logdepthbuf_pars_vertex from './ShaderChunk/logdepthbuf_pars_vertex.glsl';51import logdepthbuf_vertex from './ShaderChunk/logdepthbuf_vertex.glsl';52import map_fragment from './ShaderChunk/map_fragment.glsl';53import map_pars_fragment from './ShaderChunk/map_pars_fragment.glsl';54import map_particle_fragment from './ShaderChunk/map_particle_fragment.glsl';55import map_particle_pars_fragment from './ShaderChunk/map_particle_pars_fragment.glsl';56import metalnessmap_fragment from './ShaderChunk/metalnessmap_fragment.glsl';57import metalnessmap_pars_fragment from './ShaderChunk/metalnessmap_pars_fragment.glsl';58import morphnormal_vertex from './ShaderChunk/morphnormal_vertex.glsl';59import morphtarget_pars_vertex from './ShaderChunk/morphtarget_pars_vertex.glsl';60import morphtarget_vertex from './ShaderChunk/morphtarget_vertex.glsl';61import normal_fragment_begin from './ShaderChunk/normal_fragment_begin.glsl';62import normal_fragment_maps from './ShaderChunk/normal_fragment_maps.glsl';63import normalmap_pars_fragment from './ShaderChunk/normalmap_pars_fragment.glsl';64import packing from './ShaderChunk/packing.glsl';65import premultiplied_alpha_fragment from './ShaderChunk/premultiplied_alpha_fragment.glsl';66import project_vertex from './ShaderChunk/project_vertex.glsl';67import dithering_fragment from './ShaderChunk/dithering_fragment.glsl';68import dithering_pars_fragment from './ShaderChunk/dithering_pars_fragment.glsl';69import roughnessmap_fragment from './ShaderChunk/roughnessmap_fragment.glsl';70import roughnessmap_pars_fragment from './ShaderChunk/roughnessmap_pars_fragment.glsl';71import shadowmap_pars_fragment from './ShaderChunk/shadowmap_pars_fragment.glsl';72import shadowmap_pars_vertex from './ShaderChunk/shadowmap_pars_vertex.glsl';73import shadowmap_vertex from './ShaderChunk/shadowmap_vertex.glsl';74import shadowmask_pars_fragment from './ShaderChunk/shadowmask_pars_fragment.glsl';75import skinbase_vertex from './ShaderChunk/skinbase_vertex.glsl';76import skinning_pars_vertex from './ShaderChunk/skinning_pars_vertex.glsl';77import skinning_vertex from './ShaderChunk/skinning_vertex.glsl';78import skinnormal_vertex from './ShaderChunk/skinnormal_vertex.glsl';79import specularmap_fragment from './ShaderChunk/specularmap_fragment.glsl';80import specularmap_pars_fragment from './ShaderChunk/specularmap_pars_fragment.glsl';81import tonemapping_fragment from './ShaderChunk/tonemapping_fragment.glsl';82import tonemapping_pars_fragment from './ShaderChunk/tonemapping_pars_fragment.glsl';83import uv_pars_fragment from './ShaderChunk/uv_pars_fragment.glsl';84import uv_pars_vertex from './ShaderChunk/uv_pars_vertex.glsl';85import uv_vertex from './ShaderChunk/uv_vertex.glsl';86import uv2_pars_fragment from './ShaderChunk/uv2_pars_fragment.glsl';87import uv2_pars_vertex from './ShaderChunk/uv2_pars_vertex.glsl';88import uv2_vertex from './ShaderChunk/uv2_vertex.glsl';89import worldpos_vertex from './ShaderChunk/worldpos_vertex.glsl';90import cube_frag from './ShaderLib/cube_frag.glsl';91import cube_vert from './ShaderLib/cube_vert.glsl';92import depth_frag from './ShaderLib/depth_frag.glsl';93import depth_vert from './ShaderLib/depth_vert.glsl';94import distanceRGBA_frag from './ShaderLib/distanceRGBA_frag.glsl';95import distanceRGBA_vert from './ShaderLib/distanceRGBA_vert.glsl';96import equirect_frag from './ShaderLib/equirect_frag.glsl';97import equirect_vert from './ShaderLib/equirect_vert.glsl';98import linedashed_frag from './ShaderLib/linedashed_frag.glsl';99import linedashed_vert from './ShaderLib/linedashed_vert.glsl';100import meshbasic_frag from './ShaderLib/meshbasic_frag.glsl';101import meshbasic_vert from './ShaderLib/meshbasic_vert.glsl';102import meshlambert_frag from './ShaderLib/meshlambert_frag.glsl';103import meshlambert_vert from './ShaderLib/meshlambert_vert.glsl';104import meshphong_frag from './ShaderLib/meshphong_frag.glsl';105import meshphong_vert from './ShaderLib/meshphong_vert.glsl';106import meshphysical_frag from './ShaderLib/meshphysical_frag.glsl';107import meshphysical_vert from './ShaderLib/meshphysical_vert.glsl';108import normal_frag from './ShaderLib/normal_frag.glsl';109import normal_vert from './ShaderLib/normal_vert.glsl';110import points_frag from './ShaderLib/points_frag.glsl';111import points_vert from './ShaderLib/points_vert.glsl';112import shadow_frag from './ShaderLib/shadow_frag.glsl';113import shadow_vert from './ShaderLib/shadow_vert.glsl';114export var ShaderChunk = {115 alphamap_fragment: alphamap_fragment,116 alphamap_pars_fragment: alphamap_pars_fragment,117 alphatest_fragment: alphatest_fragment,118 aomap_fragment: aomap_fragment,119 aomap_pars_fragment: aomap_pars_fragment,120 begin_vertex: begin_vertex,121 beginnormal_vertex: beginnormal_vertex,122 bsdfs: bsdfs,123 bumpmap_pars_fragment: bumpmap_pars_fragment,124 clipping_planes_fragment: clipping_planes_fragment,125 clipping_planes_pars_fragment: clipping_planes_pars_fragment,126 clipping_planes_pars_vertex: clipping_planes_pars_vertex,127 clipping_planes_vertex: clipping_planes_vertex,128 color_fragment: color_fragment,129 color_pars_fragment: color_pars_fragment,130 color_pars_vertex: color_pars_vertex,131 color_vertex: color_vertex,132 common: common,133 cube_uv_reflection_fragment: cube_uv_reflection_fragment,134 defaultnormal_vertex: defaultnormal_vertex,135 displacementmap_pars_vertex: displacementmap_pars_vertex,136 displacementmap_vertex: displacementmap_vertex,137 emissivemap_fragment: emissivemap_fragment,138 emissivemap_pars_fragment: emissivemap_pars_fragment,139 encodings_fragment: encodings_fragment,140 encodings_pars_fragment: encodings_pars_fragment,141 envmap_fragment: envmap_fragment,142 envmap_pars_fragment: envmap_pars_fragment,143 envmap_pars_vertex: envmap_pars_vertex,144 envmap_vertex: envmap_vertex,145 fog_vertex: fog_vertex,146 fog_pars_vertex: fog_pars_vertex,147 fog_fragment: fog_fragment,148 fog_pars_fragment: fog_pars_fragment,149 gradientmap_pars_fragment: gradientmap_pars_fragment,150 lightmap_fragment: lightmap_fragment,151 lightmap_pars_fragment: lightmap_pars_fragment,152 lights_lambert_vertex: lights_lambert_vertex,153 lights_pars_begin: lights_pars_begin,154 lights_pars_maps: lights_pars_maps,155 lights_phong_fragment: lights_phong_fragment,156 lights_phong_pars_fragment: lights_phong_pars_fragment,157 lights_physical_fragment: lights_physical_fragment,158 lights_physical_pars_fragment: lights_physical_pars_fragment,159 lights_fragment_begin: lights_fragment_begin,160 lights_fragment_maps: lights_fragment_maps,161 lights_fragment_end: lights_fragment_end,162 logdepthbuf_fragment: logdepthbuf_fragment,163 logdepthbuf_pars_fragment: logdepthbuf_pars_fragment,164 logdepthbuf_pars_vertex: logdepthbuf_pars_vertex,165 logdepthbuf_vertex: logdepthbuf_vertex,166 map_fragment: map_fragment,167 map_pars_fragment: map_pars_fragment,168 map_particle_fragment: map_particle_fragment,169 map_particle_pars_fragment: map_particle_pars_fragment,170 metalnessmap_fragment: metalnessmap_fragment,171 metalnessmap_pars_fragment: metalnessmap_pars_fragment,172 morphnormal_vertex: morphnormal_vertex,173 morphtarget_pars_vertex: morphtarget_pars_vertex,174 morphtarget_vertex: morphtarget_vertex,175 normal_fragment_begin: normal_fragment_begin,176 normal_fragment_maps: normal_fragment_maps,177 normalmap_pars_fragment: normalmap_pars_fragment,178 packing: packing,179 premultiplied_alpha_fragment: premultiplied_alpha_fragment,180 project_vertex: project_vertex,181 dithering_fragment: dithering_fragment,182 dithering_pars_fragment: dithering_pars_fragment,183 roughnessmap_fragment: roughnessmap_fragment,184 roughnessmap_pars_fragment: roughnessmap_pars_fragment,185 shadowmap_pars_fragment: shadowmap_pars_fragment,186 shadowmap_pars_vertex: shadowmap_pars_vertex,187 shadowmap_vertex: shadowmap_vertex,188 shadowmask_pars_fragment: shadowmask_pars_fragment,189 skinbase_vertex: skinbase_vertex,190 skinning_pars_vertex: skinning_pars_vertex,191 skinning_vertex: skinning_vertex,192 skinnormal_vertex: skinnormal_vertex,193 specularmap_fragment: specularmap_fragment,194 specularmap_pars_fragment: specularmap_pars_fragment,195 tonemapping_fragment: tonemapping_fragment,196 tonemapping_pars_fragment: tonemapping_pars_fragment,197 uv_pars_fragment: uv_pars_fragment,198 uv_pars_vertex: uv_pars_vertex,199 uv_vertex: uv_vertex,200 uv2_pars_fragment: uv2_pars_fragment,201 uv2_pars_vertex: uv2_pars_vertex,202 uv2_vertex: uv2_vertex,203 worldpos_vertex: worldpos_vertex,204 cube_frag: cube_frag,205 cube_vert: cube_vert,206 depth_frag: depth_frag,207 depth_vert: depth_vert,208 distanceRGBA_frag: distanceRGBA_frag,209 distanceRGBA_vert: distanceRGBA_vert,210 equirect_frag: equirect_frag,211 equirect_vert: equirect_vert,212 linedashed_frag: linedashed_frag,213 linedashed_vert: linedashed_vert,214 meshbasic_frag: meshbasic_frag,215 meshbasic_vert: meshbasic_vert,216 meshlambert_frag: meshlambert_frag,217 meshlambert_vert: meshlambert_vert,218 meshphong_frag: meshphong_frag,219 meshphong_vert: meshphong_vert,220 meshphysical_frag: meshphysical_frag,221 meshphysical_vert: meshphysical_vert,222 normal_frag: normal_frag,223 normal_vert: normal_vert,224 points_frag: points_frag,225 points_vert: points_vert,226 shadow_frag: shadow_frag,227 shadow_vert: shadow_vert...

Full Screen

Full Screen

documentfragment.js

Source:documentfragment.js Github

copy

Full Screen

1/**2 * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.3 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license4 */5import DocumentFragment from '../../src/view/documentfragment';6import Element from '../../src/view/element';7import Node from '../../src/view/node';8import Text from '../../src/view/text';9import TextProxy from '../../src/view/textproxy';10import Document from '../../src/view/document';11import { StylesProcessor } from '../../src/view/stylesmap';12describe( 'DocumentFragment', () => {13 let document;14 beforeEach( () => {15 document = new Document( new StylesProcessor() );16 } );17 describe( 'constructor()', () => {18 it( 'should create DocumentFragment without children', () => {19 const fragment = new DocumentFragment( document );20 expect( fragment ).to.be.an.instanceof( DocumentFragment );21 expect( fragment.childCount ).to.equal( 0 );22 } );23 it( 'should create DocumentFragment document,with child node', () => {24 const child = new Element( document, 'p' );25 const fragment = new DocumentFragment( document, child );26 expect( fragment.childCount ).to.equal( 1 );27 expect( fragment.getChild( 0 ) ).to.have.property( 'name' ).that.equals( 'p' );28 } );29 it( 'should create DocumentFragment document,with multiple nodes', () => {30 const children = [ new Element( document, 'p' ), new Element( document, 'div' ) ];31 const fragment = new DocumentFragment( document, children );32 expect( fragment.childCount ).to.equal( 2 );33 expect( fragment.getChild( 0 ) ).to.have.property( 'name' ).that.equals( 'p' );34 expect( fragment.getChild( 1 ) ).to.have.property( 'name' ).that.equals( 'div' );35 } );36 } );37 describe( 'iterator', () => {38 it( 'should iterate over all nodes added to document fragment', () => {39 const children = [ new Element( document, 'p' ), new Element( document, 'div' ) ];40 const fragment = new DocumentFragment( document, children );41 const arr = Array.from( fragment );42 expect( arr.length ).to.equal( 2 );43 expect( arr[ 0 ] ).to.have.property( 'name' ).that.equals( 'p' );44 expect( arr[ 1 ] ).to.have.property( 'name' ).that.equals( 'div' );45 } );46 } );47 describe( 'getRoot', () => {48 it( 'should return document fragment', () => {49 const fragment = new DocumentFragment( document );50 expect( fragment.root ).to.equal( fragment );51 } );52 } );53 describe( 'isEmpty', () => {54 it( 'should return true if there are no children in document fragment', () => {55 const fragment = new DocumentFragment( document );56 expect( fragment.isEmpty ).to.be.true;57 } );58 it( 'should return false if there are children in document fragment', () => {59 const fragment = new DocumentFragment( document, [ new Element( document, 'p' ) ] );60 expect( fragment.isEmpty ).to.be.false;61 } );62 } );63 describe( 'is()', () => {64 let frag;65 before( () => {66 frag = new DocumentFragment( document );67 } );68 it( 'should return true for documentFragment', () => {69 expect( frag.is( 'documentFragment' ) ).to.be.true;70 expect( frag.is( 'view:documentFragment' ) ).to.be.true;71 } );72 it( 'should return false for other accept values', () => {73 expect( frag.is( 'node' ) ).to.be.false;74 expect( frag.is( 'view:node' ) ).to.be.false;75 expect( frag.is( '$text' ) ).to.be.false;76 expect( frag.is( '$textProxy' ) ).to.be.false;77 expect( frag.is( 'element' ) ).to.be.false;78 expect( frag.is( 'view:element' ) ).to.be.false;79 expect( frag.is( 'containerElement' ) ).to.be.false;80 expect( frag.is( 'attributeElement' ) ).to.be.false;81 expect( frag.is( 'uiElement' ) ).to.be.false;82 expect( frag.is( 'emptyElement' ) ).to.be.false;83 expect( frag.is( 'rootElement' ) ).to.be.false;84 } );85 } );86 describe( 'children manipulation methods', () => {87 let fragment, el1, el2, el3, el4;88 beforeEach( () => {89 fragment = new DocumentFragment( document );90 el1 = new Element( document, 'el1' );91 el2 = new Element( document, 'el2' );92 el3 = new Element( document, 'el3' );93 el4 = new Element( document, 'el4' );94 } );95 describe( 'insertion', () => {96 it( 'should insert children', () => {97 const count1 = fragment._insertChild( 0, [ el1, el3 ] );98 const count2 = fragment._insertChild( 1, el2 );99 expect( fragment.childCount ).to.equal( 3 );100 expect( fragment.getChild( 0 ) ).to.have.property( 'name' ).that.equals( 'el1' );101 expect( fragment.getChild( 1 ) ).to.have.property( 'name' ).that.equals( 'el2' );102 expect( fragment.getChild( 2 ) ).to.have.property( 'name' ).that.equals( 'el3' );103 expect( count1 ).to.equal( 2 );104 expect( count2 ).to.equal( 1 );105 } );106 it( 'should accept strings', () => {107 fragment._insertChild( 0, 'abc' );108 expect( fragment.childCount ).to.equal( 1 );109 expect( fragment.getChild( 0 ) ).to.have.property( 'data' ).that.equals( 'abc' );110 fragment._removeChildren( 0, 1 );111 fragment._insertChild( 0, [ new Element( document, 'p' ), 'abc' ] );112 expect( fragment.childCount ).to.equal( 2 );113 expect( fragment.getChild( 1 ) ).to.have.property( 'data' ).that.equals( 'abc' );114 } );115 it( 'should append children', () => {116 const count1 = fragment._insertChild( 0, el1 );117 const count2 = fragment._appendChild( el2 );118 const count3 = fragment._appendChild( el3 );119 expect( fragment.childCount ).to.equal( 3 );120 expect( fragment.getChild( 0 ) ).to.have.property( 'name' ).that.equals( 'el1' );121 expect( fragment.getChild( 1 ) ).to.have.property( 'name' ).that.equals( 'el2' );122 expect( fragment.getChild( 2 ) ).to.have.property( 'name' ).that.equals( 'el3' );123 expect( count1 ).to.equal( 1 );124 expect( count2 ).to.equal( 1 );125 expect( count3 ).to.equal( 1 );126 } );127 it( 'should fire change event when inserting', done => {128 fragment.once( 'change:children', ( event, node ) => {129 expect( node ).to.equal( fragment );130 done();131 } );132 fragment._insertChild( 0, el1 );133 } );134 it( 'should fire change event when appending', done => {135 fragment.once( 'change:children', ( event, node ) => {136 expect( node ).to.equal( fragment );137 done();138 } );139 fragment._appendChild( el1 );140 } );141 it( 'should accept and correctly handle text proxies', () => {142 const frag = new DocumentFragment( document );143 const text = new Text( document, 'abcxyz' );144 const textProxy = new TextProxy( text, 2, 3 );145 frag._insertChild( 0, textProxy );146 expect( frag.childCount ).to.equal( 1 );147 expect( frag.getChild( 0 ) ).to.be.instanceof( Text );148 expect( frag.getChild( 0 ).data ).to.equal( 'cxy' );149 } );150 } );151 describe( 'getChildIndex', () => {152 it( 'should return child index', () => {153 fragment._appendChild( el1 );154 fragment._appendChild( el2 );155 fragment._appendChild( el3 );156 expect( fragment.childCount ).to.equal( 3 );157 expect( fragment.getChildIndex( el1 ) ).to.equal( 0 );158 expect( fragment.getChildIndex( el2 ) ).to.equal( 1 );159 expect( fragment.getChildIndex( el3 ) ).to.equal( 2 );160 } );161 } );162 describe( 'getChildren', () => {163 it( 'should renturn children iterator', () => {164 fragment._appendChild( el1 );165 fragment._appendChild( el2 );166 fragment._appendChild( el3 );167 const expected = [ el1, el2, el3 ];168 let i = 0;169 for ( const child of fragment.getChildren() ) {170 expect( child ).to.equal( expected[ i ] );171 i++;172 }173 expect( i ).to.equal( 3 );174 } );175 } );176 describe( '_removeChildren', () => {177 it( 'should remove children', () => {178 fragment._appendChild( el1 );179 fragment._appendChild( el2 );180 fragment._appendChild( el3 );181 fragment._appendChild( el4 );182 fragment._removeChildren( 1, 2 );183 expect( fragment.childCount ).to.equal( 2 );184 expect( fragment.getChild( 0 ) ).to.have.property( 'name' ).that.equals( 'el1' );185 expect( fragment.getChild( 1 ) ).to.have.property( 'name' ).that.equals( 'el4' );186 expect( el1.parent ).to.equal( fragment );187 expect( el2.parent ).to.be.null;188 expect( el3.parent ).to.be.null;189 expect( el4.parent ).equal( fragment );190 } );191 it( 'should remove one child when second parameter is not specified', () => {192 fragment._appendChild( el1 );193 fragment._appendChild( el2 );194 fragment._appendChild( el3 );195 const removed = fragment._removeChildren( 1 );196 expect( fragment.childCount ).to.equal( 2 );197 expect( fragment.getChild( 0 ) ).to.have.property( 'name' ).that.equals( 'el1' );198 expect( fragment.getChild( 1 ) ).to.have.property( 'name' ).that.equals( 'el3' );199 expect( removed.length ).to.equal( 1 );200 expect( removed[ 0 ] ).to.have.property( 'name' ).that.equals( 'el2' );201 } );202 it( 'should fire change event', done => {203 fragment._appendChild( el1 );204 fragment.once( 'change:children', ( event, node ) => {205 expect( node ).to.equal( fragment );206 done();207 } );208 fragment._removeChildren( 0 );209 } );210 } );211 } );212 describe( 'node methods when inserted to fragment', () => {213 it( 'index should return proper value', () => {214 const node1 = new Node( document );215 const node2 = new Node( document );216 const node3 = new Node( document );217 const fragment = new DocumentFragment( document, [ node1, node2, node3 ] );218 expect( node1.index ).to.equal( 0 );219 expect( node2.index ).to.equal( 1 );220 expect( node3.index ).to.equal( 2 );221 expect( node1.parent ).to.equal( fragment );222 expect( node2.parent ).to.equal( fragment );223 expect( node3.parent ).to.equal( fragment );224 } );225 it( 'nextSibling should return proper node', () => {226 const node1 = new Node( document );227 const node2 = new Node( document );228 const node3 = new Node( document );229 new DocumentFragment( document, [ node1, node2, node3 ] ); // eslint-disable-line no-new230 expect( node1.nextSibling ).to.equal( node2 );231 expect( node2.nextSibling ).to.equal( node3 );232 expect( node3.nextSibling ).to.be.null;233 } );234 it( 'previousSibling should return proper node', () => {235 const node1 = new Node( document );236 const node2 = new Node( document );237 const node3 = new Node( document );238 new DocumentFragment( document, [ node1, node2, node3 ] ); // eslint-disable-line no-new239 expect( node1.previousSibling ).to.be.null;240 expect( node2.previousSibling ).to.equal( node1 );241 expect( node3.previousSibling ).to.equal( node2 );242 } );243 it( '_remove() should remove node from fragment', () => {244 const node1 = new Node( document );245 const node2 = new Node( document );246 const node3 = new Node( document );247 const fragment = new DocumentFragment( document, [ node1, node2, node3 ] );248 node1._remove();249 node3._remove();250 expect( fragment.childCount ).to.equal( 1 );251 expect( node1.parent ).to.be.null;252 expect( node3.parent ).to.be.null;253 expect( fragment.getChild( 0 ) ).to.equal( node2 );254 } );255 } );...

Full Screen

Full Screen

getDomSibling.test.js

Source:getDomSibling.test.js Github

copy

Full Screen

1import { createElement, render, Fragment } from '../../src/';2import { getDomSibling } from '../../src/component';3import { setupScratch, teardown } from '../_util/helpers';4/** @jsx createElement */5describe('getDomSibling', () => {6 /** @type {import('../../src/internal').PreactElement} */7 let scratch;8 const getRoot = dom => dom._children;9 beforeEach(() => {10 scratch = setupScratch();11 });12 afterEach(() => {13 teardown(scratch);14 });15 it('should find direct sibling', () => {16 render(17 <div>18 <div>A</div>19 <div>B</div>20 </div>,21 scratch22 );23 let vnode = getRoot(scratch)._children[0]._children[0];24 expect(getDomSibling(vnode)).to.equalNode(scratch.firstChild.childNodes[1]);25 });26 it('should find direct text node sibling', () => {27 render(28 <div>29 <div>A</div>B30 </div>,31 scratch32 );33 let vnode = getRoot(scratch)._children[0]._children[0];34 expect(getDomSibling(vnode)).to.equalNode(scratch.firstChild.childNodes[1]);35 });36 it('should find nested text node sibling', () => {37 render(38 <div>39 <Fragment>40 <div>A</div>41 </Fragment>42 <Fragment>B</Fragment>43 </div>,44 scratch45 );46 let vnode = getRoot(scratch)._children[0]._children[0];47 expect(getDomSibling(vnode)).to.equalNode(scratch.firstChild.childNodes[1]);48 });49 it('should find text node sibling with placeholder', () => {50 render(<div>A{null}B</div>, scratch);51 let vnode = getRoot(scratch)._children[0]._children[0];52 expect(getDomSibling(vnode)).to.equalNode(scratch.firstChild.childNodes[1]);53 });54 it('should find sibling with placeholder', () => {55 render(56 <div key="parent">57 <div key="A">A</div>58 {null}59 <div key="B">B</div>60 </div>,61 scratch62 );63 let vnode = getRoot(scratch)._children[0]._children[0];64 expect(getDomSibling(vnode)).to.equalNode(scratch.firstChild.childNodes[1]);65 });66 it('should find sibling with nested placeholder', () => {67 render(68 <div key="0">69 <Fragment key="0.0">70 <div key="A">A</div>71 </Fragment>72 <Fragment key="0.1">{null}</Fragment>73 <Fragment key="0.2">74 <div key="B">B</div>75 </Fragment>76 </div>,77 scratch78 );79 let vnode = getRoot(scratch)._children[0]._children[0]._children[0];80 expect(getDomSibling(vnode)).to.equalNode(scratch.firstChild.childNodes[1]);81 });82 it('should find sibling in parent', () => {83 render(84 <div>85 <Fragment>86 <div>A</div>87 </Fragment>88 <div>B</div>89 </div>,90 scratch91 );92 let vnode = getRoot(scratch)._children[0]._children[0]._children[0];93 expect(getDomSibling(vnode)).to.equalNode(scratch.firstChild.childNodes[1]);94 });95 it('should find unrelated sibling from a DOM VNode', () => {96 render(97 <div key="0">98 <Fragment key="0.0">99 <Fragment key="0.0.0">100 <Fragment key="0.0.0.0">101 <div key="A">A</div>102 </Fragment>103 </Fragment>104 </Fragment>105 <Fragment key="0.1">106 <Fragment key="0.1.0" />107 <Fragment key="0.1.1" />108 <Fragment key="0.1.2" />109 </Fragment>110 <Fragment key="0.2">111 <Fragment key="0.2.0" />112 <Fragment key="0.2.1" />113 <Fragment key="0.2.2">114 <div key="B">B</div>115 </Fragment>116 </Fragment>117 </div>,118 scratch119 );120 let divAVNode = getRoot(scratch)._children[0]._children[0]._children[0]121 ._children[0]._children[0];122 expect(divAVNode.type).to.equal('div');123 expect(getDomSibling(divAVNode)).to.equalNode(124 scratch.firstChild.childNodes[1]125 );126 });127 it('should find unrelated sibling from a Fragment VNode', () => {128 render(129 <div key="0">130 <Fragment key="0.0">131 <Fragment key="0.0.0">132 <Fragment key="0.0.0.0">133 <div key="A">A</div>134 </Fragment>135 </Fragment>136 </Fragment>137 <Fragment key="0.1">138 <Fragment key="0.1.0">139 <div key="B">B</div>140 </Fragment>141 </Fragment>142 </div>,143 scratch144 );145 let fragment = getRoot(scratch)._children[0]._children[0]._children[0]146 ._children[0];147 expect(fragment.type).to.equal(Fragment);148 expect(getDomSibling(fragment)).to.equalNode(149 scratch.firstChild.childNodes[1]150 );151 });152 it('should find unrelated sibling from a Component VNode', () => {153 const Foo = props => props.children;154 render(155 <div key="0">156 <Fragment key="0.0">157 <Fragment key="0.0.0">158 <Foo key="0.0.0.0">159 <div key="A">A</div>160 </Foo>161 </Fragment>162 </Fragment>163 <Fragment key="0.1">164 <Fragment key="0.1.0">165 <div key="B">B</div>166 </Fragment>167 </Fragment>168 </div>,169 scratch170 );171 let foo = getRoot(scratch)._children[0]._children[0]._children[0]172 ._children[0];173 expect(foo.type).to.equal(Foo);174 expect(getDomSibling(foo)).to.equalNode(scratch.firstChild.childNodes[1]);175 });176 it('should find sibling through components', () => {177 const Foo = props => props.children;178 render(179 <div key="0">180 <Foo key="0.0">181 <div key="A">A</div>182 </Foo>183 <Foo key="0.1" />184 <Foo key="0.2">185 <Foo key="0.2.0">186 <div key="B">B</div>187 </Foo>188 </Foo>189 </div>,190 scratch191 );192 let divAVNode = getRoot(scratch)._children[0]._children[0]._children[0];193 expect(divAVNode.type).to.equal('div');194 expect(getDomSibling(divAVNode)).to.equalNode(195 scratch.firstChild.childNodes[1]196 );197 });198 it('should find sibling rendered in Components that wrap JSX children', () => {199 const Foo = props => <p key="p">{props.children}</p>;200 render(201 <div key="0">202 <div key="A">A</div>203 <Foo key="Foo">204 <span key="span">a span</span>205 </Foo>206 </div>,207 scratch208 );209 let divAVNode = getRoot(scratch)._children[0]._children[0];210 expect(divAVNode.type).to.equal('div');211 let sibling = getDomSibling(divAVNode);212 expect(sibling).to.equalNode(scratch.firstChild.childNodes[1]);213 });214 it('should find sibling rendered in Components without JSX children', () => {215 const Foo = props => <p key="p">A paragraph</p>;216 render(217 <div key="0">218 <div key="A">A</div>219 <Foo key="Foo" />220 </div>,221 scratch222 );223 let divAVNode = getRoot(scratch)._children[0]._children[0];224 expect(divAVNode.type).to.equal('div');225 let sibling = getDomSibling(divAVNode);226 expect(sibling).to.equalNode(scratch.firstChild.childNodes[1]);227 });228 it('should climb through Components without JSX children', () => {229 const divAVNode = <div key="A">A</div>;230 const Foo = () => divAVNode;231 render(232 <div key="0">233 <Foo key="Foo" />234 <div key="B">B</div>235 </div>,236 scratch237 );238 let sibling = getDomSibling(divAVNode);239 expect(sibling).to.equalNode(scratch.firstChild.childNodes[1]);240 });241 it('should return null if last sibling', () => {242 render(243 <div key="0">244 <Fragment key="0.0">245 <div key="A">A</div>246 </Fragment>247 <Fragment key="0.1">248 <div key="B">B</div>249 </Fragment>250 <Fragment key="0.2">251 <div key="C">C</div>252 </Fragment>253 </div>,254 scratch255 );256 const divCVNode = getRoot(scratch)._children[0]._children[2]._children[0];257 expect(getDomSibling(divCVNode)).to.equal(null);258 });259 it('should return null if no sibling', () => {260 render(261 <div key="0">262 <Fragment key="0.0">263 <Fragment key="0.0.0">264 <Fragment key="0.0.0.0">265 <div key="A">A</div>266 </Fragment>267 </Fragment>268 </Fragment>269 <Fragment key="0.1">270 <Fragment key="0.1.0">{null}</Fragment>271 </Fragment>272 </div>,273 scratch274 );275 let divAVNode = getRoot(scratch)._children[0]._children[0]._children[0]276 ._children[0]._children[0];277 expect(getDomSibling(divAVNode)).to.equal(null);278 });279 it('should return null if no sibling with lots of empty trees', () => {280 render(281 <div key="0">282 <Fragment key="0.0">283 <Fragment key="0.0.0">284 <Fragment key="0.0.0.0">285 <div key="A">A</div>286 </Fragment>287 </Fragment>288 </Fragment>289 <Fragment key="0.1">290 <Fragment key="0.1.0" />291 <Fragment key="0.1.1" />292 <Fragment key="0.1.2" />293 </Fragment>294 <Fragment key="0.2">295 <Fragment key="0.2.0" />296 <Fragment key="0.2.1" />297 <Fragment key="0.2.2">{null}</Fragment>298 </Fragment>299 </div>,300 scratch301 );302 let divAVNode = getRoot(scratch)._children[0]._children[0]._children[0]303 ._children[0]._children[0];304 expect(getDomSibling(divAVNode)).to.equal(null);305 });306 it('should return null if current parent has no siblings (even if parent has siblings at same level)', () => {307 let divAVNode = <div key="A">A</div>;308 render(309 <div key="0">310 <div key="0.0">311 <div key="0.0.0" />312 {divAVNode}313 <Fragment key="0.1.2" />314 </div>315 <div key="0.1">316 <Fragment key="0.1.0" />317 <div key="B">B</div>318 </div>319 </div>,320 scratch321 );322 expect(getDomSibling(divAVNode)).to.equal(null);323 });...

Full Screen

Full Screen

meshphysical_frag.glsl.js

Source:meshphysical_frag.glsl.js Github

copy

Full Screen

1export default /* glsl */`2#define PHYSICAL3uniform vec3 diffuse;4uniform vec3 emissive;5uniform float roughness;6uniform float metalness;7uniform float opacity;8#ifndef STANDARD9 uniform float clearCoat;10 uniform float clearCoatRoughness;11#endif12varying vec3 vViewPosition;13#ifndef FLAT_SHADED14 varying vec3 vNormal;15 #ifdef USE_TANGENT16 varying vec3 vTangent;17 varying vec3 vBitangent;18 #endif19#endif20#include <common>21#include <packing>22#include <dithering_pars_fragment>23#include <color_pars_fragment>24#include <uv_pars_fragment>25#include <uv2_pars_fragment>26#include <map_pars_fragment>27#include <alphamap_pars_fragment>28#include <aomap_pars_fragment>29#include <lightmap_pars_fragment>30#include <emissivemap_pars_fragment>31#include <bsdfs>32#include <cube_uv_reflection_fragment>33#include <envmap_pars_fragment>34#include <envmap_physical_pars_fragment>35#include <fog_pars_fragment>36#include <lights_pars_begin>37#include <lights_physical_pars_fragment>38#include <shadowmap_pars_fragment>39#include <bumpmap_pars_fragment>40#include <normalmap_pars_fragment>41#include <roughnessmap_pars_fragment>42#include <metalnessmap_pars_fragment>43#include <logdepthbuf_pars_fragment>44#include <clipping_planes_pars_fragment>45void main() {46 #include <clipping_planes_fragment>47 vec4 diffuseColor = vec4( diffuse, opacity );48 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );49 vec3 totalEmissiveRadiance = emissive;50 #include <logdepthbuf_fragment>51 #include <map_fragment>52 #include <color_fragment>53 #include <alphamap_fragment>54 #include <alphatest_fragment>55 #include <roughnessmap_fragment>56 #include <metalnessmap_fragment>57 #include <normal_fragment_begin>58 #include <normal_fragment_maps>59 #include <emissivemap_fragment>60 // accumulation61 #include <lights_physical_fragment>62 #include <lights_fragment_begin>63 #include <lights_fragment_maps>64 #include <lights_fragment_end>65 // modulation66 #include <aomap_fragment>67 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;68 gl_FragColor = vec4( outgoingLight, diffuseColor.a );69 #include <tonemapping_fragment>70 #include <encodings_fragment>71 #include <fog_fragment>72 #include <premultiplied_alpha_fragment>73 #include <dithering_fragment>74}...

Full Screen

Full Screen

meshphong_frag.glsl.js

Source:meshphong_frag.glsl.js Github

copy

Full Screen

1export default /* glsl */`2#define PHONG3uniform vec3 diffuse;4uniform vec3 emissive;5uniform vec3 specular;6uniform float shininess;7uniform float opacity;8#include <common>9#include <packing>10#include <dithering_pars_fragment>11#include <color_pars_fragment>12#include <uv_pars_fragment>13#include <uv2_pars_fragment>14#include <map_pars_fragment>15#include <alphamap_pars_fragment>16#include <aomap_pars_fragment>17#include <lightmap_pars_fragment>18#include <emissivemap_pars_fragment>19#include <envmap_pars_fragment>20#include <gradientmap_pars_fragment>21#include <fog_pars_fragment>22#include <bsdfs>23#include <lights_pars_begin>24#include <lights_phong_pars_fragment>25#include <shadowmap_pars_fragment>26#include <bumpmap_pars_fragment>27#include <normalmap_pars_fragment>28#include <specularmap_pars_fragment>29#include <logdepthbuf_pars_fragment>30#include <clipping_planes_pars_fragment>31void main() {32 #include <clipping_planes_fragment>33 vec4 diffuseColor = vec4( diffuse, opacity );34 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );35 vec3 totalEmissiveRadiance = emissive;36 #include <logdepthbuf_fragment>37 #include <map_fragment>38 #include <color_fragment>39 #include <alphamap_fragment>40 #include <alphatest_fragment>41 #include <specularmap_fragment>42 #include <normal_fragment_begin>43 #include <normal_fragment_maps>44 #include <emissivemap_fragment>45 // accumulation46 #include <lights_phong_fragment>47 #include <lights_fragment_begin>48 #include <lights_fragment_maps>49 #include <lights_fragment_end>50 // modulation51 #include <aomap_fragment>52 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;53 #include <envmap_fragment>54 gl_FragColor = vec4( outgoingLight, diffuseColor.a );55 #include <tonemapping_fragment>56 #include <encodings_fragment>57 #include <fog_fragment>58 #include <premultiplied_alpha_fragment>59 #include <dithering_fragment>60}...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const wpt = require('webpagetest');2const wptClient = wpt('www.webpagetest.org');3 videoParams: {4 }5}, (err, data) => {6 if (err) {7 return console.error(err);8 }9 console.log(data.data.runs[1].firstView.videoFrames);10 console.log(data.data.runs[1].firstView.videoPath);11 console.log(data.data.runs[1].firstView.videoFullSpeed);12 console.log(data.data.runs[1].firstView.videoThumbnail);13 console.log(data.data.runs[1].firstView.videoURL);14 console.log(data.data.runs[1].firstView.video);15});

Full Screen

Using AI Code Generation

copy

Full Screen

1const wptools = require('wptools');2const fs = require('fs');3const path = require('path');4const { exec } = require('child_process');5const { promisify } = require('util');6const { spawn } = require('child_process');7const execPromise = promisify(exec);8const _ = require('lodash');9const { get } = require('http');10const { resolve } = require('path');11const { rejects } = require('assert');12const { timeLog } = require('console');13const { stringify } = require('querystring');14const { create } = require('domain');15const { write } = require('fs');16const { title } = require('process');17const wptoolsFragment = async (title) => {18 const options = {19 };20 const page = await wptools.page(title, options).get();21 return page;22};23const getFragments = async (title) => {24 const page = await wptoolsFragment(title);25 const fragments = page.data.fragments;26 return fragments;27};28const getInfobox = async (title) => {29 const page = await wptoolsFragment(title);30 const infobox = page.data.infobox;31 return infobox;32};33const getImages = async (title) => {34 const page = await wptoolsFragment(title);35 const images = page.data.images;36 return images;37};38const getSections = async (title) => {39 const page = await wptoolsFragment(title);40 const sections = page.data.sections;41 return sections;42};43const getTables = async (title) => {44 const page = await wptoolsFragment(title);45 const tables = page.data.tables;46 return tables;47};48const getReferences = async (title) => {49 const page = await wptoolsFragment(title);50 const references = page.data.references;51 return references;52};53const getLinks = async (title) => {54 const page = await wptoolsFragment(title);55 const links = page.data.links;56 return links;57};58const getCategories = async (title) => {59 const page = await wptoolsFragment(title);60 const categories = page.data.categories;61 return categories;62};63const getCoordinates = async (title) => {64 const page = await wptoolsFragment(title

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var fs = require('fs');3var wpt = new WebPageTest('www.webpagetest.org');4var options = {5};6var wpt = new WebPageTest('www.webpagetest.org');7wpt.runTest(url, options, function(err, data) {8 if (err) return console.error(err);9 console.log('Test submitted to WebPagetest for %s', url);10 console.log('Test ID: %s', data.data.testId);11 console.log('View test at: %s', data.data.userUrl);12 console.log('Poll status via: %s', data.data.jsonUrl);13 console.log('Poll waterfall via: %s', data.data.waterfallUrl);14 console.log('Poll screenshot via: %s', data.data.summaryCSV);15 console.log('Poll HAR via: %s', data.data.har);16 console.log('Poll video via: %s', data.data.video);17 console.log('Poll timeline via: %s', data.data.timeline);18 console.log('Poll trace via: %s', data.data.trace);19 console.log('Poll Chrome Dev Tools via: %s', data.data.devtools);20 console.log('Poll Chrome User Timing via: %s', data.data.userTiming);21 console.log('Poll Chrome Speed Index via: %s', data.data.speedIndex);22});23wpt.getTestResults('170221_9X_3e3b3e7c0a8a8b7a2e2d2d0a0b0d0c0d', function(err, data) {24 if (err) return console.error(err);25 console.log('Test results for %s', data.data.summary);26 console.log('First View (loadTime): %s', data.data.average.firstView.loadTime);27 console.log('Repeat View (loadTime): %s', data.data.average.repeatView.loadTime);28});

Full Screen

Using AI Code Generation

copy

Full Screen

1const wpt = require('webpagetest');2const options = {3};4const webPageTest = new wpt('www.webpagetest.org', options.key);5webPageTest.runTest(url, options, function(err, data) {6 if (err) return console.error(err);7 console.log('Test ID: %s', data.data.testId);8 console.log('User agent: %s', data.data.userAgent);9 console.log('Test URL: %s', data.data.userUrl);10 console.log('Test location: %s', data.data.location);11 console.log('Test from: %s', data.data.from);12 console.log('Test completed in %d seconds', data.data.summary.firstView.loadTime);13 console.log('First View Speed Index: %d', data.data.summary.firstView.SpeedIndex);14 console.log('Repeat View Speed Index: %d', data.data.summary.repeatView.SpeedIndex);15});

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 wpt 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