Best JavaScript code snippet using testcafe
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 createTestCafe = require('testcafe');2let testcafe = null;3createTestCafe('localhost', 1337, 1338)4 .then(tc => {5 testcafe = tc;6 const runner = testcafe.createRunner();7 .src('test.js')8 .browsers('chrome')9 .run();10 })11 .then(failedCount => {12 console.log('Tests failed: ' + failedCount);13 testcafe.close();14 });15const createTestCafe = require('testcafe');16let testcafe = null;17createTestCafe('localhost', 1337, 1338)18 .then(tc => {19 testcafe = tc;20 const runner = testcafe.createRunner();21 .src('test.js')22 .browsers('chrome')23 .run();24 })25 .then(failedCount => {26 console.log('Tests failed: ' + failedCount);27 testcafe.close();28 });29const createTestCafe = require('testcafe');30let testcafe = null;31createTestCafe('localhost', 1337, 1338)32 .then(tc => {33 testcafe = tc;34 const runner = testcafe.createRunner();35 .src('test.js')36 .browsers('chrome')37 .run();38 })39 .then(failedCount => {40 console.log('Tests failed: ' + failedCount);41 testcafe.close();42 });43const createTestCafe = require('testcafe');44let testcafe = null;45createTestCafe('localhost', 1337, 1338)46 .then(tc => {47 testcafe = tc;48 const runner = testcafe.createRunner();49 .src('test.js')50 .browsers('chrome')51 .run();52 })53 .then(failedCount => {54 console.log('Tests failed: ' + failedCount);55 testcafe.close();56 });
Using AI Code Generation
1import { Selector } from 'testcafe';2test('My first test', async t => {3});4import { Selector } from 'testcafe';5test('My first test', async t => {6 .typeText('#developer-name', 'John Smith')7 .click('#submit-button');8 const articleHeader = await Selector('.result-content').find('h1');9 let headerText = await articleHeader.innerText;10});11import { Selector, ClientFunction } from 'testcafe';12test('My first test', async t => {13 .typeText('#developer-name', 'John Smith')14 .click('#submit-button');15 const articleHeader = await Selector('.result-content').find('h1');16 let headerText = await articleHeader.innerText;17});18import { Selector, ClientFunction } from 'testcafe';19test('My first test', async t => {20 .typeText('#developer-name', 'John Smith')21 .click('#submit-button');22 const articleHeader = await Selector('.result-content').find('h1');
Using AI Code Generation
1import { Selector } from 'testcafe';2test('My first test', async t => {3});4import { Selector } from 'testcafe';5test('My first test', async t => {6});7import { Selector } from 'testcafe';8test('My first test', async t => {9});10import { Selector } from 'testcafe';11test('My first test', async t => {12});13import { Selector } from 'testcafe';14test('My first test', async t => {15});16import { Selector } from 'testcafe';17test('My first test', async t => {18});19import { Selector } from 'testcafe';20test('My first test', async t => {21});22import { Selector } from 'testcafe';23test('My first test', async t => {24});25import { Selector } from 'testcafe';26test('My first test', async t => {
Using AI Code Generation
1var TestCafe = require('testcafe');2var testcafe = null;3TestCafe.createRunner()4 .src(['test.js'])5 .screenshots('reports/screenshots/', true)6 .browsers(['chrome'])7 .run()8 .then(function (failedCount) {9 console.log('Tests failed: ' + failedCount);10 testcafe.close();11 });12var testCafe = require('testcafe');13testCafe.createTestCafe('localhost', 1337, 1338)14 .then(function (tc) {15 testcafe = tc;16 var runner = testcafe.createRunner();17 .src('test.js')18 .browsers(['chrome'])19 .run();20 })21 .then(function (failedCount) {22 console.log('Tests failed: ' + failedCount);23 testcafe.close();24 });25var testCafe = require('testcafe');26testCafe.createTestCafe('localhost', 1337, 1338)27 .then(function (tc) {28 testcafe = tc;29 var runner = testcafe.createRunner();30 .src('test.js')31 .browsers(['chrome'])32 .run();33 })34 .then(function (failedCount) {35 console.log('Tests failed: ' + failedCount);36 testcafe.close();37 });38var testCafe = require('testcafe');39testCafe.createTestCafe('localhost', 1337, 1338)40 .then(function (tc) {41 testcafe = tc;42 var runner = testcafe.createRunner();43 .src('test.js')44 .browsers(['chrome'])45 .run();46 })47 .then(function (failedCount) {48 console.log('Tests failed: ' + failedCount);49 testcafe.close();50 });51var testCafe = require('testcafe');52testCafe.createTestCafe('localhost', 1337, 1338)53 .then(function (tc) {54 testcafe = tc;
Using AI Code Generation
1const Testcafe = require('testcafe');2const testcafe = new Testcafe('localhost', 1337, 1338);3 .createRunner()4 .src('test.js')5 .browsers('chrome')6 .run()7 .then(failedCount => {8 console.log('Tests failed: ' + failedCount);9 testcafe.close();10 });11 .createBrowserConnection()12 .then(connection => {13 console.log(connection.url);14 });15 .createLiveModeRunner()16 .src('test.js')17 .browsers('chrome')18 .run()19 .then(() => {20 testcafe.close();21 });22testcafe.close();
Using AI Code Generation
1const { TestCafe } = require('testcafe');2const testCafe = await TestCafe.create();3const testcafe = await TestCafe.create();4 .run()5 .then(failedCount => {6 console.log('Tests failed: ' + failedCount);7 testcafe.close();8 });9const { TestCafe } = require('testcafe');10const testCafe = await TestCafe.create();11const testcafe = await TestCafe.create();12 .run({13 })14 .then(failedCount => {15 console.log('Tests failed: ' + failedCount);16 testcafe.close();17 });18const { TestCafe } = require('testcafe');19const testCafe = await TestCafe.create();20const testcafe = await TestCafe.create();21 .run({22 })23 .then(failedCount => {24 console.log('Tests failed: ' + failedCount);25 testcafe.close();26 });
Using AI Code Generation
1import { Selector } from 'testcafe';2import { init } from 'testcafe-browser-provider-electron';3 .before(async t => {4 await init();5 });6test('My first test', async t => {7 .click(Selector('button').withText('Click me!'))8 .expect(Selector('p').innerText).eql('Thank you, John Doe!');9});10{11 "scripts": {12 },13 "devDependencies": {14 }15}16const {ipcRenderer} = require('electron');17const button = document.querySelector('button');18const input = document.querySelector('input');19const output = document.querySelector('p');20button.addEventListener('click', () => {21 ipcRenderer.send('greet', input.value);22});23ipcRenderer.on('greet-reply', (event, arg) => {24 output.textContent = `Thank you, ${arg}!`;25});26const {app
Using AI Code Generation
1const TestcafeTest = require('./testcafe-test.js');2const test = new TestcafeTest();3test.init();4test.test('My first test', async t => {5 .typeText('#developer-name', 'John Smith')6 .click('#submit-button')7 .wait(1000);8});9test.run();10const createTestCafe = require('testcafe');11let testcafe = null;12class TestcafeTest {13 constructor() {14 this.fixture = null;15 this.test = null;16 }17 async init() {18 testcafe = await createTestCafe('localhost', 1337, 1338);19 this.fixture = testcafe.createFixture('My fixture');20 }21 async run() {22 await testcafe.close();23 }24}25module.exports = TestcafeTest;26The TestcafeTest class is defined in testcafe-test.js and the test is written in test.js. The test.js file imports the TestcafeTest class and creates an instance of it. It then calls
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!!