This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum STATES { | |
PENDING = 0, | |
FULFILLED = 1, | |
REJECTED = 2, | |
} | |
class MyPromise { | |
private state: STATES; | |
private value: any; | |
private handlers: Array<{ onSuccess: Function; onFailure: Function }>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const element = document.getElementById(ELEMENT_ID); | |
const onScroll = (e) => { | |
console.log("Scroll event getting fired", element?.scrollTop); | |
}; | |
element?.addEventListener("scroll", onScroll); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "cypress-demonstartion", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"cy:open": "cypress open" | |
}, | |
"keywords": [], | |
"author": "", |