This file contains hidden or 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
| /********************************************************** | |
| object {}, __proto__, Object, Object.prototype, Object.create(protoToSet) | |
| **********************************************************/ | |
| test('У простого object есть прототип который можно получить через вызов Object.getPrototypeOf(obj)', () => { | |
| const object = {} | |
| expect(Object.getPrototypeOf(object)).toBeDefined() | |
| // У всех объектов есть прототип (который так же __proto__) | |
| }) |
This file contains hidden or 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
| it('closes via method call.', () => { | |
| // arrange | |
| let popup = React.createRef(); | |
| cy.window().then((win) => { | |
| // initial state - popup is visible | |
| ReactDOM.render( | |
| <win.Popup | |
| showed={true} | |
| ref={popup} | |
| />, |
This file contains hidden or 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
| it('becomes hidden after being shown when showed=false passed.', () => { | |
| // arrange | |
| cy.window().then((win) => { | |
| // initial state - popup is visible | |
| ReactDOM.render( | |
| <PopupTestWrapper | |
| showed={true} | |
| win={win} | |
| />, | |
| win.document.querySelector(rootToMountSelector) |
This file contains hidden or 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
| let setPopupTestWrapperState = null; | |
| const PopupTestWrapper = ({ showed, win }) => { | |
| const [isShown, setState] = React.useState(showed); | |
| setPopupTestWrapperState = setState; | |
| return <win.Popup showed={isShown} /> | |
| } |
This file contains hidden or 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 selectors = { | |
| innerInput: '.react-datepicker__input-container input', | |
| }; | |
| it('renders text field.', () => { | |
| cy.window().then((win) => { | |
| ReactDOM.render( | |
| <win.Datepicker />, | |
| win.document.querySelector(rootToMountSelector) | |
| ); |
This file contains hidden or 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
| afterEach(() => { | |
| cy.document() | |
| .then((doc) => { | |
| ReactDOM.unmountComponentAtNode(doc.querySelector(rootToMountSelector)); | |
| }); | |
| }); |
This file contains hidden or 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 rootToMountSelector = '#component-test-mount-point'; | |
| before(() => { | |
| cy.visit('http://localhost:12345/iframe.html?id=datepicker--empty-story'); | |
| cy.get(rootToMountSelector); | |
| }); |
This file contains hidden or 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
| /// <reference types="cypress" /> | |
| import React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| /** | |
| * <Datepicker /> | |
| * * renders text field. | |
| * * renders desired placeholder text. | |
| * * renders chosen date. |
This file contains hidden or 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 React from 'react'; | |
| import Datepicker from './Datepicker.jsx'; | |
| export default { | |
| component: Datepicker, | |
| title: 'Datepicker', | |
| }; | |
| export const emptyStory = () => { | |
| // Reference to retrieve it in Cypress during the test |