Best JavaScript code snippet using taiko
init-events.js
Source:init-events.js
1description("This tests the init functions for all the event DOM classes that have them.");2function testInitEvent(prefix, argumentString)3{4 var event = document.createEvent(prefix + "Event");5 var initExpression = "event.init" + prefix + "Event(" + argumentString + ")";6 eval(initExpression);7 return event;8}9var event = document.createEvent("Event");10event.initEvent("type", false, false);11shouldBe("testInitEvent('', '\"a\", false, false').type", "'a'");12shouldBe("testInitEvent('', 'null, false, false').type", "'null'");13shouldBe("testInitEvent('', '\"a\", false, false').bubbles", "false");14shouldBe("testInitEvent('', '\"a\", true, false').bubbles", "true");15shouldBe("testInitEvent('', '\"a\", false, false').cancelable", "false");16shouldBe("testInitEvent('', '\"a\", false, true').cancelable", "true");17shouldBe("testInitEvent('Keyboard', '\"a\", false, false, window, \"b\", 1001, false, false, false, false, false').type", "'a'");18shouldBe("testInitEvent('Keyboard', 'null, false, false, window, \"b\", 1001, false, false, false, false, false').type", "'null'");19shouldBe("testInitEvent('Keyboard', '\"a\", false, false, window, \"b\", 1001, false, false, false, false, false').bubbles", "false");20shouldBe("testInitEvent('Keyboard', '\"a\", true, false, window, \"b\", 1001, false, false, false, false, false').bubbles", "true");21shouldBe("testInitEvent('Keyboard', '\"a\", false, false, window, \"b\", 1001, false, false, false, false, false').cancelable", "false");22shouldBe("testInitEvent('Keyboard', '\"a\", false, true, window, \"b\", 1001, false, false, false, false, false').cancelable", "true");23shouldBe("testInitEvent('Keyboard', '\"a\", false, true, window, \"b\", 1001, false, false, false, false, false').view", "window");24shouldBe("testInitEvent('Keyboard', '\"a\", false, true, null, \"b\", 1001, false, false, false, false, false').view", "null");25shouldBe("testInitEvent('Keyboard', '\"a\", false, true, window, \"b\", 1001, false, false, false, false, false').keyIdentifier", "'b'");26shouldBe("testInitEvent('Keyboard', '\"a\", false, true, window, null, 1001, false, false, false, false, false').keyIdentifier", "'null'");27shouldBe("testInitEvent('Keyboard', '\"a\", false, true, window, \"b\", 1001, false, false, false, false, false').keyLocation", "1001");28shouldBe("testInitEvent('Keyboard', '\"a\", false, true, window, \"b\", 1001, false, false, false, false, false').ctrlKey", "false");29shouldBe("testInitEvent('Keyboard', '\"a\", false, true, window, \"b\", 1001, true, false, false, false, false').ctrlKey", "true");30shouldBe("testInitEvent('Keyboard', '\"a\", false, true, window, \"b\", 1001, false, false, false, false, false').altKey", "false");31shouldBe("testInitEvent('Keyboard', '\"a\", false, true, window, \"b\", 1001, false, true, false, false, false').altKey", "true");32shouldBe("testInitEvent('Keyboard', '\"a\", false, true, window, \"b\", 1001, false, false, false, false, false').shiftKey", "false");33shouldBe("testInitEvent('Keyboard', '\"a\", false, true, window, \"b\", 1001, false, false, true, false, false').shiftKey", "true");34shouldBe("testInitEvent('Keyboard', '\"a\", false, true, window, \"b\", 1001, false, false, false, false, false').metaKey", "false");35shouldBe("testInitEvent('Keyboard', '\"a\", false, true, window, \"b\", 1001, false, false, false, true, false').metaKey", "true");36shouldBe("testInitEvent('Keyboard', '\"a\", false, true, window, \"b\", 1001, false, false, false, false, false').altGraphKey", "false");37shouldBe("testInitEvent('Keyboard', '\"a\", false, true, window, \"b\", 1001, false, false, false, false, true').altGraphKey", "true");38shouldBe("testInitEvent('Keyboard', '\"a\", false, true, window, \"b\", 1001, false, false, false, false, true').detail", "0");39shouldBe("testInitEvent('Keyboard', '\"a\", false, true, window, \"b\", 1001, false, false, false, false, false').keyCode", "0");40shouldBe("testInitEvent('Keyboard', '\"a\", false, true, window, \"b\", 1001, false, false, false, false, false').charCode", "0");41shouldBe("testInitEvent('Keyboard', '\"a\", false, true, window, \"b\", 1001, false, false, false, false, false').layerX", "0");42shouldBe("testInitEvent('Keyboard', '\"a\", false, true, window, \"b\", 1001, false, false, false, false, false').layerY", "0");43shouldBe("testInitEvent('Keyboard', '\"a\", false, true, window, \"b\", 1001, false, false, false, false, false').pageX", "0");44shouldBe("testInitEvent('Keyboard', '\"a\", false, true, window, \"b\", 1001, false, false, false, false, false').pageY", "0");45shouldBe("testInitEvent('Keyboard', '\"a\", false, true, window, \"b\", 1001, false, false, false, false, false').which", "0");46shouldBe("testInitEvent('Message', '\"a\", false, false, \"b\", \"c\", \"d\", window, null').type", "'a'");47shouldBe("testInitEvent('Message', 'null, false, false, \"b\", \"c\", \"d\", window, null').type", "'null'");48shouldBe("testInitEvent('Message', '\"a\", false, false, \"b\", \"c\", \"d\", window, null').bubbles", "false");49shouldBe("testInitEvent('Message', '\"a\", true, false, \"b\", \"c\", \"d\", window, null').bubbles", "true");50shouldBe("testInitEvent('Message', '\"a\", false, false, \"b\", \"c\", \"d\", window, null').cancelable", "false");51shouldBe("testInitEvent('Message', '\"a\", false, true, \"b\", \"c\", \"d\", window, null').cancelable", "true");52shouldBe("testInitEvent('Message', '\"a\", false, false, \"b\", \"c\", \"d\", window, null').data", "'b'");53shouldBe("testInitEvent('Message', '\"a\", false, false, null, \"c\", \"d\", window, null').data", "null");54shouldBe("testInitEvent('Message', '\"a\", false, false, \"b\", \"c\", \"d\", window, null').origin", "'c'");55shouldBe("testInitEvent('Message', '\"a\", false, false, \"b\", null, \"d\", window, null').origin", "'null'");56shouldBe("testInitEvent('Message', '\"a\", false, false, \"b\", \"c\", \"d\", window, null').lastEventId", "'d'");57shouldBe("testInitEvent('Message', '\"a\", false, false, \"b\", \"c\", null, window, null').lastEventId", "'null'");58shouldBe("testInitEvent('Message', '\"a\", false, false, \"b\", \"c\", \"d\", window, null').source", "window");59shouldBe("testInitEvent('Message', '\"a\", false, false, \"b\", \"c\", \"d\", null, null').source", "null");60var channel = new MessageChannel;61var channelArray = [channel.port1, channel.port2];62shouldBe("testInitEvent('Message', '\"a\", false, false, \"b\", \"c\", \"d\", null, channelArray').ports[0]", "channel.port1");63shouldBe("testInitEvent('Message', '\"a\", false, false, \"b\", \"c\", \"d\", null, channelArray').ports[1]", "channel.port2");64shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').type", "'a'");65shouldBe("testInitEvent('Mouse', 'null, false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').type", "'null'");66shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').bubbles", "false");67shouldBe("testInitEvent('Mouse', '\"a\", true, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').bubbles", "true");68shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').cancelable", "false");69shouldBe("testInitEvent('Mouse', '\"a\", false, true, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').cancelable", "true");70shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').view", "window");71shouldBe("testInitEvent('Mouse', '\"a\", false, false, null, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').view", "null");72shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').detail", "1001");73shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').screenX", "1002");74shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').screenY", "1003");75shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').clientX", "1004");76shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').clientY", "1005");77shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').ctrlKey", "false");78shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, true, false, false, false, 1006, null').ctrlKey", "true");79shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').altKey", "false");80shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, true, false, false, 1006, null').altKey", "true");81shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').shiftKey", "false");82shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, true, false, 1006, null').shiftKey", "true");83shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').metaKey", "false");84shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, true, 1006, null').metaKey", "true");85shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').button", "1006");86shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').relatedTarget", "null");87shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, document').relatedTarget", "document");88shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').offsetX", "1004");89shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').offsetY", "1005");90shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').x", "1004");91shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').y", "1005");92shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').fromElement", "null");93shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, document').fromElement", "document");94shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').toElement", "null");95shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').dataTransfer", "null");96shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').keyCode", "0");97shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').charCode", "0");98shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').layerX", "1004");99shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').layerY", "1005");100shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').pageX", "1004");101shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').pageY", "1005");102shouldBe("testInitEvent('Mouse', '\"a\", false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').which", "1007");103shouldBe("testInitEvent('Mutation', '\"a\", false, false, null, \"b\", \"c\", \"d\", 1001').type", "'a'");104shouldBe("testInitEvent('Mutation', 'null, false, false, null, \"b\", \"c\", \"d\", 1001').type", "'null'");105shouldBe("testInitEvent('Mutation', '\"a\", false, false, null, \"b\", \"c\", \"d\", 1001').bubbles", "false");106shouldBe("testInitEvent('Mutation', '\"a\", true, false, null, \"b\", \"c\", \"d\", 1001').bubbles", "true");107shouldBe("testInitEvent('Mutation', '\"a\", false, false, null, \"b\", \"c\", \"d\", 1001').cancelable", "false");108shouldBe("testInitEvent('Mutation', '\"a\", false, true, null, \"b\", \"c\", \"d\", 1001').cancelable", "true");109shouldBe("testInitEvent('Mutation', '\"a\", false, false, null, \"b\", \"c\", \"d\", 1001').relatedNode", "null");110shouldBe("testInitEvent('Mutation', '\"a\", false, false, document, \"b\", \"c\", \"d\", 1001').relatedNode", "document");111shouldBe("testInitEvent('Mutation', '\"a\", false, false, null, \"b\", \"c\", \"d\", 1001').prevValue", "'b'");112shouldBe("testInitEvent('Mutation', '\"a\", false, false, null, null, \"c\", \"d\", 1001').prevValue", "'null'");113shouldBe("testInitEvent('Mutation', '\"a\", false, false, null, \"b\", \"c\", \"d\", 1001').newValue", "'c'");114shouldBe("testInitEvent('Mutation', '\"a\", false, false, null, \"b\", null, \"d\", 1001').newValue", "'null'");115shouldBe("testInitEvent('Mutation', '\"a\", false, false, null, \"b\", \"c\", \"d\", 1001').attrName", "'d'");116shouldBe("testInitEvent('Mutation', '\"a\", false, false, null, \"b\", \"c\", null, 1001').attrName", "'null'");117shouldBe("testInitEvent('Mutation', '\"a\", false, false, null, \"b\", \"c\", \"d\", 1001').attrChange", "1001");118// initOverflowEvent has an interface that has an design that's inconsistent with the init functions from other events.119shouldBe("testInitEvent('Overflow', '1001, false, false').type", "'overflowchanged'");120shouldBe("testInitEvent('Overflow', '1001, false, false').bubbles", "false");121shouldBe("testInitEvent('Overflow', '1001, false, false').cancelable", "false");122shouldBe("testInitEvent('Overflow', '1001, false, false').orient", "1001");123shouldBe("testInitEvent('Overflow', '1001, false, false').horizontalOverflow", "false");124shouldBe("testInitEvent('Overflow', '1001, true, false').horizontalOverflow", "true");125shouldBe("testInitEvent('Overflow', '1001, false, false').verticalOverflow", "false");126shouldBe("testInitEvent('Overflow', '1001, false, true').verticalOverflow", "true");127shouldBe("testInitEvent('Progress', '\"a\", false, false, false, 1001, 1002').type", "'a'");128shouldBe("testInitEvent('Progress', 'null, false, false, false, 1001, 1002').type", "'null'");129shouldBe("testInitEvent('Progress', '\"a\", false, false, false, 1001, 1002').bubbles", "false");130shouldBe("testInitEvent('Progress', '\"a\", true, false, false, 1001, 1002').bubbles", "true");131shouldBe("testInitEvent('Progress', '\"a\", false, false, false, 1001, 1002').cancelable", "false");132shouldBe("testInitEvent('Progress', '\"a\", false, true, false, 1001, 1002').cancelable", "true");133shouldBe("testInitEvent('Progress', '\"a\", false, false, false, 1001, 1002').lengthComputable", "false");134shouldBe("testInitEvent('Progress', '\"a\", false, false, true, 1001, 1002').lengthComputable", "true");135shouldBe("testInitEvent('Progress', '\"a\", false, false, false, 1001, 1002').loaded", "1001");136shouldBe("testInitEvent('Progress', '\"a\", false, false, false, 1001, 1002').total", "1002");137shouldBe("testInitEvent('Storage', '\"a\", false, false, \"b\", \"c\", \"d\", \"e\"').type", "'a'");138shouldBe("testInitEvent('Storage', 'null, false, false, \"b\", \"c\", \"d\", \"e\"').type", "'null'");139shouldBe("testInitEvent('Storage', '\"a\", false, false, \"b\", \"c\", \"d\", \"e\"').bubbles", "false");140shouldBe("testInitEvent('Storage', '\"a\", true, false, \"b\", \"c\", \"d\", \"e\"').bubbles", "true");141shouldBe("testInitEvent('Storage', '\"a\", false, false, \"b\", \"c\", \"d\", \"e\"').cancelable", "false");142shouldBe("testInitEvent('Storage', '\"a\", false, true, \"b\", \"c\", \"d\", \"e\"').cancelable", "true");143shouldBe("testInitEvent('Storage', '\"a\", false, false, \"b\", \"c\", \"d\", \"e\"').key", "'b'");144shouldBe("testInitEvent('Storage', '\"a\", false, false, null, \"c\", \"d\", \"e\"').key", "'null'");145shouldBe("testInitEvent('Storage', '\"a\", false, false, \"b\", \"c\", \"d\", \"e\"').oldValue", "'c'");146shouldBe("testInitEvent('Storage', '\"a\", false, false, \"b\", null, \"d\", \"e\"').oldValue", "null");147shouldBe("testInitEvent('Storage', '\"a\", false, false, \"b\", \"c\", \"d\", \"e\"').newValue", "'d'");148shouldBe("testInitEvent('Storage', '\"a\", false, false, \"b\", \"c\", null, \"e\"').newValue", "null");149shouldBe("testInitEvent('Storage', '\"a\", false, false, \"b\", \"c\", \"d\", \"e\"').url", "'e'");150shouldBe("testInitEvent('Storage', '\"a\", false, false, \"b\", \"c\", \"d\", null').url", "'null'");151shouldBe("testInitEvent('Text', '\"a\", false, false, window, \"b\"').type", "'a'");152shouldBe("testInitEvent('Text', 'null, false, false, window, \"b\"').type", "'null'");153shouldBe("testInitEvent('Text', '\"a\", false, false, window, \"b\"').bubbles", "false");154shouldBe("testInitEvent('Text', '\"a\", true, false, window, \"b\"').bubbles", "true");155shouldBe("testInitEvent('Text', '\"a\", false, false, window, \"b\"').cancelable", "false");156shouldBe("testInitEvent('Text', '\"a\", false, true, window, \"b\"').cancelable", "true");157shouldBe("testInitEvent('Text', '\"a\", false, false, window, \"b\"').view", "window");158shouldBe("testInitEvent('Text', '\"a\", false, false, null, \"b\"').view", "null");159shouldBe("testInitEvent('Text', '\"a\", false, false, window, \"b\"').data", "'b'");160shouldBe("testInitEvent('Text', '\"a\", false, false, window, null').data", "'null'");161shouldBe("testInitEvent('Text', '\"a\", false, false, window, \"b\"').detail", "0");162shouldBe("testInitEvent('Text', '\"a\", false, false, window, \"b\"').keyCode", "0");163shouldBe("testInitEvent('Text', '\"a\", false, false, window, \"b\"').charCode", "0");164shouldBe("testInitEvent('Text', '\"a\", false, false, window, \"b\"').layerX", "0");165shouldBe("testInitEvent('Text', '\"a\", false, false, window, \"b\"').layerY", "0");166shouldBe("testInitEvent('Text', '\"a\", false, false, window, \"b\"').pageX", "0");167shouldBe("testInitEvent('Text', '\"a\", false, false, window, \"b\"').pageY", "0");168shouldBe("testInitEvent('Text', '\"a\", false, false, window, \"b\"').which", "0");169shouldBe("testInitEvent('UI', '\"a\", false, false, window, 1001').type", "'a'");170shouldBe("testInitEvent('UI', 'null, false, false, window, 1001').type", "'null'");171shouldBe("testInitEvent('UI', '\"a\", false, false, window, 1001').bubbles", "false");172shouldBe("testInitEvent('UI', '\"a\", true, false, window, 1001').bubbles", "true");173shouldBe("testInitEvent('UI', '\"a\", false, false, window, 1001').cancelable", "false");174shouldBe("testInitEvent('UI', '\"a\", false, true, window, 1001').cancelable", "true");175shouldBe("testInitEvent('UI', '\"a\", false, false, window, 1001').view", "window");176shouldBe("testInitEvent('UI', '\"a\", false, false, null, 1001').view", "null");177shouldBe("testInitEvent('UI', '\"a\", false, false, window, 1001').detail", "1001");178shouldBe("testInitEvent('UI', '\"a\", false, false, window, 1001').keyCode", "0");179shouldBe("testInitEvent('UI', '\"a\", false, false, window, 1001').charCode", "0");180shouldBe("testInitEvent('UI', '\"a\", false, false, window, 1001').layerX", "0");181shouldBe("testInitEvent('UI', '\"a\", false, false, window, 1001').layerY", "0");182shouldBe("testInitEvent('UI', '\"a\", false, false, window, 1001').pageX", "0");183shouldBe("testInitEvent('UI', '\"a\", false, false, window, 1001').pageY", "0");184shouldBe("testInitEvent('UI', '\"a\", false, false, window, 1001').which", "0");185shouldBe("testInitEvent('WebKitAnimation', '\"a\", false, false, \"b\", 1001').type", "'a'");186shouldBe("testInitEvent('WebKitAnimation', 'null, false, false, \"b\", 1001').type", "'null'");187shouldBe("testInitEvent('WebKitAnimation', '\"a\", false, false, \"b\", 1001').bubbles", "false");188shouldBe("testInitEvent('WebKitAnimation', '\"a\", true, false, \"b\", 1001').bubbles", "true");189shouldBe("testInitEvent('WebKitAnimation', '\"a\", false, false, \"b\", 1001').cancelable", "false");190shouldBe("testInitEvent('WebKitAnimation', '\"a\", false, true, \"b\", 1001').cancelable", "true");191shouldBe("testInitEvent('WebKitAnimation', '\"a\", false, false, \"b\", 1001').animationName", "'b'");192shouldBe("testInitEvent('WebKitAnimation', '\"a\", false, false, null, 1001').animationName", "'null'");193shouldBe("testInitEvent('WebKitAnimation', '\"a\", false, false, \"b\", 1001').elapsedTime", "1001");194shouldBe("testInitEvent('WebKitTransition', '\"a\", false, false, \"b\", 1001').type", "'a'");195shouldBe("testInitEvent('WebKitTransition', 'null, false, false, \"b\", 1001').type", "'null'");196shouldBe("testInitEvent('WebKitTransition', '\"a\", false, false, \"b\", 1001').bubbles", "false");197shouldBe("testInitEvent('WebKitTransition', '\"a\", true, false, \"b\", 1001').bubbles", "true");198shouldBe("testInitEvent('WebKitTransition', '\"a\", false, false, \"b\", 1001').cancelable", "false");199shouldBe("testInitEvent('WebKitTransition', '\"a\", false, true, \"b\", 1001').cancelable", "true");200shouldBe("testInitEvent('WebKitTransition', '\"a\", false, false, \"b\", 1001').propertyName", "'b'");201shouldBe("testInitEvent('WebKitTransition', '\"a\", false, false, null, 1001').propertyName", "'null'");202shouldBe("testInitEvent('WebKitTransition', '\"a\", false, false, \"b\", 1001').elapsedTime", "1001");203// WheelEvent has no init function yet; roughly speaking, we are waiting for that part of DOM 3 to stabilize....
Card.jsx
Source:Card.jsx
1import React,{useEffect,useState} from 'react'2import Avatar from '@material-ui/core/Avatar';3import DoneIcon from '@material-ui/icons/Done'4import Grid from "@material-ui/core/Grid"5import firebaseDb from './firebase';6import ProductCarousel from "./ProductCarousel"7import {useHistory} from "react-router-dom";8import {makeStyles} from '@material-ui/core/styles';9const useStyles = makeStyles((theme) => ({10 gridy: {11 [theme.breakpoints.down('sm')]: {12 margin:'20px 0 0 50%',13 transform:"translate(-50%,0)"14 },15 "&:hover": {16 transform:"scale(1.001)",17 transition:"all 0.5s"18 },19 }20 }));21 22export default function Card(props) {23 const classes = useStyles();24 const history=useHistory();25 const[init,upda]=useState({});26 useEffect(()=>{27 firebaseDb.child('products').on("value",snapshot=>{28 29 if(snapshot.val() !=null){30 // upda({...snapshot.val()})31 // setOpen(true);32 33 upda({...snapshot.val()}); 34 }35 })36 },[props.categoryAction])37 // click event38 const clicki=(a)=>{39 a.valll="products"40 history.push("/insideproduct",a);41 }42 // slider arr43 return (44 <>45 <Grid container style={{marginBottom:"50px",paddingLeft:"20px"}}>46 47{/* ternary start */}48 {49 Object.keys(init) && Object.keys(init).length > 0 && Array.isArray(Object.keys(init))?50 props.categoryAction == "LowHigh" ?51//ternary start52 Object.keys(init).sort((a, b) => init[a].price - init[b].price).map((row) => (53 <>54 <Grid className={classes.gridy} item lg={3} md={4} xs={12} style={{marginBottom:"20px"}}>55 <div style={{width:"300px"}}>56 <div style={{backgroundColor:"rgb(240, 240, 240)",height:"355px",width:"290px",overflow:"hidden"}}>57 <div style={{height:"50px",marginBottom:"8px"}}>58{59 ( 100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0)) ) > 0 ?60 <Avatar style={{position:"relative",top:"6px",left:"20px",backgroundColor:"red"}}><span style={{fontSize:"12px"}}>-{100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}% </span></Avatar>61 :62 <></>63} 64 </div>65 <div style={{position:"relative",right:"28px"}}>66 <ProductCarousel67 width="220px!important"68 image1={init[row].image}69 image2={init[row].image2}70 />71 </div>72 <p onClick={()=>clicki({73 id:row,74 image:init[row].image,75 image2:init[row].image2,76 item:init[row].item,77 writer:init[row].writer,78 price: init[row].price,79 off:init[row].off,80 description:init[row].description,81 author:init[row].author82 })} className="jjj" style={{margin:"16px 0 0 0",cursor:"pointer"}}>{init[row].item}</p>83 </div> 84 <span style={{color:"silver",marginTop:"0px"}}>{init[row].writer}</span>85 <h3 style={{color:"#B12704",margin:"10px 0 0 0px"}}><sup>â¹</sup>{init[row].price} <span style={{color:"silver",fontSize:"16px",textDecoration:"line-through"}}> â¹{Number(init[row].price)+Number(init[row].off)} </span> <span style={{color:"silver",fontSize:"16px",textDecoration:"none",marginLeft:"10px"}}> save({init[row].off}) {100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}%</span></h3>86<p style={{marginTop:"10px"}}> <DoneIcon style={{color:"#B12704"}}/> <span style={{color:"#B12704"}}><b>Express</b></span> Get it by Tomorrow, <b> April {new Date().getDate()+1}</b> </p>87 <span style={{color:"silver",marginTop:"0px"}}>FREE Delivery over â¹499.Fulfilled by PerfectLegal.</span>88 </div>89 </Grid>90 </>91 ))92 :93//trenery Start94props.categoryAction == "HighLow" ?95 Object.keys(init).sort((a, b) => init[a].price - init[b].price).reverse().map((row) => (96<>97<Grid className={classes.gridy} item lg={3} md={4} xs={12} style={{marginBottom:"20px"}}>98<div style={{width:"300px"}}>99<div style={{backgroundColor:"rgb(240, 240, 240)",height:"355px",width:"290px",overflow:"hidden"}}>100<div style={{height:"50px",marginBottom:"8px"}}>101{102 ( 100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0)) ) > 0 ?103 <Avatar style={{position:"relative",top:"6px",left:"20px",backgroundColor:"red"}}><span style={{fontSize:"12px"}}>-{100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}% </span></Avatar>104 :105 <></>106} 107</div>108<div style={{position:"relative",right:"28px"}}>109<ProductCarousel110width="220px!important"111image1={init[row].image}112image2={init[row].image2}113/>114</div>115<p onClick={()=>clicki({116id:row,117image:init[row].image,118image2:init[row].image2,119item:init[row].item,120writer:init[row].writer,121price: init[row].price,122off:init[row].off,123description:init[row].description,124author:init[row].author125})} className="jjj" style={{margin:"16px 0 0 0",cursor:"pointer"}}>{init[row].item}</p>126</div> 127<span style={{color:"silver",marginTop:"0px"}}>{init[row].writer}</span>128<h3 style={{color:"#B12704",margin:"10px 0 0 0px"}}><sup>â¹</sup>{init[row].price} <span style={{color:"silver",fontSize:"16px",textDecoration:"line-through"}}> â¹{Number(init[row].price)+Number(init[row].off)} </span> <span style={{color:"silver",fontSize:"16px",textDecoration:"none",marginLeft:"10px"}}> save({init[row].off}) {100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}%</span></h3>129<p style={{marginTop:"10px"}}> <DoneIcon style={{color:"#B12704"}}/> <span style={{color:"#B12704"}}><b>Express</b></span> Get it by Tomorrow, <b> April {new Date().getDate()+1}</b> </p>130<span style={{color:"silver",marginTop:"0px"}}>FREE Delivery over â¹499.Fulfilled by PerfectLegal.</span>131</div>132</Grid>133</>134))135:136//trenery Start137props.categoryAction == "OlderFirst" ?138Object.keys(init).map((row) => (139<>140<Grid className={classes.gridy} item lg={3} md={4} xs={12} style={{marginBottom:"20px"}}>141<div style={{width:"300px"}}>142<div style={{backgroundColor:"rgb(240, 240, 240)",height:"355px",width:"290px",overflow:"hidden"}}>143<div style={{height:"50px",marginBottom:"8px"}}>144{145 ( 100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0)) ) > 0 ?146 <Avatar style={{position:"relative",top:"6px",left:"20px",backgroundColor:"red"}}><span style={{fontSize:"12px"}}>-{100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}% </span></Avatar>147 :148 <></>149} 150</div>151<div style={{position:"relative",right:"28px"}}>152<ProductCarousel153width="220px!important"154image1={init[row].image}155image2={init[row].image2}156/>157</div>158<p onClick={()=>clicki({159id:row,160image:init[row].image,161image2:init[row].image2,162item:init[row].item,163writer:init[row].writer,164price: init[row].price,165off:init[row].off,166description:init[row].description,167author:init[row].author168})} className="jjj" style={{margin:"16px 0 0 0",cursor:"pointer"}}>{init[row].item}</p>169</div> 170<span style={{color:"silver",marginTop:"0px"}}>{init[row].writer}</span>171<h3 style={{color:"#B12704",margin:"10px 0 0 0px"}}><sup>â¹</sup>{init[row].price} <span style={{color:"silver",fontSize:"16px",textDecoration:"line-through"}}> â¹{Number(init[row].price)+Number(init[row].off)} </span> <span style={{color:"silver",fontSize:"16px",textDecoration:"none",marginLeft:"10px"}}> save({init[row].off}) {100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}%</span></h3>172<p style={{marginTop:"10px"}}> <DoneIcon style={{color:"#B12704"}}/> <span style={{color:"#B12704"}}><b>Express</b></span> Get it by Tomorrow, <b> April {new Date().getDate()+1}</b> </p>173<span style={{color:"silver",marginTop:"0px"}}>FREE Delivery over â¹499.Fulfilled by PerfectLegal.</span>174</div>175</Grid>176</>177))178:179// TERNARY START180props.categoryAction == "NewerFirst" ?181Object.keys(init).reverse().map((row) => (182<>183<Grid className={classes.gridy} item lg={3} md={4} xs={12} style={{marginBottom:"20px"}}>184<div style={{width:"300px"}}>185<div style={{backgroundColor:"rgb(240, 240, 240)",height:"355px",width:"290px",overflow:"hidden"}}>186<div style={{height:"50px",marginBottom:"8px"}}>187{188 ( 100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0)) ) > 0 ?189 <Avatar style={{position:"relative",top:"6px",left:"20px",backgroundColor:"red"}}><span style={{fontSize:"12px"}}>-{100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}% </span></Avatar>190 :191 <></>192} 193</div>194<div style={{position:"relative",right:"28px"}}>195<ProductCarousel196width="220px!important"197image1={init[row].image}198image2={init[row].image2}199/>200</div>201<p onClick={()=>clicki({202id:row,203image:init[row].image,204image2:init[row].image2,205item:init[row].item,206writer:init[row].writer,207price: init[row].price,208off:init[row].off,209description:init[row].description,210author:init[row].author211})} className="jjj" style={{margin:"16px 0 0 0",cursor:"pointer"}}>{init[row].item}</p>212</div> 213<span style={{color:"silver",marginTop:"0px"}}>{init[row].writer}</span>214<h3 style={{color:"#B12704",margin:"10px 0 0 0px"}}><sup>â¹</sup>{init[row].price} <span style={{color:"silver",fontSize:"16px",textDecoration:"line-through"}}> â¹{Number(init[row].price)+Number(init[row].off)} </span> <span style={{color:"silver",fontSize:"16px",textDecoration:"none",marginLeft:"10px"}}> save({init[row].off}) {100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}%</span></h3>215<p style={{marginTop:"10px"}}> <DoneIcon style={{color:"#B12704"}}/> <span style={{color:"#B12704"}}><b>Express</b></span> Get it by Tomorrow, <b> April {new Date().getDate()+1}</b> </p>216<span style={{color:"silver",marginTop:"0px"}}>FREE Delivery over â¹499.Fulfilled by PerfectLegal.</span>217</div>218</Grid>219</>220))221:222console.log("false")223 :224 "Loading Items..."225 }226</Grid>227 </>228 )...
ClothesCard.jsx
Source:ClothesCard.jsx
1import React,{useEffect,useState} from 'react'2import Avatar from '@material-ui/core/Avatar';3import DoneIcon from '@material-ui/icons/Done'4import Grid from "@material-ui/core/Grid"5import firebaseDb from './firebase';6import ProductCarousel from "./ProductCarousel"7import {useHistory} from "react-router-dom";8import {makeStyles} from '@material-ui/core/styles';9const useStyles = makeStyles((theme) => ({10 gridy: {11 [theme.breakpoints.down('sm')]: {12 margin:'20px 0 0 50%',13 transform:"translate(-50%,0)"14 },15 "&:hover": {16 transform:"scale(1.001)",17 transition:"all 0.5s"18 },19 }20 }));21export default function ClothesCard(props) {22 const classes = useStyles();23 const history=useHistory();24 const[init,upda]=useState({});25 useEffect(()=>{26 firebaseDb.child('Cothes').on("value",snapshot=>{27 28 if(snapshot.val() !=null){29 // upda({...snapshot.val()})30 // setOpen(true);31 32 upda({...snapshot.val()}); 33 }34 })35},[])36 const clicki=(a)=>{37 a.valll="Cothes"38 history.push("/insideproduct",a);39 }40 return (41 <>42 <Grid container style={{marginBottom:"50px",paddingLeft:"20px"}}>43 44 45 46{/* ternary start */}47{48 Object.keys(init) && Object.keys(init).length > 0 && Array.isArray(Object.keys(init))?49 props.categoryAction == "LowHigh" ?50//ternary start51 Object.keys(init).sort((a, b) => init[a].price - init[b].price).map((row) => (52 <>53 <Grid className={classes.gridy} item lg={3} md={4} xs={6} style={{marginBottom:"20px"}}>54 <div style={{width:"300px"}}>55 <div style={{backgroundColor:"white",height:"355px",width:"290px",overflow:"hidden"}}>56 <div style={{height:"50px",marginBottom:"8px"}}>57 <Avatar style={{position:"relative",top:"6px",left:"20px",backgroundColor:"red"}}><span style={{fontSize:"12px"}}>-{100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}% </span></Avatar>58 </div>59 <div style={{position:"relative",right:"28px"}}>60 <ProductCarousel61 width="220px!important"62 height="220px"63 image1={init[row].image}64 image2={init[row].image2}65 />66 </div>67 <p onClick={()=>clicki({68 id:row,69 image:init[row].image,70 image2:init[row].image2,71 item:init[row].item,72 sellers:init[row].sellers,73 price: init[row].price,74 off:init[row].off,75 description:init[row].description,76 about_seller:init[row].about_seller77 })} className="jjj" style={{margin:"16px 0 0 0",cursor:"pointer"}}>{init[row].item}</p>78 </div> 79 <span style={{color:"silver",marginTop:"0px"}}>{init[row].sellers}</span>80 <h3 style={{color:"#B12704",margin:"10px 0 0 0px"}}><sup>â¹</sup>{init[row].price} <span style={{color:"silver",fontSize:"16px",textDecoration:"line-through"}}> â¹{Number(init[row].price)+Number(init[row].off)} </span> <span style={{color:"silver",fontSize:"16px",textDecoration:"none",marginLeft:"10px"}}> save({init[row].off}) {100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}%</span></h3>81<p style={{marginTop:"10px"}}> <DoneIcon style={{color:"#B12704"}}/> <span style={{color:"#B12704"}}><b>Express</b></span> Get it by Tomorrow, <b> March {new Date().getDate()+1}</b> </p>82 <span style={{color:"silver",marginTop:"0px"}}>FREE Delivery over â¹499.Fulfilled by PerfectLegal.</span>83 </div>84 </Grid>85 </>86 ))87 :88//trenery Start89props.categoryAction == "HighLow" ?90 Object.keys(init).sort((a, b) => init[a].price - init[b].price).reverse().map((row) => (91<>92<Grid className={classes.gridy} item lg={3} md={4} xs={6} style={{marginBottom:"20px"}}>93<div style={{width:"300px"}}>94<div style={{backgroundColor:"white",height:"355px",width:"290px",overflow:"hidden"}}>95<div style={{height:"50px",marginBottom:"8px"}}>96<Avatar style={{position:"relative",top:"6px",left:"20px",backgroundColor:"red"}}><span style={{fontSize:"12px"}}>-{100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}% </span></Avatar>97</div>98<div style={{position:"relative",right:"28px"}}>99<ProductCarousel100width="220px!important"101height="220px"102image1={init[row].image}103image2={init[row].image2}104/>105</div>106<p onClick={()=>clicki({107id:row,108image:init[row].image,109image2:init[row].image2,110item:init[row].item,111sellers:init[row].sellers,112price: init[row].price,113off:init[row].off,114description:init[row].description,115about_seller:init[row].about_seller116})} className="jjj" style={{margin:"16px 0 0 0",cursor:"pointer"}}>{init[row].item}</p>117</div> 118<span style={{color:"silver",marginTop:"0px"}}>{init[row].sellers}</span>119<h3 style={{color:"#B12704",margin:"10px 0 0 0px"}}><sup>â¹</sup>{init[row].price} <span style={{color:"silver",fontSize:"16px",textDecoration:"line-through"}}> â¹{Number(init[row].price)+Number(init[row].off)} </span> <span style={{color:"silver",fontSize:"16px",textDecoration:"none",marginLeft:"10px"}}> save({init[row].off}) {100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}%</span></h3>120<p style={{marginTop:"10px"}}> <DoneIcon style={{color:"#B12704"}}/> <span style={{color:"#B12704"}}><b>Express</b></span> Get it by Tomorrow, <b> March {new Date().getDate()+1}</b> </p>121<span style={{color:"silver",marginTop:"0px"}}>FREE Delivery over â¹499.Fulfilled by PerfectLegal.</span>122</div>123</Grid>124</>125))126:127//trenery Start128props.categoryAction == "OlderFirst" ?129Object.keys(init).map((row) => (130<>131<Grid className={classes.gridy} item lg={3} md={4} xs={6} style={{marginBottom:"20px"}}>132<div style={{width:"300px"}}>133<div style={{backgroundColor:"white",height:"355px",width:"290px",overflow:"hidden"}}>134<div style={{height:"50px",marginBottom:"8px"}}>135<Avatar style={{position:"relative",top:"6px",left:"20px",backgroundColor:"red"}}><span style={{fontSize:"12px"}}>-{100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}% </span></Avatar>136</div>137<div style={{position:"relative",right:"28px"}}>138<ProductCarousel139width="220px!important"140height="220px"141image1={init[row].image}142image2={init[row].image2}143/>144</div>145<p onClick={()=>clicki({146id:row,147image:init[row].image,148image2:init[row].image2,149item:init[row].item,150sellers:init[row].sellers,151price: init[row].price,152off:init[row].off,153description:init[row].description,154about_seller:init[row].about_seller155})} className="jjj" style={{margin:"16px 0 0 0",cursor:"pointer"}}>{init[row].item}</p>156</div> 157<span style={{color:"silver",marginTop:"0px"}}>{init[row].sellers}</span>158<h3 style={{color:"#B12704",margin:"10px 0 0 0px"}}><sup>â¹</sup>{init[row].price} <span style={{color:"silver",fontSize:"16px",textDecoration:"line-through"}}> â¹{Number(init[row].price)+Number(init[row].off)} </span> <span style={{color:"silver",fontSize:"16px",textDecoration:"none",marginLeft:"10px"}}> save({init[row].off}) {100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}%</span></h3>159<p style={{marginTop:"10px"}}> <DoneIcon style={{color:"#B12704"}}/> <span style={{color:"#B12704"}}><b>Express</b></span> Get it by Tomorrow, <b> March {new Date().getDate()+1}</b> </p>160<span style={{color:"silver",marginTop:"0px"}}>FREE Delivery over â¹499.Fulfilled by PerfectLegal.</span>161</div>162</Grid>163</>164))165:166// TERNARY START167props.categoryAction == "NewerFirst" ?168Object.keys(init).reverse().map((row) => (169<>170<Grid className={classes.gridy} item lg={3} md={4} xs={6} style={{marginBottom:"20px"}}>171<div style={{width:"300px"}}>172<div style={{backgroundColor:"white",height:"355px",width:"290px",overflow:"hidden"}}>173<div style={{height:"50px",marginBottom:"8px"}}>174<Avatar style={{position:"relative",top:"6px",left:"20px",backgroundColor:"red"}}><span style={{fontSize:"12px"}}>-{100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}% </span></Avatar>175</div>176<div style={{position:"relative",right:"28px"}}>177<ProductCarousel178width="220px!important"179height="220px"180image1={init[row].image}181image2={init[row].image2}182/>183</div>184<p onClick={()=>clicki({185id:row,186image:init[row].image,187image2:init[row].image2,188item:init[row].item,189sellers:init[row].sellers,190price: init[row].price,191off:init[row].off,192description:init[row].description,193about_seller:init[row].about_seller194})} className="jjj" style={{margin:"16px 0 0 0",cursor:"pointer"}}>{init[row].item}</p>195</div> 196<span style={{color:"silver",marginTop:"0px"}}>{init[row].sellers}</span>197<h3 style={{color:"#B12704",margin:"10px 0 0 0px"}}><sup>â¹</sup>{init[row].price} <span style={{color:"silver",fontSize:"16px",textDecoration:"line-through"}}> â¹{Number(init[row].price)+Number(init[row].off)} </span> <span style={{color:"silver",fontSize:"16px",textDecoration:"none",marginLeft:"10px"}}> save({init[row].off}) {100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}%</span></h3>198<p style={{marginTop:"10px"}}> <DoneIcon style={{color:"#B12704"}}/> <span style={{color:"#B12704"}}><b>Express</b></span> Get it by Tomorrow, <b> March {new Date().getDate()+1}</b> </p>199<span style={{color:"silver",marginTop:"0px"}}>FREE Delivery over â¹499.Fulfilled by PerfectLegal.</span>200</div>201</Grid>202</>203))204:205alert("select some category")206 :207 "Loading Items..."208 }209</Grid>210 </>211 )...
TelivisionCard.jsx
Source:TelivisionCard.jsx
1import React,{useEffect,useState} from 'react'2import Avatar from '@material-ui/core/Avatar';3import DoneIcon from '@material-ui/icons/Done'4import Grid from "@material-ui/core/Grid"5import firebaseDb from './firebase';6import ProductCarousel from "./ProductCarousel"7import {useHistory} from "react-router-dom";8import {makeStyles} from '@material-ui/core/styles';9const useStyles = makeStyles((theme) => ({10 gridy: {11 [theme.breakpoints.down('sm')]: {12 margin:'20px 0 0 50%',13 transform:"translate(-50%,0)"14 },15 "&:hover": {16 transform:"scale(1.001)",17 transition:"all 0.5s"18 },19 }20 }));21export default function TelivisionCard(props) {22 const classes = useStyles();23 const history=useHistory();24 const[init,upda]=useState({});25 useEffect(()=>{26 firebaseDb.child('Television').on("value",snapshot=>{27 28 if(snapshot.val() !=null){29 // upda({...snapshot.val()})30 // setOpen(true);31 32 upda({...snapshot.val()}); 33 }34 })35},[])36 const clicki=(a)=>{37 a.valll="Television"38 history.push("/insideproduct",a);39 }40 return (41 <>42 <Grid container style={{marginBottom:"50px",paddingLeft:"20px"}}>43 44 45{/* ternary start */}46{47 Object.keys(init) && Object.keys(init).length > 0 && Array.isArray(Object.keys(init))?48 props.categoryAction == "LowHigh" ?49//ternary start50 Object.keys(init).sort((a, b) => init[a].price - init[b].price).map((row) => (51 <>52 <Grid className={classes.gridy} item lg={4} sm={6} xs={12} style={{marginBottom:"20px"}}>53 <div style={{width:"300px"}}>54 <div style={{backgroundColor:"white",height:"355px",width:"380px",overflow:"hidden"}}>55 <div style={{height:"50px",marginBottom:"8px"}}>56 <Avatar style={{position:"relative",top:"6px",left:"20px",backgroundColor:"red"}}><span style={{fontSize:"12px"}}>-{100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}% </span></Avatar>57 </div>58 <div style={{position:"relative",right:"28px"}}>59 <ProductCarousel60 width="310px!important"61 image1={init[row].image}62 image2={init[row].image2}63 />64 </div>65 <p onClick={()=>clicki({66 id:row,67 image:init[row].image,68 image2:init[row].image2,69 item:init[row].item,70 sellers:init[row].sellers,71 price: init[row].price,72 off:init[row].off,73 description:init[row].description,74 about_seller:init[row].about_seller75 })} className="jjj" style={{margin:"16px 0 0 0",cursor:"pointer"}}>{init[row].item}</p>76 </div> 77 <span style={{color:"silver",marginTop:"0px"}}>{init[row].sellers}</span>78 <h3 style={{color:"#B12704",margin:"10px 0 0 0px"}}><sup>â¹</sup>{init[row].price} <span style={{color:"silver",fontSize:"16px",textDecoration:"line-through"}}> â¹{Number(init[row].price)+Number(init[row].off)} </span> <span style={{color:"silver",fontSize:"16px",textDecoration:"none",marginLeft:"10px"}}> save({init[row].off}) {100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}%</span></h3>79<p style={{marginTop:"10px"}}> <DoneIcon style={{color:"#B12704"}}/> <span style={{color:"#B12704"}}><b>Express</b></span> Get it by Tomorrow, <b> March {new Date().getDate()+1}</b> </p>80 <span style={{color:"silver",marginTop:"0px"}}>FREE Delivery over â¹499.Fulfilled by PerfectLegal.</span>81 </div>82 </Grid>83 </>84 ))85 :86//trenery Start87props.categoryAction == "HighLow" ?88 Object.keys(init).sort((a, b) => init[a].price - init[b].price).reverse().map((row) => (89<>90<Grid className={classes.gridy} item lg={4} sm={6} xs={12} style={{marginBottom:"20px"}}>91<div style={{width:"300px"}}>92<div style={{backgroundColor:"white",height:"355px",width:"380px",overflow:"hidden"}}>93<div style={{height:"50px",marginBottom:"8px"}}>94<Avatar style={{position:"relative",top:"6px",left:"20px",backgroundColor:"red"}}><span style={{fontSize:"12px"}}>-{100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}% </span></Avatar>95</div>96<div style={{position:"relative",right:"28px"}}>97<ProductCarousel98width="310px!important"99image1={init[row].image}100image2={init[row].image2}101/>102</div>103<p onClick={()=>clicki({104id:row,105image:init[row].image,106image2:init[row].image2,107item:init[row].item,108sellers:init[row].sellers,109price: init[row].price,110off:init[row].off,111description:init[row].description,112about_seller:init[row].about_seller113})} className="jjj" style={{margin:"16px 0 0 0",cursor:"pointer"}}>{init[row].item}</p>114</div> 115<span style={{color:"silver",marginTop:"0px"}}>{init[row].sellers}</span>116<h3 style={{color:"#B12704",margin:"10px 0 0 0px"}}><sup>â¹</sup>{init[row].price} <span style={{color:"silver",fontSize:"16px",textDecoration:"line-through"}}> â¹{Number(init[row].price)+Number(init[row].off)} </span> <span style={{color:"silver",fontSize:"16px",textDecoration:"none",marginLeft:"10px"}}> save({init[row].off}) {100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}%</span></h3>117<p style={{marginTop:"10px"}}> <DoneIcon style={{color:"#B12704"}}/> <span style={{color:"#B12704"}}><b>Express</b></span> Get it by Tomorrow, <b> March {new Date().getDate()+1}</b> </p>118<span style={{color:"silver",marginTop:"0px"}}>FREE Delivery over â¹499.Fulfilled by PerfectLegal.</span>119</div>120</Grid>121</>122))123:124//trenery Start125props.categoryAction == "OlderFirst" ?126Object.keys(init).map((row) => (127<>128<Grid className={classes.gridy} item lg={4} sm={6} xs={12} style={{marginBottom:"20px"}}>129<div style={{width:"300px"}}>130<div style={{backgroundColor:"white",height:"355px",width:"380px",overflow:"hidden"}}>131<div style={{height:"50px",marginBottom:"8px"}}>132<Avatar style={{position:"relative",top:"6px",left:"20px",backgroundColor:"red"}}><span style={{fontSize:"12px"}}>-{100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}% </span></Avatar>133</div>134<div style={{position:"relative",right:"28px"}}>135<ProductCarousel136width="310px!important"137image1={init[row].image}138image2={init[row].image2}139/>140</div>141<p onClick={()=>clicki({142id:row,143image:init[row].image,144image2:init[row].image2,145item:init[row].item,146sellers:init[row].sellers,147price: init[row].price,148off:init[row].off,149description:init[row].description,150about_seller:init[row].about_seller151})} className="jjj" style={{margin:"16px 0 0 0",cursor:"pointer"}}>{init[row].item}</p>152</div> 153<span style={{color:"silver",marginTop:"0px"}}>{init[row].sellers}</span>154<h3 style={{color:"#B12704",margin:"10px 0 0 0px"}}><sup>â¹</sup>{init[row].price} <span style={{color:"silver",fontSize:"16px",textDecoration:"line-through"}}> â¹{Number(init[row].price)+Number(init[row].off)} </span> <span style={{color:"silver",fontSize:"16px",textDecoration:"none",marginLeft:"10px"}}> save({init[row].off}) {100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}%</span></h3>155<p style={{marginTop:"10px"}}> <DoneIcon style={{color:"#B12704"}}/> <span style={{color:"#B12704"}}><b>Express</b></span> Get it by Tomorrow, <b> March {new Date().getDate()+1}</b> </p>156<span style={{color:"silver",marginTop:"0px"}}>FREE Delivery over â¹499.Fulfilled by PerfectLegal.</span>157</div>158</Grid>159</>160))161:162// TERNARY START163props.categoryAction == "NewerFirst" ?164Object.keys(init).reverse().map((row) => (165<>166<Grid className={classes.gridy} item lg={4} sm={6} xs={12} style={{marginBottom:"20px"}}>167<div style={{width:"300px"}}>168<div style={{backgroundColor:"white",height:"355px",width:"380px",overflow:"hidden"}}>169<div style={{height:"50px",marginBottom:"8px"}}>170<Avatar style={{position:"relative",top:"6px",left:"20px",backgroundColor:"red"}}><span style={{fontSize:"12px"}}>-{100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}% </span></Avatar>171</div>172<div style={{position:"relative",right:"28px"}}>173<ProductCarousel174width="310px!important"175image1={init[row].image}176image2={init[row].image2}177/>178</div>179<p onClick={()=>clicki({180id:row,181image:init[row].image,182image2:init[row].image2,183item:init[row].item,184sellers:init[row].sellers,185price: init[row].price,186off:init[row].off,187description:init[row].description,188about_seller:init[row].about_seller189})} className="jjj" style={{margin:"16px 0 0 0",cursor:"pointer"}}>{init[row].item}</p>190</div> 191<span style={{color:"silver",marginTop:"0px"}}>{init[row].sellers}</span>192<h3 style={{color:"#B12704",margin:"10px 0 0 0px"}}><sup>â¹</sup>{init[row].price} <span style={{color:"silver",fontSize:"16px",textDecoration:"line-through"}}> â¹{Number(init[row].price)+Number(init[row].off)} </span> <span style={{color:"silver",fontSize:"16px",textDecoration:"none",marginLeft:"10px"}}> save({init[row].off}) {100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}%</span></h3>193<p style={{marginTop:"10px"}}> <DoneIcon style={{color:"#B12704"}}/> <span style={{color:"#B12704"}}><b>Express</b></span> Get it by Tomorrow, <b> March {new Date().getDate()+1}</b> </p>194<span style={{color:"silver",marginTop:"0px"}}>FREE Delivery over â¹499.Fulfilled by PerfectLegal.</span>195</div>196</Grid>197</>198))199:200alert("select some category")201 :202 "Loading Items..."203 }204</Grid>205 </>206 )...
MobileCard.jsx
Source:MobileCard.jsx
1import React,{useEffect,useState} from 'react'2import Avatar from '@material-ui/core/Avatar';3import DoneIcon from '@material-ui/icons/Done'4import Grid from "@material-ui/core/Grid"5import firebaseDb from './firebase';6import ProductCarousel from "./ProductCarousel"7import {useHistory} from "react-router-dom";8import {makeStyles} from '@material-ui/core/styles';9const useStyles = makeStyles((theme) => ({10 gridy: {11 [theme.breakpoints.down('sm')]: {12 margin:'20px 0 0 50%',13 transform:"translate(-50%,0)"14 },15 "&:hover": {16 transform:"scale(1.001)",17 transition:"all 0.5s"18 },19 }20 }));21export default function MobileCard(props) {22 const classes = useStyles();23 const history=useHistory();24 const[init,upda]=useState({});25 useEffect(()=>{26 firebaseDb.child('Mobile').on("value",snapshot=>{27 28 if(snapshot.val() !=null){29 // upda({...snapshot.val()})30 // setOpen(true);31 32 upda({...snapshot.val()}); 33 }34 })35},[])36 const clicki=(a)=>{37 a.valll="Mobile"38 history.push("/insideproduct",a);39 }40 return (41 <>42 <Grid container style={{marginBottom:"50px",paddingLeft:"20px"}}>43 44 45{/* ternary start */}46{47 Object.keys(init) && Object.keys(init).length > 0 && Array.isArray(Object.keys(init))?48 props.categoryAction == "LowHigh" ?49//ternary start50 Object.keys(init).sort((a, b) => init[a].price - init[b].price).map((row) => (51 <>52 <Grid className={classes.gridy} item lg={3} md={4} xs={12} style={{marginBottom:"20px"}}>53 <div style={{width:"300px"}}>54 <div style={{backgroundColor:"white",height:"355px",width:"290px",overflow:"hidden"}}>55 <div style={{height:"50px",marginBottom:"8px"}}>56 <Avatar style={{position:"relative",top:"6px",left:"20px",backgroundColor:"red"}}><span style={{fontSize:"12px"}}>-{100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}% </span></Avatar>57 </div>58 <div style={{position:"relative",right:"28px"}}>59 <ProductCarousel60 width="220px!important"61 image1={init[row].image}62 image2={init[row].image2}63 />64 </div>65 <p onClick={()=>clicki({66 id:row,67 image:init[row].image,68 image2:init[row].image2,69 item:init[row].item,70 sellers:init[row].sellers,71 price: init[row].price,72 off:init[row].off,73 description:init[row].description,74 about_seller:init[row].about_seller75 })} className="jjj" style={{margin:"16px 0 0 0",cursor:"pointer"}}>{init[row].item}</p>76 </div> 77 <span style={{color:"silver",marginTop:"0px"}}>{init[row].sellers}</span>78 <h3 style={{color:"#B12704",margin:"10px 0 0 0px"}}><sup>â¹</sup>{init[row].price} <span style={{color:"silver",fontSize:"16px",textDecoration:"line-through"}}> â¹{Number(init[row].price)+Number(init[row].off)} </span> <span style={{color:"silver",fontSize:"16px",textDecoration:"none",marginLeft:"10px"}}> save({init[row].off}) {100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}%</span></h3>79<p style={{marginTop:"10px"}}> <DoneIcon style={{color:"#B12704"}}/> <span style={{color:"#B12704"}}><b>Express</b></span> Get it by Tomorrow, <b> March {new Date().getDate()+1}</b> </p>80 <span style={{color:"silver",marginTop:"0px"}}>FREE Delivery over â¹499.Fulfilled by PerfectLegal.</span>81 </div>82 </Grid>83 </>84 ))85 :86//trenery Start87props.categoryAction == "HighLow" ?88 Object.keys(init).sort((a, b) => init[a].price - init[b].price).reverse().map((row) => (89<>90<Grid className={classes.gridy} item lg={3} md={4} xs={12} style={{marginBottom:"20px"}}>91<div style={{width:"300px"}}>92<div style={{backgroundColor:"white",height:"355px",width:"290px",overflow:"hidden"}}>93<div style={{height:"50px",marginBottom:"8px"}}>94<Avatar style={{position:"relative",top:"6px",left:"20px",backgroundColor:"red"}}><span style={{fontSize:"12px"}}>-{100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}% </span></Avatar>95</div>96<div style={{position:"relative",right:"28px"}}>97<ProductCarousel98width="220px!important"99image1={init[row].image}100image2={init[row].image2}101/>102</div>103<p onClick={()=>clicki({104id:row,105image:init[row].image,106image2:init[row].image2,107item:init[row].item,108sellers:init[row].sellers,109price: init[row].price,110off:init[row].off,111description:init[row].description,112about_seller:init[row].about_seller113})} className="jjj" style={{margin:"16px 0 0 0",cursor:"pointer"}}>{init[row].item}</p>114</div> 115<span style={{color:"silver",marginTop:"0px"}}>{init[row].sellers}</span>116<h3 style={{color:"#B12704",margin:"10px 0 0 0px"}}><sup>â¹</sup>{init[row].price} <span style={{color:"silver",fontSize:"16px",textDecoration:"line-through"}}> â¹{Number(init[row].price)+Number(init[row].off)} </span> <span style={{color:"silver",fontSize:"16px",textDecoration:"none",marginLeft:"10px"}}> save({init[row].off}) {100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}%</span></h3>117<p style={{marginTop:"10px"}}> <DoneIcon style={{color:"#B12704"}}/> <span style={{color:"#B12704"}}><b>Express</b></span> Get it by Tomorrow, <b> March {new Date().getDate()+1}</b> </p>118<span style={{color:"silver",marginTop:"0px"}}>FREE Delivery over â¹499.Fulfilled by PerfectLegal.</span>119</div>120</Grid>121</>122))123:124//trenery Start125props.categoryAction == "OlderFirst" ?126Object.keys(init).map((row) => (127<>128<Grid className={classes.gridy} item lg={3} md={4} xs={12} style={{marginBottom:"20px"}}>129<div style={{width:"300px"}}>130<div style={{backgroundColor:"white",height:"355px",width:"290px",overflow:"hidden"}}>131<div style={{height:"50px",marginBottom:"8px"}}>132<Avatar style={{position:"relative",top:"6px",left:"20px",backgroundColor:"red"}}><span style={{fontSize:"12px"}}>-{100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}% </span></Avatar>133</div>134<div style={{position:"relative",right:"28px"}}>135<ProductCarousel136width="220px!important"137image1={init[row].image}138image2={init[row].image2}139/>140</div>141<p onClick={()=>clicki({142id:row,143image:init[row].image,144image2:init[row].image2,145item:init[row].item,146sellers:init[row].sellers,147price: init[row].price,148off:init[row].off,149description:init[row].description,150about_seller:init[row].about_seller151})} className="jjj" style={{margin:"16px 0 0 0",cursor:"pointer"}}>{init[row].item}</p>152</div> 153<span style={{color:"silver",marginTop:"0px"}}>{init[row].sellers}</span>154<h3 style={{color:"#B12704",margin:"10px 0 0 0px"}}><sup>â¹</sup>{init[row].price} <span style={{color:"silver",fontSize:"16px",textDecoration:"line-through"}}> â¹{Number(init[row].price)+Number(init[row].off)} </span> <span style={{color:"silver",fontSize:"16px",textDecoration:"none",marginLeft:"10px"}}> save({init[row].off}) {100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}%</span></h3>155<p style={{marginTop:"10px"}}> <DoneIcon style={{color:"#B12704"}}/> <span style={{color:"#B12704"}}><b>Express</b></span> Get it by Tomorrow, <b> March {new Date().getDate()+1}</b> </p>156<span style={{color:"silver",marginTop:"0px"}}>FREE Delivery over â¹499.Fulfilled by PerfectLegal.</span>157</div>158</Grid>159</>160))161:162// TERNARY START163props.categoryAction == "NewerFirst" ?164Object.keys(init).reverse().map((row) => (165<>166<Grid className={classes.gridy} item lg={3} md={4} xs={12} style={{marginBottom:"20px"}}>167<div style={{width:"300px"}}>168<div style={{backgroundColor:"white",height:"355px",width:"290px",overflow:"hidden"}}>169<div style={{height:"50px",marginBottom:"8px"}}>170<Avatar style={{position:"relative",top:"6px",left:"20px",backgroundColor:"red"}}><span style={{fontSize:"12px"}}>-{100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}% </span></Avatar>171</div>172<div style={{position:"relative",right:"28px"}}>173<ProductCarousel174width="220px!important"175image1={init[row].image}176image2={init[row].image2}177/>178</div>179<p onClick={()=>clicki({180id:row,181image:init[row].image,182image2:init[row].image2,183item:init[row].item,184sellers:init[row].sellers,185price: init[row].price,186off:init[row].off,187description:init[row].description,188about_seller:init[row].about_seller189})} className="jjj" style={{margin:"16px 0 0 0",cursor:"pointer"}}>{init[row].item}</p>190</div> 191<span style={{color:"silver",marginTop:"0px"}}>{init[row].sellers}</span>192<h3 style={{color:"#B12704",margin:"10px 0 0 0px"}}><sup>â¹</sup>{init[row].price} <span style={{color:"silver",fontSize:"16px",textDecoration:"line-through"}}> â¹{Number(init[row].price)+Number(init[row].off)} </span> <span style={{color:"silver",fontSize:"16px",textDecoration:"none",marginLeft:"10px"}}> save({init[row].off}) {100-((Number(init[row].price)/(Number(init[row].price)+Number(init[row].off))*100).toFixed(0))}%</span></h3>193<p style={{marginTop:"10px"}}> <DoneIcon style={{color:"#B12704"}}/> <span style={{color:"#B12704"}}><b>Express</b></span> Get it by Tomorrow, <b> March {new Date().getDate()+1}</b> </p>194<span style={{color:"silver",marginTop:"0px"}}>FREE Delivery over â¹499.Fulfilled by PerfectLegal.</span>195</div>196</Grid>197</>198))199:200alert("select some category")201 :202 203 "Loading Items..."204 }205</Grid>206 </>207 )...
core.googlemap.js
Source:core.googlemap.js
1function jacqueline_googlemap_init(dom_obj, coords) {2 "use strict";3 if (typeof JACQUELINE_STORAGE['googlemap_init_obj'] == 'undefined') jacqueline_googlemap_init_styles();4 JACQUELINE_STORAGE['googlemap_init_obj'].geocoder = '';5 try {6 var id = dom_obj.id;7 JACQUELINE_STORAGE['googlemap_init_obj'][id] = {8 dom: dom_obj,9 markers: coords.markers,10 geocoder_request: false,11 opt: {12 zoom: coords.zoom,13 center: null,14 scrollwheel: false,15 scaleControl: false,...
main.js
Source:main.js
1/*! main.js | Bulkit | CSS Ninja */2/* ==========================================================================3Website core JS file (see function.js for complete function reference)4========================================================================== */5"use strict";6initPageLoader();7$(document).ready(function ($) {8 var el = document.querySelectorAll('[data-lazy-load]');9 var observer = lozad(el, {10 loaded: function loaded(el) {11 // Custom implementation on a loaded element12 el.parentNode.classList.add('loaded');13 }14 });15 observer.observe(); //Global functions16 if (env === 'development') {17 changeDemoImages();18 }19 initThemeSwitcher();20 initSlider();21 initBackgroundImages(); //Layout functions22 initNavbar();23 initLandingNavbar();24 initMobileMenu();25 initLandingMobileMenu();26 initNavbarDropdown();27 initSidebar();28 feather.replace(); //Tabs29 initTabsNav();30 initNavigationTabs();31 initVerticalTabs(); //Cards32 initMediaCards();33 initTiltCards(); //Form controls34 initDatepicker();35 initTimepicker();36 initDatepickerAlt();37 initChosenSelects();38 initMaterialSelect();39 initAutocompletes();40 initFileInputs();41 initRangeInput();42 initRangeInputs();43 initJqueryTagInput();44 initBulmaTags();45 initBulmaSteps();46 initBulmaIconpicker();47 initBulmaCalendar();48 initComboBox();49 initImageComboBox();50 initStackedComboBox(); //4. Popups51 initPopovers();52 initTooltips();53 initModals(); //5. Carousels54 initBasicCarousel();55 initVerticalCarousel();56 initFlatCarousel();57 initImageCarousel();58 initSingleImageCarousel();59 initMultipleImagesCarousel(); //6. Video60 initVideoEmbed();61 initBackgroundVideo();62 initPlayers(); //7. Counters63 initCounters(); //8. Accordions64 initSimpleAccordion();65 initAccordions(); //9. File uploader66 initFileUploader(); //10. Toasts67 initToasts(); //11. Demo68 initDemo();69 initScrollspyNav();70 initParallax();71 initBackToTop(); //12. Utility functions72 initGitem();73 initAnchorScroll();74 initQuickview();75 initScrollReveal(); //13. Landing pages functions76 initMockup();77 initClientsCarousel();78 initPeopleCarousel();79 initCustomCarousel();80 initCarousel();81 initLandingCarousel();82 initTestimonials();83 initCharacterTestimonials();84 initPricing();85 initPricingCarousel();86 initTabbedPricing();87 initFreelancerPricing();88 initSwitchPricing();89 initBoxedPricing();90 initOnePagePricing();91 initBlog();92 initSearchBox();93 initNavigationDots();94 initFaq();95 initAuth();96 initAnimations();97 initCanvas();98 initParticles();99 initAnimatedSvg();100 initChatWidget();101 initContactToggler();102 initMapBox();103 initCodeTabs();...
plugin_init.js
Source:plugin_init.js
1import {values} from 'lodash';2import expect from 'expect.js';3import sinon from 'auto-release-sinon';4import pluginInit from '../plugin_init';5describe('Plugin init', () => {6 const getPluginCollection = (plugins) => ({7 byId: plugins,8 toArray: () => values(plugins)9 });10 it('should call preInit before init', async () => {11 const plugins = {12 foo: {13 id: 'foo',14 init: sinon.spy(),15 preInit: sinon.spy(),16 requiredIds: []17 },18 bar: {19 id: 'bar',20 init: sinon.spy(),21 preInit: sinon.spy(),22 requiredIds: []23 },24 baz: {25 id: 'baz',26 init: sinon.spy(),27 preInit: sinon.spy(),28 requiredIds: []29 }30 };31 await pluginInit(getPluginCollection(plugins));32 expect(plugins.foo.preInit.calledBefore(plugins.foo.init)).to.be.ok();33 expect(plugins.foo.preInit.calledBefore(plugins.bar.init)).to.be.ok();34 expect(plugins.foo.preInit.calledBefore(plugins.baz.init)).to.be.ok();35 expect(plugins.bar.preInit.calledBefore(plugins.foo.init)).to.be.ok();36 expect(plugins.bar.preInit.calledBefore(plugins.bar.init)).to.be.ok();37 expect(plugins.bar.preInit.calledBefore(plugins.baz.init)).to.be.ok();38 expect(plugins.baz.preInit.calledBefore(plugins.foo.init)).to.be.ok();39 expect(plugins.baz.preInit.calledBefore(plugins.bar.init)).to.be.ok();40 expect(plugins.baz.preInit.calledBefore(plugins.baz.init)).to.be.ok();41 });42 it('should call preInits in correct order based on requirements', async () => {43 const plugins = {44 foo: {45 id: 'foo',46 init: sinon.spy(),47 preInit: sinon.spy(),48 requiredIds: ['bar', 'baz']49 },50 bar: {51 id: 'bar',52 init: sinon.spy(),53 preInit: sinon.spy(),54 requiredIds: []55 },56 baz: {57 id: 'baz',58 init: sinon.spy(),59 preInit: sinon.spy(),60 requiredIds: ['bar']61 }62 };63 await pluginInit(getPluginCollection(plugins));64 expect(plugins.bar.preInit.firstCall.calledBefore(plugins.foo.init.firstCall)).to.be.ok();65 expect(plugins.bar.preInit.firstCall.calledBefore(plugins.baz.init.firstCall)).to.be.ok();66 expect(plugins.baz.preInit.firstCall.calledBefore(plugins.foo.init.firstCall)).to.be.ok();67 });...
Using AI Code Generation
1const { openBrowser, goto, closeBrowser } = require('taiko');2(async () => {3 try {4 await openBrowser();5 await goto("google.com");6 } catch (e) {7 console.error(e);8 } finally {9 await closeBrowser();10 }11})();12const { openBrowser, goto, closeBrowser } = require('taiko');13(async () => {14 try {15 await openBrowser();16 await goto("google.com");17 } catch (e) {18 console.error(e);19 } finally {20 await closeBrowser();21 }22})();23const { openBrowser, goto, closeBrowser } = require('taiko');24(async () => {25 try {26 await openBrowser();27 await goto("google.com");28 } catch (e) {29 console.error(e);30 } finally {31 await closeBrowser();32 }33})();34const { openBrowser, goto, closeBrowser } = require('taiko');35(async () => {36 try {37 await openBrowser();38 await goto("google.com");39 } catch (e) {40 console.error(e);41 } finally {42 await closeBrowser();43 }44})();45const { openBrowser, goto, closeBrowser } = require('taiko');46(async () => {47 try {48 await openBrowser();49 await goto("google.com");50 } catch (e) {51 console.error(e);52 } finally {53 await closeBrowser();54 }55})();56const { openBrowser, goto, closeBrowser } = require('taiko');57(async () => {58 try {59 await openBrowser();60 await goto("google.com");61 } catch (e) {62 console.error(e);63 } finally {64 await closeBrowser();65 }66})();67const { openBrowser, goto, closeBrowser } = require('taiko');68(async () => {69 try {70 await openBrowser();71 await goto("google.com");72 } catch (e) {
Using AI Code Generation
1(async () => {2 try {3 await init();4 await openBrowser();5 await goto("google.com");6 await write("Taiko");7 await press("Enter");8 await closeBrowser();9 } catch (error) {10 console.error(error);11 } finally {12 await closeBrowser();13 }14})();
Using AI Code Generation
1const { openBrowser, goto, write, click, closeBrowser } = require('taiko');2(async () => {3 try {4 await openBrowser();5 await write("Taiko");6 await click("Google Search");7 } catch (e) {8 console.error(e);9 } finally {10 await closeBrowser();11 }12})();13const { openBrowser, goto, write, click, closeBrowser } = require('taiko');14(async () => {15 try {16 await openBrowser();17 await write("Taiko");18 await click("Google Search");19 } catch (e) {20 console.error(e);21 } finally {22 await closeBrowser();23 }24})();25const { openBrowser, goto, write, click, closeBrowser } = require('taiko');26(async () => {27 try {28 await openBrowser();29 await write("Taiko");30 await click("Google Search");31 } catch (e) {32 console.error(e);33 } finally {34 await closeBrowser();35 }36})();37const { openBrowser, goto, write, click, closeBrowser } = require('taiko');38(async () => {39 try {40 await openBrowser();41 await write("Taiko");42 await click("Google Search");43 } catch (e) {44 console.error(e);45 } finally {46 await closeBrowser();47 }48})();49const { openBrowser, goto, write, click, closeBrowser } = require('taiko');50(async () => {51 try {52 await openBrowser();53 await write("Taiko");54 await click("Google Search");55 } catch (e) {56 console.error(e);57 } finally {58 await closeBrowser();59 }60})();61const { openBrowser, goto, write, click, closeBrowser } = require('ta
Using AI Code Generation
1const { openBrowser, goto, closeBrowser, init } = require('taiko');2(async () => {3 try {4 await init();5 await openBrowser();6 await closeBrowser();7 } catch (e) {8 console.error(e);9 } finally {10 await closeBrowser();11 }12})();13const { openBrowser, goto, closeBrowser, init } = require('taiko');14(async () => {15 try {16 await init();17 await openBrowser();18 await closeBrowser();19 } catch (e) {20 console.error(e);21 } finally {22 await closeBrowser();23 }24})();25const { openBrowser, goto, closeBrowser } = require('taiko');26describe('My Test', () => {27 beforeAll(async () => {28 await openBrowser();29 });30 afterAll(async () => {31 await closeBrowser();32 });33 test('My Test', async () => {34 });35});36const { openBrowser, goto, closeBrowser } = require('taiko');37describe('My Test', () => {38 before(async () => {39 await openBrowser();40 });41 after(async () => {42 await closeBrowser();43 });44 it('My Test', async () => {45 });46});47const { openBrowser, goto, closeBrowser } = require('taiko');48const assert = require("assert");49const { Before, Given, When, Then } = require('cucumber');50Before(async
Using AI Code Generation
1await init();2await openBrowser();3await goto("www.google.com");4await write("Taiko");5await press("Enter");6await screenshot({ path: "./screenshot.png" });7await closeBrowser();8await close();
Using AI Code Generation
1init()2openBrowser({headless:false})3goto("www.google.com")4write("hello world")5press("Enter")6screenshot({path:"google.png"})7closeBrowser()8close()9openTab("www.google.com")10closeTab()11goto("www.google.com")12write("hello world")13press("Enter")14screenshot({path:"google.png"})15closeBrowser()16close()17openTab("www.google.com")18closeTab()19goto("www.google.com")20write("hello world")21press("Enter")22screenshot({path:"google.png"})23closeBrowser()24close()25openTab("www.google.com")26closeTab()27goto("www.google.com")28write("hello world")29press("Enter")30screenshot({path:"google.png"})31closeBrowser()32close()33openTab("www.google.com")
Using AI Code Generation
1const { openBrowser, goto, write, closeBrowser, button, init } = require('taiko');2(async () => {3 try {4 await init();5 await openBrowser({ headless: false });6 await goto("google.com");7 await write("taiko");8 await button("Google Search").click();9 } catch (e) {10 console.error(e);11 } finally {12 await closeBrowser();13 }14})();15const { openBrowser, goto, write, closeBrowser, button } = require('taiko');16(async () => {17 try {18 await openBrowser({ headless: false });19 await goto("google.com");20 await write("taiko");21 await button("Google Search").click();22 } catch (e) {23 console.error(e);24 } finally {25 await closeBrowser();26 }27})();28const { openBrowser, goto, write, closeBrowser, button } = require('taiko');29(async () => {30 try {31 await openBrowser({ headless: false });32 await goto("google.com");33 await write("taiko");34 await button("Google Search").click();35 } catch (e) {36 console.error(e);37 } finally {38 await closeBrowser();39 }40})();41const { openBrowser, goto, write, closeBrowser, button } = require('taiko');42(async () => {43 try {44 await openBrowser({ headless: false });45 await goto("google.com");46 await write("taiko");47 await button("Google Search").click();48 } catch (e) {49 console.error(e);50 } finally {51 await closeBrowser();52 }53})();54const { openBrowser, goto, write, closeBrowser, button } = require('taiko');55(async () => {56 try {57 await openBrowser({ headless: false });58 await goto("google.com");59 await write("taiko");60 await button("Google Search").click();61 } catch (e) {62 console.error(e);63 } finally {64 await closeBrowser();65 }66})();
Using AI Code Generation
1const { openBrowser, goto, write, click, closeBrowser, $ } = require('taiko');2(async () => {3 try {4 await openBrowser({ headless: false });5 await write('Taiko');6 await click('Google Search');7 await click('Taiko - A browser automation library');8 await click('Get Started');9 await click('Installation');10 await click('npm');11 await click('Installation');12 await write('npm install -g taiko');13 await click('Install');14 await click('Next');15 await click('Next
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!