Best JavaScript code snippet using stryker-parent
rangePlugin.js
Source:rangePlugin.js
1(function (global, factory) {2 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :3 typeof define === 'function' && define.amd ? define(factory) :4 (global = global || self, global.rangePlugin = factory());5}(this, function () { 'use strict';6 function rangePlugin(config) {7 if (config === void 0) { config = {}; }8 return function (fp) {9 var dateFormat = "", secondInput, _secondInputFocused, _prevDates;10 var createSecondInput = function () {11 if (config.input) {12 secondInput =13 config.input instanceof Element14 ? config.input15 : window.document.querySelector(config.input);16 if (!secondInput) {17 fp.config.errorHandler(new Error("Invalid input element specified"));18 return;19 }20 if (fp.config.wrap) {21 secondInput = secondInput.querySelector("[data-input]");22 }23 }24 else {25 secondInput = fp._input.cloneNode();26 secondInput.removeAttribute("id");27 secondInput._flatpickr = undefined;28 }29 if (secondInput.value) {30 var parsedDate = fp.parseDate(secondInput.value);31 if (parsedDate)32 fp.selectedDates.push(parsedDate);33 }34 secondInput.setAttribute("data-fp-omit", "");35 fp._bind(secondInput, ["focus", "click"], function () {36 if (fp.selectedDates[1]) {37 fp.latestSelectedDateObj = fp.selectedDates[1];38 fp._setHoursFromDate(fp.selectedDates[1]);39 fp.jumpToDate(fp.selectedDates[1]);40 }41 _secondInputFocused = true;42 fp.isOpen = false;43 fp.open(undefined, config.position === "left" ? fp._input : secondInput);44 });45 fp._bind(fp._input, ["focus", "click"], function (e) {46 e.preventDefault();47 fp.isOpen = false;48 fp.open();49 });50 if (fp.config.allowInput)51 fp._bind(secondInput, "keydown", function (e) {52 if (e.key === "Enter") {53 fp.setDate([fp.selectedDates[0], secondInput.value], true, dateFormat);54 secondInput.click();55 }56 });57 if (!config.input)58 fp._input.parentNode &&59 fp._input.parentNode.insertBefore(secondInput, fp._input.nextSibling);60 };61 var plugin = {62 onParseConfig: function () {63 fp.config.mode = "range";64 dateFormat = fp.config.altInput65 ? fp.config.altFormat66 : fp.config.dateFormat;67 },68 onReady: function () {69 createSecondInput();70 fp.config.ignoredFocusElements.push(secondInput);71 if (fp.config.allowInput) {72 fp._input.removeAttribute("readonly");73 secondInput.removeAttribute("readonly");74 }75 else {76 secondInput.setAttribute("readonly", "readonly");77 }78 fp._bind(fp._input, "focus", function () {79 fp.latestSelectedDateObj = fp.selectedDates[0];80 fp._setHoursFromDate(fp.selectedDates[0]);81 _secondInputFocused = false;82 fp.jumpToDate(fp.selectedDates[0]);83 });84 if (fp.config.allowInput)85 fp._bind(fp._input, "keydown", function (e) {86 if (e.key === "Enter")87 fp.setDate([fp._input.value, fp.selectedDates[1]], true, dateFormat);88 });89 fp.setDate(fp.selectedDates, false);90 plugin.onValueUpdate(fp.selectedDates);91 fp.loadedPlugins.push("range");92 },93 onPreCalendarPosition: function () {94 if (_secondInputFocused) {95 fp._positionElement = secondInput;96 setTimeout(function () {97 fp._positionElement = fp._input;98 }, 0);99 }100 },101 onChange: function () {102 if (!fp.selectedDates.length) {103 setTimeout(function () {104 if (fp.selectedDates.length)105 return;106 secondInput.value = "";107 _prevDates = [];108 }, 10);109 }110 if (_secondInputFocused) {111 setTimeout(function () {112 secondInput.focus();113 }, 0);114 }115 },116 onDestroy: function () {117 if (!config.input)118 secondInput.parentNode &&119 secondInput.parentNode.removeChild(secondInput);120 },121 onValueUpdate: function (selDates) {122 var _a, _b, _c;123 if (!secondInput)124 return;125 _prevDates =126 !_prevDates || selDates.length >= _prevDates.length127 ? selDates.slice() : _prevDates;128 if (_prevDates.length > selDates.length) {129 var newSelectedDate = selDates[0];130 var newDates = _secondInputFocused131 ? [_prevDates[0], newSelectedDate]132 : [newSelectedDate, _prevDates[1]];133 fp.setDate(newDates, false);134 _prevDates = newDates.slice();135 }136 _a = fp.selectedDates.map(function (d) { return fp.formatDate(d, dateFormat); }), _b = _a[0], fp._input.value = _b === void 0 ? "" : _b, _c = _a[1], secondInput.value = _c === void 0 ? "" : _c;137 }138 };139 return plugin;140 };141 }142 return rangePlugin;...
minuteView.ts
Source:minuteView.ts
...10 private $ctrl: IModelController,11 private provider: IProviderOptions) { }12 public render(): string {13 let i = 0,14 second = this.$scope.view.moment.clone().startOf('minute').second(this.provider.secondsStart);15 this.rows = {};16 for (let s = 0; s <= this.provider.secondsEnd - this.provider.secondsStart; s += this.provider.secondsStep) {17 let index = Math.floor(i / this.perLine),18 selectable = this.$scope.limits.isSelectable(second, 'second');19 if (!this.rows[index]) this.rows[index] = [];20 this.rows[index].push(<IViewItem>{21 index: second.second(),22 label: second.format(this.provider.secondsFormat),23 year: second.year(),24 month: second.month(),25 date: second.date(),26 hour: second.hour(),27 minute: second.minute(),28 second: second.second(),29 class: [30 this.$scope.keyboard && second.isSame(this.$scope.view.moment, 'second') ? 'highlighted' : '',31 !selectable ? 'disabled' : isValidMoment(this.$ctrl.$modelValue) && second.isSame(this.$ctrl.$modelValue, 'second') ? 'selected' : ''32 ].join(' ').trim(),33 selectable: selectable34 });35 i++;36 second.add(this.provider.secondsStep, 'seconds');37 }38 if (this.$scope.keyboard) this.highlightClosest();39 // return title40 return this.$scope.view.moment.clone().startOf('minute').format('lll');41 }42 public set(second: IViewItem): void {43 if (!second.selectable) return;44 this.$scope.view.moment.year(second.year).month(second.month).date(second.date).hour(second.hour).minute(second.minute).second(second.second);45 this.$scope.view.update();46 this.$scope.view.change();47 }48 public highlightClosest(): void {49 let seconds = <IViewItem[]>[], second;50 angular.forEach(this.rows, (row) => {51 angular.forEach(row, (value) => {52 if (Math.abs(value.second - this.$scope.view.moment.second()) < this.provider.secondsStep) seconds.push(value);53 });54 });55 second = seconds.sort((value1, value2) => {56 return Math.abs(value1.second - this.$scope.view.moment.second()) > Math.abs(value2.second - this.$scope.view.moment.second()) ? 1 : 0;57 })[0];58 if (!second || second.second - this.$scope.view.moment.second() == 0) return;59 this.$scope.view.moment.year(second.year).month(second.month).date(second.date).hour(second.hour).minute(second.minute).second(second.second);60 this.$scope.view.update();61 if (second.selectable) second.class = (second.class + ' highlighted').trim();62 }...
left-nav-interaction.js
Source:left-nav-interaction.js
1initSecondLevelNavInteraction();2function initSecondLevelNavInteraction() {3 var secondLevelNavHeaderArray = document.querySelectorAll("li.second-level-nav-header");4 for (var index = 0; index < secondLevelNavHeaderArray.length; index++) {5 6 function secondLevelNavClosure() {7 var closureIndex = index;8 function toggleSecondLevelNavDiv() {9 // Get the icon of the second-level-nav-header10 var secondLevelNavIcon = secondLevelNavHeaderArray[closureIndex].getElementsByTagName("I")[0];11 var secondLevelDiv = document.getElementsByClassName("second-level-nav-div")[closureIndex];12 if (secondLevelDiv.classList.contains("is-hidden")) {13 secondLevelNavIcon.classList.remove("sgds-icon-chevron-down");14 secondLevelNavIcon.classList.add("sgds-icon-chevron-up");15 secondLevelDiv.classList.remove("is-hidden");16 } else {17 secondLevelDiv.classList.add("is-hidden");18 secondLevelNavIcon.classList.remove("sgds-icon-chevron-up");19 secondLevelNavIcon.classList.add("sgds-icon-chevron-down");20 }21 }22 return toggleSecondLevelNavDiv;23 }24 secondLevelNavHeaderArray[index].addEventListener("click", secondLevelNavClosure());25 }26 var secondLevelNavHeaderMobileArray = document.querySelectorAll("a.second-level-nav-header-mobile");27 for (var index = 0; index < secondLevelNavHeaderMobileArray.length; index++) {28 function secondLevelNavMobileClosure() {29 var closureIndex = index;30 function toggleSecondLevelNavMobileDiv() {31 // Get the icon of the second-level-nav-header32 var secondLevelNavMobileIcon = secondLevelNavHeaderMobileArray[closureIndex].getElementsByTagName("I")[0];33 var secondLevelMobileDiv = document.getElementsByClassName("second-level-nav-div-mobile")[closureIndex];34 if (secondLevelMobileDiv.classList.contains("is-hidden")) {35 secondLevelNavMobileIcon.classList.remove("sgds-icon-chevron-down");36 secondLevelNavMobileIcon.classList.add("sgds-icon-chevron-up");37 secondLevelMobileDiv.classList.remove("is-hidden");38 } else {39 secondLevelMobileDiv.classList.add("is-hidden");40 secondLevelNavMobileIcon.classList.remove("sgds-icon-chevron-up");41 secondLevelNavMobileIcon.classList.add("sgds-icon-chevron-down");42 }43 }44 return toggleSecondLevelNavMobileDiv;45 }46 secondLevelNavHeaderMobileArray[index].addEventListener("click", secondLevelNavMobileClosure());47 }...
second-factor-form.js.es6
Source:second-factor-form.js.es6
1import Component from "@ember/component";2import computed from "ember-addons/ember-computed-decorators";3import { SECOND_FACTOR_METHODS } from "discourse/models/user";4export default Component.extend({5 @computed("secondFactorMethod")6 secondFactorTitle(secondFactorMethod) {7 switch (secondFactorMethod) {8 case SECOND_FACTOR_METHODS.TOTP:9 return I18n.t("login.second_factor_title");10 case SECOND_FACTOR_METHODS.SECURITY_KEY:11 return I18n.t("login.second_factor_title");12 case SECOND_FACTOR_METHODS.BACKUP_CODE:13 return I18n.t("login.second_factor_backup_title");14 }15 },16 @computed("secondFactorMethod")17 secondFactorDescription(secondFactorMethod) {18 switch (secondFactorMethod) {19 case SECOND_FACTOR_METHODS.TOTP:20 return I18n.t("login.second_factor_description");21 case SECOND_FACTOR_METHODS.SECURITY_KEY:22 return I18n.t("login.security_key_description");23 case SECOND_FACTOR_METHODS.BACKUP_CODE:24 return I18n.t("login.second_factor_backup_description");25 }26 },27 @computed("secondFactorMethod", "isLogin")28 linkText(secondFactorMethod, isLogin) {29 if (isLogin) {30 return secondFactorMethod === SECOND_FACTOR_METHODS.TOTP31 ? "login.second_factor_backup"32 : "login.second_factor";33 } else {34 return secondFactorMethod === SECOND_FACTOR_METHODS.TOTP35 ? "user.second_factor_backup.use"36 : "user.second_factor.use";37 }38 },39 @computed("backupEnabled", "secondFactorMethod")40 showToggleMethodLink(backupEnabled, secondFactorMethod) {41 return (42 backupEnabled && secondFactorMethod !== SECOND_FACTOR_METHODS.SECURITY_KEY43 );44 },45 actions: {46 toggleSecondFactorMethod() {47 const secondFactorMethod = this.secondFactorMethod;48 this.set("secondFactorToken", "");49 if (secondFactorMethod === SECOND_FACTOR_METHODS.TOTP) {50 this.set("secondFactorMethod", SECOND_FACTOR_METHODS.BACKUP_CODE);51 } else {52 this.set("secondFactorMethod", SECOND_FACTOR_METHODS.TOTP);53 }54 }55 }...
SecondComponent.jsx
Source:SecondComponent.jsx
1import "./SecondComponent.css"2import { SecondComponentTop } from "./SecondComponentTop/SecondComponentTop"3import { SecondComponentLeft } from "./SecondComponentLeft/SecondComponentLeft"4import { SecondComponentRight } from "./SecondComponentRight/SecondComponentRight"5import { SecondComponentText } from "./SecondComponentText/SecondComponentText"6export function SecondComponent({componentData}){7 return (8 <div className="second-component">9 <div className="second-component__wrapper">10 <SecondComponentTop/>11 <SecondComponentText/>12 <div className="second-component__container">13 <SecondComponentLeft/>14 <SecondComponentRight componentData={componentData}/>15 </div>16 </div>17 </div>18 )...
Using AI Code Generation
1const firstMethod = require('stryker-parent');2const secondMethod = require('stryker-parent/second-method');3const firstMethod = require('stryker-parent');4const secondMethod = require('stryker-parent/second-method');5const firstMethod = require('stryker-parent');6const secondMethod = require('stryker-parent/second-method');7const firstMethod = require('stryker-parent');8const secondMethod = require('stryker-parent/second-method');9const firstMethod = require('stryker-parent');10const secondMethod = require('stryker-parent/second-method');11const firstMethod = require('stryker-parent');12const secondMethod = require('stryker-parent/second-method');13const firstMethod = require('stryker-parent');14const secondMethod = require('stryker-parent/second-method');15const firstMethod = require('stryker-parent');16const secondMethod = require('stryker-parent/second-method');17const firstMethod = require('stryker-parent');18const secondMethod = require('stryker-parent/second-method');19const firstMethod = require('stryker-parent');20const secondMethod = require('stryker
Using AI Code Generation
1const { runStrykerCli } = require('stryker-parent');2runStrykerCli(['run', '--files', 'test.js', '--testRunner', 'command', '--commandRunner', { command: 'mocha' }]);3const { runStrykerCli } = require('stryker-parent');4runStrykerCli(['run', '--files', 'test.js', '--testRunner', 'command', '--commandRunner', { command: 'mocha' }]);5const { runStrykerCli } = require('stryker-parent');6runStrykerCli(['run', '--files', 'test.js', '--testRunner', 'command', '--commandRunner', { command: 'mocha' }]);7const { runStrykerCli } = require('stryker-parent');8runStrykerCli(['run', '--files', 'test.js', '--testRunner', 'command', '--commandRunner', { command: 'mocha' }]);9const { runStrykerCli } = require('stryker-parent');10runStrykerCli(['run', '--files', 'test.js', '--testRunner', 'command', '--commandRunner', { command: 'mocha' }]);11const { runStrykerCli } = require('stryker-parent');12runStrykerCli(['run', '--files', 'test.js', '--testRunner', 'command', '--commandRunner', { command: 'mocha' }]);13const { runStrykerCli } = require('stryker-parent');14runStrykerCli(['run', '--files', 'test.js', '--testRunner', 'command', '--commandRunner', { command: 'mocha' }]);15const { runStrykerCli } = require('stryker-parent');16runStrykerCli(['run', '--files', 'test.js', '--testRunner', 'command', '--commandRunner', { command
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!!