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('should handle uncontrolled value and change callback', () => { | |
| const onToggleSpy = jest.fn(); | |
| const { clickHeader } = mountUsage(<Zippy header={'header'} onToggle={onToggleSpy}/>); | |
| clickHeader(); | |
| expect(onToggleSpy).toBeCalledWith(true); | |
| clickHeader(); | |
| expect(onToggleSpy).toBeCalledWith(false); | |
| expect(onToggleSpy).toHaveBeenCalledTimes(2); | |
| }); |
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('should work when value is controlled but changes are ignored (readonly mode)', () => { | |
| const { clickHeader, isOpen } = mountUsage(<Zippy header={'header'} open={true}/>); | |
| expect(isOpen()).toEqual(true); | |
| clickHeader(); | |
| expect(isOpen()).toEqual(true); | |
| clickHeader(); | |
| expect(isOpen()).toEqual(true); | |
| }); |
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('should work in controlled mode', () => { | |
| class ControlledUsage extends React.Component<{}, { counter: number, open: boolean }> { | |
| constructor(props) { | |
| super(props); | |
| this.toggle = this.toggle.bind(this); | |
| } | |
| state = { | |
| counter: 0, | |
| open: true, |
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
| body { | |
| font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, | |
| sans-serif, "Apple Color Emoji", "Segoe UI Emoji"; | |
| font-size: 16px; | |
| line-height: 1.5; | |
| word-wrap: break-word; | |
| color: #24292e; | |
| background-color: #fff; | |
| } |
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 * as React from "react"; | |
| import { | |
| AnyComponent, | |
| BaseObject, | |
| ExecutionProps, | |
| Interpolation, | |
| KnownTarget, | |
| NoInfer, | |
| RuleSet, | |
| Styles, |
OlderNewer