Skip to content

Instantly share code, notes, and snippets.

{
"name": "cypress-demonstartion",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"cy:open": "cypress open"
},
"keywords": [],
"author": "",
describe('testing actions for todo application ', () => {
before(() => {
cy.visit('http://localhost:3000/');
})
it('test for typing todo in input box', () => {
const SAMPLE_TEXT = 'write article on medium.com';
// enters text in input box of app
cy.get('input[name=task]')
.focus()
.clear()
const { expect } = require("chai");
describe('testing actions for todo application ', () => {
before(() => {
cy.visit('http://localhost:3000/');
})
it('test for typing todo in input box', () => {
const SAMPLE_TEXT = 'write article on medium.com';
// enters text in input box of app
cy.get('input[name=task]')
const { expect } = require("chai");
describe('testing actions for todo application ', () => {
before(() => {
cy.visit('http://localhost:3000/');
})
it('test for typing todo in input box', () => {
const SAMPLE_TEXT = 'write article on medium.com';
// enters text in input box of app
cy.get('input[name=task]')
import { MutableRefObject, useEffect } from "react";
type ObserverConfiguration = {
root?: Element | Document | null;
rootMargin?: string; // same CSS like values (It don't effect CSS for element)
threshold?: number | number[];
};
type ObserverOptions = {
configuration?: Partial<ObserverConfiguration>;
const element = document.getElementById(ELEMENT_ID);
const onScroll = (e) => {
console.log("Scroll event getting fired", element?.scrollTop);
};
element?.addEventListener("scroll", onScroll);
const element = document.querySelector(ELEMENT_SELECTOR);
const parentElement = document.querySelector(PARENT_ELEMENT_SELECTOR);
const observer = new IntersectionObserver(
(entries: any) => {
/**
* Callback will run when observed element intersect with given root
*/
},
{
root: parentElement, // if passed null take document as root
@aniketchanana
aniketchanana / myPromise.tsx
Created April 3, 2023 18:33
my implementation for promises in javascript
enum STATES {
PENDING = 0,
FULFILLED = 1,
REJECTED = 2,
}
class MyPromise {
private state: STATES;
private value: any;
private handlers: Array<{ onSuccess: Function; onFailure: Function }>;