How to use parentClass method in Puppeteer

Best JavaScript code snippet using puppeteer

scheduling.js

Source:scheduling.js Github

copy

Full Screen

1$(document).ready(function () {2 if($('#currentRunningTaskStatus').val())3 {4 setHeaderDelayMessage( $('#currentRunningTaskStatus').val() );5 }6 if ($('#isRunning').val() == 'true') 7 {8 $('.scheduling').attr('disabled', 'disabled');9 $('.scheduling input').attr('disabled', 'disabled');10 $('.scheduling select').attr('disabled', 'disabled');11 }12 else13 {14 $('.scheduling').removeAttr('disabled');15 $('.scheduling input').removeAttr('disabled');16 $('.scheduling select').removeAttr('disabled');17 }18 if ($('#dataMartStrategy').val() == 'disabled')19 {20 $('.dataMart').attr('disabled', 'disabled');21 }22 var displayOptionsFor = 23 {24 daily: function (parentClass)25 {26 updateSyncHeader("Daily", parentClass);27 $(parentClass+' .timePickerContainer').show();28 },29 weekly: function (parentClass)30 {31 updateSyncHeader("Weekly", parentClass);32 $(parentClass+' .weekPickerContainer').show();33 $(parentClass+' #weekPicker').show();34 $(parentClass+' .timePickerContainer').show();35 },36 monthly: function (parentClass)37 {38 updateSyncHeader("Monthly", parentClass);39 $(parentClass+' .weekPickerContainer').show();40 $(parentClass+' #weekPeriod').show();41 $(parentClass+' #weekPicker').show();42 $(parentClass+' .timePickerContainer').show();43 },44 yearly: function (parentClass)45 {46 updateSyncHeader("Yearly", parentClass);47 $(parentClass+' .yearPickerContainer').show();48 $(parentClass+' .timePickerContainer').show();49 },50 minute: function (parentClass)51 {52 updateSyncHeader("", parentClass);53 },54 hourly: function (parentClass)55 {56 updateSyncHeader("", parentClass);57 }58 };59 var updateSyncHeader = function (header, parentClass)60 {61 $(parentClass+' #addSchedulerLabel').html(header);62 };63 var defaultScheduler = function () 64 {65 if($("#metadataSyncStrategy").val() == "enabled")66 {67 $(".metadataSyncScheduler").show();68 setScheduler($("#metadataSyncCron").val(),'.metadataSyncScheduler');69 }70 else71 {72 $(".metadataSyncScheduler").hide();73 }74 if($("#dataSynchStrategy").val() == "enabled")75 {76 $(".dataSyncScheduler").show();77 setScheduler($("#dataSyncCron").val(),'.dataSyncScheduler');78 }79 else80 {81 $(".dataSyncScheduler").hide();82 }83 };84 var getSchedules = function (cronExpression)85 {86 var cronSchedules = {};87 var cronExpressionSignature = ["seconds", "minutes", "hours", "day", "month", "week"];88 cronExpression.split(" ").forEach(function (cronValue, index)89 {90 if (cronValue.indexOf("-") >= 0) 91 {92 cronSchedules.weekPeriod = cronValue;93 } 94 else 95 {96 cronSchedules[cronExpressionSignature[index]] = cronValue;97 }98 });99 return cronSchedules;100 };101 var setScheduler = function (cronExpression, parentClass)102 {103 var schedules = getSchedules(cronExpression);104 var setTime = function () {105 var time = getHour(parseInt(schedules.hours)) + ":" + getMinutes(parseInt(schedules.minutes));106 $(parentClass+' #timePicker').val(time);107 };108 var setter = 109 {110 minute: function ()111 {112 if (schedules.day == "*" && schedules.minutes == "0/1" && (schedules.day == schedules.month) && schedules.week == "?")113 {114 $(parentClass + ' #minute').attr("checked", true);115 return true;116 }117 },118 hourly: function ()119 {120 if (schedules.day == "*" && schedules.hours == "*" && schedules.minutes == "0" && schedules.seconds == "0" && (schedules.day == schedules.month) && schedules.week == "?")121 {122 $(parentClass + ' #hourly').attr("checked", true);123 return true;124 }125 },126 daily: function () {127 if (schedules.day == "*" && (schedules.day == schedules.month) && schedules.week == "?")128 {129 $(parentClass+' #daily').attr("checked", true);130 displayOptionsFor["daily"](parentClass);131 setTime();132 return true;133 }134 },135 weekly: function () 136 {137 if (schedules.day == "*" && (schedules.day == schedules.month)) 138 {139 $(parentClass+' #weekly').attr("checked", true);140 displayOptionsFor["weekly"](parentClass);141 $(parentClass+' #weekPicker').val(schedules.week);142 setTime();143 return true;144 }145 },146 monthly: function () 147 {148 if (schedules.month == "*" && schedules.weekPeriod) {149 $(parentClass+" #monthly").attr("checked", true);150 displayOptionsFor["monthly"](parentClass);151 $(parentClass+' #weekPicker').val(schedules.week);152 $(parentClass+" #weekPeriodNumber").val(schedules.weekPeriod);153 setTime();154 return true;155 }156 },157 yearly: function ()158 {159 if (schedules.week == "?") {160 $(parentClass+' #yearly').attr("checked", true);161 displayOptionsFor["yearly"](parentClass);162 $(parentClass+' #monthPicker').val(schedules.month);163 $(parentClass+' #dayPicker').val(schedules.day);164 setTime();165 return true;166 }167 }168 };169 var methods = Object.keys(setter);170 for (var count = 0; count < methods.length; count++) 171 {172 if (setter[methods[count]]() == true)173 {174 return;175 }176 }177 };178 var hideOptions = function (parentClass)179 {180 $(parentClass+' .weekPickerContainer').hide();181 $(parentClass+' #weekPicker').hide();182 $(parentClass+' #weekPeriod').hide();183 $(parentClass+' .yearPickerContainer').hide();184 $(parentClass+' .timePickerContainer').hide();185 $(parentClass+' .syncStartButton').hide();186 generate.month("monthPicker", parentClass);187 generate.days("dayPicker", 1, parentClass);188 generate.time("timePicker", parentClass);189 };190 hideOptions('.metadataSyncScheduler');191 hideOptions('.dataSyncScheduler');192 defaultScheduler();193 $(".monthPicker").unbind("change").change(function (e)194 {195 e.stopPropagation();196 var monthIndex = $(this).val();197 var parent = '.' + $(this).parent().parent().parent().attr('id');198 generate.days("dayPicker", monthIndex, parent);199 });200 $(".radio").unbind("change").change(function (e)201 {202 e.stopPropagation();203 var schedulerOption = $(this).val();204 var parent = '.' + $(this).parent().parent().parent().attr('id');205 hideOptions(parent);206 displayOptionsFor[schedulerOption](parent);207 });208 $("#metadataSyncStrategy").unbind("change").change(function (e)209 {210 defaultScheduler();211 });212 $("#dataSynchStrategy").unbind("change").change(function (e)213 {214 defaultScheduler();215 });216 $("#submitSyncNow").unbind("click").click(function (e)217 {218 e.stopPropagation();219 $("#metadataSyncNowForm").submit();220 });221});222var getCronExpression = function (parentClass)223{224 var week = $(parentClass+" #weekPicker").val();225 var time = $(parentClass+" #timePicker").val().split(":");226 var period = $(parentClass+" #weekPeriodNumber").val();227 var month = $(parentClass+" #monthPicker").val();228 var day = $(parentClass+" #dayPicker").val();229 var selection = $('input[class=radio]:checked', parentClass+" .radioButtonGroup").val();230 if(!selection) return false;231 var hours = parseInt(time[0]);232 var minutes = parseInt(time[1]);233 var SECONDS = "0";234 var compile = 235 {236 daily: function (month, day, week, period, hours, minutes)237 {238 return SECONDS.concat(" ",minutes," ",hours, " *", " * " ,"?");239 },240 monthly: function (month, day, week, period, hours, minutes)241 {242 return SECONDS.concat(" ",minutes, " ", hours," ",period," * ",week);243 },244 yearly: function (month, day, week, period, hours, minutes)245 {246 return SECONDS.concat(" ",minutes," ",hours," ",day," ",month," ?");247 },248 weekly: function (month, day, week, period, hours, minutes)249 {250 return SECONDS.concat(" ",minutes," ",hours," *"," *"," ",week);251 },252 minute: function (month, day, week, period, hours, minutes)253 {254 return '0 0/1 * * * ?';255 },256 hourly: function (month, day, week, period, hours, minutes)257 {258 return '0 0 * * * ?';259 }260 };261 return compile[selection](month, day, week, period, hours, minutes);262};263function setScheduledCron(scheduler, cron)264{265 var syncCron = getCronExpression('.' + scheduler);266 if(syncCron)267 {268 $('#' + cron).val(syncCron);269 $('.scheduling').removeAttr('disabled');270 $('#schedulingForm').submit();271 }272 else273 {274 setHeaderDelayMessage(sync_scheduler_alert);275 }276}277function submitSchedulingForm()278{279 var metadataSyncStrategy = $("#metadataSyncStrategy").val();280 var dataSyncStrategy = $("#dataSynchStrategy").val();281 if(metadataSyncStrategy == "enabled" && dataSyncStrategy == "enabled")282 {283 var metadataSyncCron = getCronExpression('.metadataSyncScheduler');284 var dataSyncCron = getCronExpression('.dataSyncScheduler');285 if(metadataSyncCron && dataSyncCron)286 {287 $('#metadataSyncCron').val(metadataSyncCron);288 $('#dataSyncCron').val(dataSyncCron);289 $('.scheduling').removeAttr('disabled');290 $('#schedulingForm').submit();291 }292 else293 {294 setHeaderDelayMessage(sync_scheduler_alert);295 }296 }297 else if(metadataSyncStrategy == "enabled")298 {299 setScheduledCron('metadataSyncScheduler', 'metadataSyncCron');300 }301 else if(dataSyncStrategy == "enabled")302 {303 setScheduledCron('dataSyncScheduler', 'dataSyncCron');304 }305 else306 {307 $('.scheduling').removeAttr('disabled');308 $('#schedulingForm').submit();309 }310}311function toggleMoreOptions()312{313 $("#moreOptionsLink").toggle();314 $("#moreOptionsDiv").toggle();315}316function toggleDataMart() 317{318 319 if ($('#dataMartStrategy').val() == 'never')320 {321 $('.dataMart').attr('disabled', 'disabled');322 }323 else324 {325 $('.dataMart').removeAttr('disabled');326 }...

Full Screen

Full Screen

classInheritanceTest.js

Source:classInheritanceTest.js Github

copy

Full Screen

1import createTestHelpers from '../createTestHelpers';2const {expectTransform, expectNoChange} = createTestHelpers(['class']);3describe('Class Inheritance', () => {4 describe('node.js util.inherits', () => {5 it('determines a function is a class when util.inherits() is used', () => {6 expectTransform(7 'var util2 = require("util");\n' +8 'function MyClass() {\n' +9 '}\n' +10 'util2.inherits(MyClass, ParentClass);'11 ).toReturn(12 'var util2 = require("util");\n' +13 'class MyClass extends ParentClass {}'14 );15 });16 it('tracks assignment of require("util").inherits', () => {17 expectTransform(18 'var inherits2 = require("util").inherits;\n' +19 'function MyClass() {\n' +20 '}\n' +21 'inherits2(MyClass, ParentClass);'22 ).toReturn(23 'var inherits2 = require("util").inherits;\n' +24 'class MyClass extends ParentClass {}'25 );26 });27 it('supports import from "util"', () => {28 expectTransform(29 'import util from "util";\n' +30 'function MyClass() {\n' +31 '}\n' +32 'util.inherits(MyClass, ParentClass);'33 ).toReturn(34 'import util from "util";\n' +35 'class MyClass extends ParentClass {}'36 );37 });38 it('ignores import of anything else than "util"', () => {39 expectNoChange(40 'import util from "./util";\n' +41 'function MyClass() {\n' +42 '}\n' +43 'util.inherits(MyClass, ParentClass);'44 );45 });46 it('ignores named imports from "util"', () => {47 expectNoChange(48 'import {util} from "util";\n' +49 'function MyClass() {\n' +50 '}\n' +51 'util.inherits(MyClass, ParentClass);'52 );53 });54 it('preserves inheritance when the inherited class is a member expression', () => {55 expectTransform(56 'var util = require("util");\n' +57 'function MyClass() {\n' +58 '}\n' +59 'util.inherits(MyClass, Foo.Bar.ParentClass);'60 ).toReturn(61 'var util = require("util");\n' +62 'class MyClass extends Foo.Bar.ParentClass {}'63 );64 });65 it('ignores require("util") which is not top-level', () => {66 expectNoChange(67 'function foo() {\n' +68 ' var util = require("util");\n' +69 '}\n' +70 'function MyClass() {\n' +71 '}\n' +72 'util.inherits(MyClass, Foo.Bar.ParentClass);'73 );74 });75 it('ignores util.inherits() when not from require("util")', () => {76 expectNoChange(77 'var util = require("./util");\n' +78 'function MyClass() {\n' +79 '}\n' +80 'util.inherits(MyClass, ParentClass);'81 );82 expectNoChange(83 'var inherits = require("./util").inherits;\n' +84 'function MyClass() {\n' +85 '}\n' +86 'inherits(MyClass, ParentClass);'87 );88 });89 });90 describe('prototype = new ParentClass()', () => {91 it('determines a function is a class', () => {92 expectTransform(93 'function MyClass() {\n' +94 '}\n' +95 'MyClass.prototype = new ParentClass();'96 ).toReturn(97 'class MyClass extends ParentClass {}'98 );99 });100 it('discards the prototype.constructor assignment', () => {101 expectTransform(102 'function MyClass() {\n' +103 '}\n' +104 'MyClass.prototype = new ParentClass();\n' +105 'MyClass.prototype.constructor = MyClass;'106 ).toReturn(107 'class MyClass extends ParentClass {}'108 );109 });110 it('ignores bogus prototype.constructor assignments', () => {111 expectTransform(112 'function MyClass() {\n' +113 '}\n' +114 'MyClass.prototype = new ParentClass();\n' +115 'ParentClass.prototype.constructor = MyClass;\n' +116 'MyClass.prototype.constructor = ParentClass;'117 ).toReturn(118 'class MyClass extends ParentClass {}\n' +119 'ParentClass.prototype.constructor = MyClass;\n' +120 'MyClass.prototype.constructor = ParentClass;'121 );122 });123 it('does not detect inheritance from prototype.constructor assignment alone', () => {124 expectNoChange(125 'function MyClass() {\n' +126 '}\n' +127 'MyClass.prototype.constructor = MyClass;'128 );129 });130 });131 describe('prototype = Object.create(ParentClass.prototype)', () => {132 it('determines a function is a class', () => {133 expectTransform(134 'function MyClass() {\n' +135 '}\n' +136 'MyClass.prototype = Object.create(ParentClass.prototype);'137 ).toReturn(138 'class MyClass extends ParentClass {}'139 );140 });141 it('discards the prototype.constructor assignment', () => {142 expectTransform(143 'function MyClass() {\n' +144 '}\n' +145 'MyClass.prototype = Object.create(ParentClass.prototype);\n' +146 'MyClass.prototype.constructor = MyClass;'147 ).toReturn(148 'class MyClass extends ParentClass {}'149 );150 });151 });152 describe('super() calls in constructor', () => {153 it('converts ParentClass.call(this, args...) to super()', () => {154 expectTransform(155 'function MyClass(name) {\n' +156 ' ParentClass.call(this, name);\n' +157 ' this.name = name;\n' +158 '}\n' +159 'MyClass.prototype = new ParentClass();'160 ).toReturn(161 'class MyClass extends ParentClass {\n' +162 ' constructor(name) {\n' +163 ' super(name);\n' +164 ' this.name = name;\n' +165 ' }\n' +166 '}'167 );168 });169 it('does not convert ParentClass.call(args...) without this to super() ', () => {170 expectTransform(171 'function MyClass(name) {\n' +172 ' ParentClass.call(null, name);\n' +173 ' this.name = name;\n' +174 '}\n' +175 'MyClass.prototype = new ParentClass();'176 ).toReturn(177 'class MyClass extends ParentClass {\n' +178 ' constructor(name) {\n' +179 ' ParentClass.call(null, name);\n' +180 ' this.name = name;\n' +181 ' }\n' +182 '}'183 );184 });185 it('converts nested ParentClass.call(this, args...) in constructor to super()', () => {186 expectTransform(187 'function MyClass(name) {\n' +188 ' if (true)\n' +189 ' ParentClass.call(this);\n' +190 '}\n' +191 'MyClass.prototype = new ParentClass();'192 ).toReturn(193 'class MyClass extends ParentClass {\n' +194 ' constructor(name) {\n' +195 ' if (true)\n' +196 ' super();\n' +197 ' }\n' +198 '}'199 );200 });201 });202 describe('super.foo() calls in methods', () => {203 it('converts ParentClass.prototype.foo.call(this, args...) to super.foo()', () => {204 expectTransform(205 'function MyClass(name) {\n' +206 '}\n' +207 'MyClass.prototype = new ParentClass();\n' +208 'MyClass.prototype.foo = function(a, b, c) {\n' +209 ' ParentClass.prototype.foo.call(this, a, b, c);\n' +210 ' this.doSomethingElse();\n' +211 '};'212 ).toReturn(213 'class MyClass extends ParentClass {\n' +214 ' foo(a, b, c) {\n' +215 ' super.foo(a, b, c);\n' +216 ' this.doSomethingElse();\n' +217 ' }\n' +218 '}'219 );220 });221 it('converts nested ParentClass.prototype.foo.call(this, args...) to super.foo()', () => {222 expectTransform(223 'function MyClass(name) {\n' +224 '}\n' +225 'MyClass.prototype = new ParentClass();\n' +226 'MyClass.prototype.bar = function() {\n' +227 ' if (someCondition)\n' +228 ' ParentClass.prototype.foo.call(this);\n' +229 '};'230 ).toReturn(231 'class MyClass extends ParentClass {\n' +232 ' bar() {\n' +233 ' if (someCondition)\n' +234 ' super.foo();\n' +235 ' }\n' +236 '}'237 );238 });239 it('does not convert SomeOtherClass.prototype.foo.call(this, args...) to super.foo()', () => {240 expectTransform(241 'function MyClass(name) {\n' +242 '}\n' +243 'MyClass.prototype = new ParentClass();\n' +244 'MyClass.prototype.foo = function() {\n' +245 ' SomeOtherClass.prototype.foo.call(this);\n' +246 '};'247 ).toReturn(248 'class MyClass extends ParentClass {\n' +249 ' foo() {\n' +250 ' SomeOtherClass.prototype.foo.call(this);\n' +251 ' }\n' +252 '}'253 );254 });255 });...

Full Screen

Full Screen

js.js

Source:js.js Github

copy

Full Screen

1let firtName = document.querySelector('#firtName')2let firstNameHelp = document.querySelector('#firstNameHelp')3let LastName = document.querySelector('#LastName')4let LastNameHelp = document.querySelector('#LastNameHelp')5let exampleInputEmail1 = document.querySelector('#exampleInputEmail1')6let emailHelp = document.querySelector('#emailHelp')7let exampleInputPassword1 = document.querySelector('#exampleInputPassword1')8let passwordHelp = document.querySelector('#passwordHelp')9let address = document.querySelector('#address')10let prew = document.querySelector('#prew')11let next = document.querySelector('#next')12let parentClass = document.querySelectorAll('.mb-3')13let stepper = document.querySelectorAll('.stepper')14let otm = document.querySelector('#otm')15let step = 1;16// oneStep = document.querySelector('#oneStep')17// oneStep.addEventListener('click', (e)=>{18// e.preventDefault()19// })20prew.setAttribute('hidden', true)21stepper[0].className = 'stepper active'22next.addEventListener('click', (e)=>{23 e.preventDefault()24 nextStep()25})26prew.addEventListener('click', (e)=>{27 e.preventDefault()28 prevStep(step)29})30function prevStep(st){31 switch(st){32 case 1:{33 parentClass[0].removeAttribute('hidden')34 parentClass[1].removeAttribute('hidden')35 parentClass[2].setAttribute('hidden', true)36 parentClass[3].setAttribute('hidden', true)37 parentClass[3].setAttribute('hidden', true)38 parentClass[4].setAttribute('hidden', true)39 stepper[0].className = 'stepper active'40 stepper[1].className = 'stepper'41 stepper[2].className = 'stepper'42 // alert('ss')43 step=144 break;45 }46 case 2:{47 parentClass[0].removeAttribute('hidden')48 parentClass[1].removeAttribute('hidden')49 parentClass[2].setAttribute('hidden', true)50 parentClass[3].setAttribute('hidden', true)51 parentClass[3].setAttribute('hidden', true)52 parentClass[4].setAttribute('hidden', true)53 next.innerHTML = 'Oldinga'54 prew.setAttribute('disabled', true)55 stepper[0].className = 'stepper active'56 stepper[1].className = 'stepper'57 stepper[2].className = 'stepper'58 step=159 break;60 61 }62 case 3:{63 parentClass[0].setAttribute('hidden', true)64 parentClass[1].setAttribute('hidden', true)65 parentClass[2].removeAttribute('hidden')66 parentClass[3].removeAttribute('hidden')67 parentClass[4].setAttribute('hidden', true)68 parentClass[5].setAttribute('hidden', true)69 next.innerHTML = 'Oldinga'70 step=271 stepper[0].className = 'stepper'72 stepper[1].className = 'stepper active'73 stepper[2].className = 'stepper'74 break;75 76 }77 78 }79}80function nextStep(){81 switch(step){82 case 1:{83 parentClass[0].setAttribute('hidden', true)84 parentClass[1].setAttribute('hidden', true)85 parentClass[2].removeAttribute('hidden')86 parentClass[3].removeAttribute('hidden')87 parentClass[2].removeAttribute('hidden')88 parentClass[3].removeAttribute('hidden' )89 stepper.className = 'stepper active'90 prew.removeAttribute('hidden')91 prew.removeAttribute('disabled')92 stepper[0].className = 'stepper'93 stepper[1].className = 'stepper active'94 stepper[2].className = 'stepper'95 step=296 stepper[1].style = ".stepper-wrap .stepper:after{background-color: rgb(190, 203, 211);border-color: rgb(152, 174, 187);}"97 break;98 }99 case 2:{100 parentClass[0].setAttribute('hidden', true)101 parentClass[1].setAttribute('hidden', true)102 parentClass[2].setAttribute('hidden', true)103 parentClass[3].setAttribute('hidden', true)104 parentClass[4].removeAttribute('hidden')105 parentClass[5].removeAttribute('hidden')106 prew.removeAttribute('disabled')107 stepper[0].className = 'stepper'108 stepper[1].className = 'stepper'109 stepper[2].className = 'stepper active'110 next.innerHTML = 'Saqlash'111 112 step=3113 break;114 115 }116 case 3:{117 parentClass[0].setAttribute('hidden', true)118 parentClass[1].setAttribute('hidden', true)119 parentClass[2].setAttribute('hidden', true)120 parentClass[3].setAttribute('hidden', true)121 parentClass[4].setAttribute('hidden', true)122 parentClass[5].setAttribute('hidden', true)123 next.setAttribute('hidden', true)124 prew.setAttribute('hidden', true)125 next.innerHTML = 'Saqlash'126 prew.removeAttribute('disabled')127 document.querySelector('form').innerHTML = `128 <h4>${firtName.value}<h4><br>129 <h4>${LastName.value}<h4><br>130 <h4>${exampleInputEmail1.value}<h4><br>131 <h4>${exampleInputPassword1.value}<h4><br>132 <h4>${address.value}<h4><br>133 <h4>${otm.value}<h4><br>134 `;135 break;136 137 }138 }...

Full Screen

Full Screen

gopaginate.js

Source:gopaginate.js Github

copy

Full Screen

1var $offsets = [],2 $currperpages = [],3 $totalpages = [];4function pagination($obj,$displayperpage,$parentclass){5 try {6 // init7 var $curr_page = null;8 var $next = null;9 $offsets[$parentclass] = 0;10 var $currPage = 0;11 $("."+$parentclass+" > span.pager-paginater > input").empty().val("1");12 // display per page13 $perpage = $displayperpage;14 if(isNaN($perpage)){15 $perpage = $($obj).children().size();16 }17 18 // total page19 $total_page = Math.ceil($($obj).children().size() / $perpage);20 $("."+$parentclass+" > span.pager-paginater > span").empty().append($total_page);21 // hide pagination if $obj children is less than $displayperpage22 if(($($obj).children().size()) < ($perpage*1)){23 if($($obj).children().size() !== $perpage ){24 $("."+$parentclass+" > span").hide();25 }26 } else {27 $("."+$parentclass+" > span").show();28 }29 $currperpages[$parentclass] = $perpage;30 $totalpages[$parentclass] = $total_page;31 $offsets[$parentclass] = 0;32 33 // set display perpage34 console.log($offsets[$parentclass]);35 display($obj,$offsets[$parentclass],$perpage);36 } catch(err) {37 console.log(err);38 }39}40function firstpager($obj,$parentclass){41 if($currperpages[$parentclass] !== "all"){42 $($("."+$parentclass+" > span.pager-paginater > input")).val("1");43 $currEnd = parseInt($currperpages[$parentclass]) * 1;44 $currperpages[$parentclass] = $currEnd;45 $offsets[$parentclass] = 0;46 display($obj,$offsets[$parentclass],$currEnd);47 } 48}49function nextpager($obj,$next,$parentclass){50 if($currperpages[$parentclass] !== "all"){51 if($next <= $totalpages[$parentclass]){52 $($("."+$parentclass+" > span.pager-paginater > input")).val($next);53 $currEnd = $currperpages[$parentclass] * $next;54 $offsets[$parentclass] = parseInt($currperpages[$parentclass]) + parseInt($offsets[$parentclass]); 55 display($obj,$offsets[$parentclass],$currEnd);56 }57 }58}59function backpager($obj,$next,$parentclass){60 if($currperpages[$parentclass] !== "all"){61 if($next >= 1){62 $($("."+$parentclass+" > span.pager-paginater > input")).val($next);63 $currEnd = $currEnd - $currperpages[$parentclass];64 $offsets[$parentclass] = parseInt($offsets[$parentclass]) - parseInt($currperpages[$parentclass]); 65 display($obj,$offsets[$parentclass],$currEnd); 66 }67 }68}69function lastpager($obj,$lastpage,$parentclass){70 if($perpage !== "all"){71 $($(".pager-paginater > input")).val($lastpage);72 $currEnd = $currperpages[$parentclass] * $lastpage;73 $last = parseInt($($obj).children().size()) % $currperpages[$parentclass];74 if($last !== 0){75 $offsets[$parentclass] = $($obj).children().size() - $last;76 }else{77 $offsets[$parentclass] = $currEnd - $currperpages[$parentclass];78 }79 display($obj,$offsets[$parentclass],$currEnd);80 } 81}82function totalperpage($divContent,$divIndex,$parentclass,$page){83 var $totals = [],$currEnd=25,timeformat='',hour=0,min=0,sec=0,time=[],$seconds=0,$subtotals=0;84 85 try{86 if($("."+$divContent).children().size() !== 0){87 if($offsets[$parentclass] === undefined){88 $offsets[$parentclass] = 0;89 }90 if($currperpages[$parentclass] !== undefined){91 $currEnd = $currperpages[$parentclass] * $page; 92 }93 $currEnd -= 1;94 $("."+$divContent).children().each(function(indx){95 if(indx >= $offsets[$parentclass] && indx <= $currEnd){96 if($divIndex instanceof Array){97 $div = this;98 $.each($divIndex,function(indx,val){99 time = $($($div).children()[val]).text().split(":");100 $seconds = parseInt(time[0]*3600) + parseInt(time[1]*60) + parseInt(time[2]*1);101 if($totals[val] === undefined){102 $totals[val] = 0;103 }104 $totals[val] = parseInt($totals[val]) + parseInt($seconds);105 });106 }else{107 alert("Please use arrray variables");108 }109 }110 });111 $.each($totals,function(indx,val){112 if(val !== undefined){113 hour = parseInt(val / 3600) % 24;114 min = parseInt(val / 60) % 60;115 sec = parseInt(val) % 60;116 $($("."+$parentclass+" > div.totaltime > div")[indx]).empty().append(((hour>9)? hour :'0'+hour)+':'+((min>9)? min :'0'+min)+":"+((sec>9)? sec :'0'+sec));117 //$("."+$parentclass+" > div.totaltime > div."+$divTototal).empty().append(); */118 }119 });120 }121 } catch(e){122 console.log(e);123 }...

Full Screen

Full Screen

baseSpec.js

Source:baseSpec.js Github

copy

Full Screen

1'use strict';23var netric = require("../../src/base");45/**6 * Check to make sure expected public varibles are set7 */8describe("Public Variables:", function() {9 it("Has a local version variable", function() {10 expect(netric.version.length).toBeGreaterThan(0);11 });12});1314/**15 * Test netric namespaced public functions16 */17describe("Public Base Functions:", function() {18 /*19 * Base URI is used to dynamically construct links20 */21 it("Can get the local base URI", function() {22 var baseUri = netric.getBaseUri();23 expect(baseUri.length).toBeGreaterThan(0);24 });2526 /**27 * Check to make sure that getApplication calls made28 * without first setting the application will result in29 * an error exception.30 */31 it ("Should throw an exception if getApplication is called early", function() {32 var error = "An instance of netric.Application has not yet been loaded.";33 expect( function(){ netric.getApplication(); } ).toThrow(new Error(error));34 });3536});3738/**39 * Test inherits functionality40 */41describe("Class inheritance:", function() {4243 it("Can extend a base class functions", function() {44 function ParentClass(somevar) { this.someVar_ = somevar; }45 ParentClass.prototype.getvar = function() { return this.someVar_; }4647 function ChildClass(somevar) { ParentClass.call(this, somevar); }48 netric.inherits(ChildClass, ParentClass);4950 var child = new ChildClass("test");51 expect(child.getvar()).toEqual("test");52 });5354 it("Can override base class functions", function() {55 56 function ParentClass(somevar) { this.someVar_ = somevar; }57 ParentClass.prototype.getvar = function() { return this.someVar_; }5859 function ChildClass(somevar) { ParentClass.call(this, somevar); }60 netric.inherits(ChildClass, ParentClass);6162 // Override63 ChildClass.prototype.getvar = function() { return "child"; }6465 var child = new ChildClass("test");66 expect(child.getvar()).toEqual("child");6768 });6970 it("Can call base functions from child functions", function() {71 function ParentClass(somevar) { this.someVar_ = somevar; }72 ParentClass.prototype.getvar = function() { return this.someVar_; }7374 function ChildClass(somevar) { ParentClass.call(this, somevar); }75 netric.inherits(ChildClass, ParentClass);7677 // Override78 ChildClass.prototype.getvar2 = function() { return this.getvar(); }7980 var child = new ChildClass("test");81 expect(child.getvar2()).toEqual("test");82 });8384 it("Can access base variables from child functions", function() {85 function ParentClass(somevar) { this.someVar_ = somevar; }8687 function ChildClass(somevar) { ParentClass.call(this, somevar); }88 netric.inherits(ChildClass, ParentClass);89 ChildClass.prototype.getvar = function() { return this.someVar_; }9091 var child = new ChildClass("test");92 expect(child.getvar()).toEqual("test");93 });9495});9697/**98 * Test inherits functionality99 */100describe("Namespace declare:", function() {101102 // This is no longer in use103 it("Can create new namespaces before they exist", function() {104 netric.declare("my.test.namespace");105 expect(typeof my.test.namespace).toEqual("object");106 });107108 it("Should not override existing functions", function() {109 var testns = {};110 testns.testClass = function() {}111 netric.declare("testns.testClass");112 expect(typeof testns.testClass).toEqual("function");113 });114 115}); ...

Full Screen

Full Screen

Sswitch.js

Source:Sswitch.js Github

copy

Full Screen

1/*2* Author: Gopal Joshi3* Website: www.sgeek.org4*/5(function($) {6 $.fn.Sswitch = function(element, options ) {7 this.$element = $(this);8 9 this.options = $.extend({}, $.fn.Sswitch.defaults, {10 state: this.$element.is(":checked"),11 disabled: this.$element.is(":disabled"),12 readonly: this.$element.is("[readonly]"),13 parentClass: this.$element.data("parent"),14 onSwitchChange: element.onSwitchChange15 },options);16 this.$container = $("<div>", {17 "class": (function(_this){18 return function(){19 var classes;20 classes = [_this.options.parentClass];21 classes.push(_this.options.state ? "" + _this.options.parentClass + "-on" : "" + _this.options.parentClass + "-off");22 if (_this.options.disabled) {23 classes.push("" + _this.options.parentClass + "-disabled");24 }25 if (_this.options.readonly) {26 classes.push("" + _this.options.parentClass + "-readonly");27 }28 if (_this.$element.attr("id")) {29 classes.push("" + _this.options.parentClass + "-id-" + (_this.$element.attr("id")));30 }31 return classes.join(" ");32 };33 })(this)()34 });35 this.$label = $("<span>", {36 html: this.options.labelText,37 "class": "" + this.options.parentClass + "-label"38 });39 this.$container = this.$element.wrap(this.$container).parent();40 this.$element.before(this.$label);41 42 return this.$container.on("click", (function(_this) {43 return function(event) {44 event.preventDefault();45 event.stopPropagation();46 if (_this.options.readonly || _this.options.disabled) {47 return _this.target;48 }49 _this.options.state = !_this.options.state;50 _this.$element.prop("checked", _this.options.state);51 _this.$container.addClass(_this.options.state ? "" + _this.options.parentClass + "-on" : "" + _this.options.parentClass + "-off").removeClass(_this.options.state ? "" + _this.options.parentClass + "-off" : "" + _this.options.parentClass + "-on");52 _this.options.onSwitchChange.call(_this);53 return _this;54 };55 })(this));56 return this.$element;57 },58 $.fn.Sswitch.defaults = {59 text : 'Default Title',60 fontsize : 10,61 state: true,62 disabled: false,63 readonly: false,64 parentClass: "s-switch",65 onSwitchChange: function() {}66 };...

Full Screen

Full Screen

inheritance_tests.js

Source:inheritance_tests.js Github

copy

Full Screen

...3/** History40.1.0: creation of this test file50.2.0: rename test classes6*/7function parentClass(size) {8 //define some member variables9 this.size = size;10 this.value1 = "value1 from parent";11 this.value2 = "value2 from parent";12 this.constant1 = 1;13 this.constant2 = 1;14}15//static16parentClass.StaticConstant = 1;17//static18parentClass.staticFunction1 = function(s) {19 return "" + s + " from parentClass.staticFunction1";20};21parentClass.prototype.getSize = function() {22 return this.size;23};24parentClass.prototype.getValue1 = function() {25 return this.value1;26};27parentClass.prototype.getValue2 = function() {28 return this.value2;29};30parentClass.prototype.doSomething = function() {31 return this.size*this.size;32};33//childClass may be defined in another file than parentClass, but parentClass must be loaded first34function childClass(size, name) {35 this._base_childClass.call(this, size);//call parent constructor36 //new child member variables37 this.name = name;38 //redefine some parent variables39 this.value2 = "value2 from child";40 this.constant2 = 2;41}42extendClass(childClass, parentClass);//define inheritance43childClass.prototype.doSomething = function() {44 var parentResult = this._base_childClass.prototype.doSomething.call(this);//call parent function45 return parentResult + parentClass.StaticConstant + this.constant1 + this.constant2;46};47test("Inheritance: constructor should be able to call parent class", function(){48var expected_result = 10;49var parent = new parentClass(10);50var child = new childClass(10, "child");51ok(parent.size == expected_result);52ok(child.size == expected_result);53});54test("Inheritance: child class should be able to use parent member variables and can overwrite them", function(){55var parent = new parentClass(10);56var child = new childClass(10, "child");57ok(parent.getValue1() == "value1 from parent");58ok(child.getValue1() == "value1 from parent");59ok(parent.getValue2() == "value2 from parent");60ok(child.getValue2() == "value2 from child");61});62test("Inheritance: child class should be able to call parent functions", function(){63var parent = new parentClass(10);64var child = new childClass(10, "child");65ok(parent.doSomething() == 100);66ok(child.doSomething() == 104);...

Full Screen

Full Screen

not.js

Source:not.js Github

copy

Full Screen

1const {expect, file} = require( '../../testFramework');2file('typing/not');3expect([1], `4 let b: ~Str = 1;5`);6expect('TypeError', `7 let b: ~Str = 'hi';8`);9expect([''], `10 let b: ~~Str = '';11`);12expect('TypeError', `13 let b: ~~Str = 1;14`);15expect(['parentClass', 'childClass1', 'childClass2', {}], `16 let parentClass = class {};17 let childClass1 = class extends parentClass {};18 let childClass2 = class extends parentClass {};19 let a: parentClass = childClass1();20`);21expect('TypeError', `22 let parentClass = class {};23 let childClass1 = class extends parentClass {};24 let childClass2 = class extends parentClass {};25 let a: ~parentClass = childClass1();26`);27expect('TypeError', `28 let parentClass = class {};29 let childClass1 = class extends parentClass {};30 let childClass2 = class extends parentClass {};31 let a: parentClass & ~childClass2 = childClass2();32`);33expect(['parentClass', 'childClass1', 'childClass2', {}], `34 let parentClass = class {};35 let childClass1 = class extends parentClass {};36 let childClass2 = class extends parentClass {};37 let a: parentClass & ~childClass2 = childClass1();...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2const parentClass = require('./parentClass');3class test extends parentClass {4 constructor() {5 super();6 }7 async test() {8 const browser = await this.launchBrowser();9 const page = await this.launchPage(browser);10 await page.screenshot({path: 'example.png'});11 await browser.close();12 }13}14const obj = new test();15obj.test();16const puppeteer = require('puppeteer');17class parentClass {18 constructor() {19 }20 async launchBrowser() {21 const browser = await puppeteer.launch({headless: false});22 return browser;23 }24 async launchPage(browser) {25 const page = await browser.newPage();26 return page;27 }28}29module.exports = parentClass;

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2const parentClass = require('./parentClass');3class Test extends parentClass {4 constructor() {5 super();6 }7 async test() {8 await this.launchBrowser();9 await this.launchNewPage();10 await this.closeBrowser();11 }12}13const test = new Test();14test.test();15const puppeteer = require('puppeteer');16class ParentClass {17 constructor() {18 this.browser = null;19 this.page = null;20 }21 async launchBrowser() {22 this.browser = await puppeteer.launch({ headless: false });23 }24 async launchNewPage() {25 this.page = await this.browser.newPage();26 }27 async gotoURL(url) {28 await this.page.goto(url);29 }30 async closeBrowser() {31 await this.browser.close();32 }33}34module.exports = ParentClass;35const puppeteer = require('puppeteer');36class ParentClass {37 constructor() {38 this.browser = null;39 this.page = null;40 }41 async launchBrowser() {42 this.browser = await puppeteer.launch({ headless: false });43 }44 async launchNewPage() {45 this.page = await this.browser.newPage();46 }47 async gotoURL(url) {48 await this.page.goto(url);49 }50 async closeBrowser() {51 await this.browser.close();52 }53}54class Test extends ParentClass {55 constructor() {56 super();57 }58 async test() {59 await this.launchBrowser();60 await this.launchNewPage();61 await this.closeBrowser();62 }63}64const test = new Test();65test.test();66Your name to display (optional):67Your name to display (optional):68The Object.assign() method is used to copy the ...READ MORE69The Object.create() method creates a new object, using ...READ MORE70The Object.defineProperty() method defines a new property ...READ MORE71The Object.defineProperties() method defines new or modifies ...READ MORE72The Object.entries() method returns an array of a given ...READ MORE73The Object.freeze() method freezes an object:

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2const parentClass = require('./parentClass.js');3class test extends parentClass {4 constructor() {5 super();6 }7 async testMethod() {8 await this.browser;9 await this.page;10 }11}12module.exports = test;13const puppeteer = require('puppeteer');14class parentClass {15 constructor() {16 this.browser = puppeteer.launch({17 });18 this.page = this.browser.then((browser) => {19 return browser.newPage();20 });21 }22}23module.exports = parentClass;

Full Screen

Using AI Code Generation

copy

Full Screen

1const parentClass = require('./parentClass.js');2class test extends parentClass {3 constructor() {4 super();5 }6 async test() {7 await this.launchBrowser();8 await this.closeBrowser();9 }10}11const testObj = new test();12testObj.test();13class parentClass {14 constructor() {15 this.browser = null;16 this.page = null;17 }18 async launchBrowser() {19 this.browser = await puppeteer.launch({20 });21 this.page = await this.browser.newPage();22 }23 async gotoPage(url) {24 await this.page.goto(url);25 }26 async closeBrowser() {27 await this.browser.close();28 }29}30module.exports = parentClass;31NullInjectorError: StaticInjectorError(DynamicTestModule)[TestService -> HttpClient]: 32 StaticInjectorError(Platform: core)[TestService -> HttpClient]: 33describe('TestService', () => {34 let service: TestService;35 let httpMock: HttpTestingController;36 beforeEach(() => {37 TestBed.configureTestingModule({38 imports: [HttpClientTestingModule],39 });40 service = TestBed.get(TestService);41 httpMock = TestBed.get(HttpTestingController);42 });43 it('should be created', () => {44 expect(service).toBeTruthy();45 });46 it('should make a request', () => {47 service.makeRequest().subscribe(data => {48 expect(data).toBeTruthy();49 });50 const req = httpMock.expectOne(`${environment.apiUrl}/test`);51 expect(req.request.method).toBe('GET');52 req.flush({ test: true });53 httpMock.verify();54 });55});

Full Screen

Using AI Code Generation

copy

Full Screen

1const parentClass = require('puppeteer');2class ChildClass extends parentClass {3 constructor() {4 super();5 }6 async myMethod() {7 await this.launch();8 }9}10const childClass = new ChildClass();11childClass.myMethod();

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

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

Run Puppeteer automation tests on LambdaTest cloud grid

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

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful