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
renderTooltip() { | |
if (this.state.tooltipLevel === TooltipLevel.happyMoment) { | |
return <this.SidebarHappyMoment />; | |
} | |
// ... | |
} |
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
async loadAndSetHappyMoment() { | |
const component = await import( | |
'../SidebarHappyMoment/SidebarHappyMoment.component' | |
); | |
this.SidebarHappyMoment = component.SidebarHappyMoment; | |
this.setState({ | |
tooltipLevel: TooltipLevel.happyMoment, | |
}); | |
} |
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 OtherComponent = React.lazy(() => import('./OtherComponent')); | |
function MyComponent() { | |
return ( | |
<div> | |
<React.Suspense fallback={<div>Loading...</div>}> | |
<OtherComponent /> | |
</React.Suspense> | |
</div> | |
); |
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 { HelloPerson } from './hello-person.component'; | |
import { shallow } from 'enzyme'; | |
describe('Hello Person', () => { | |
test('should render the name from the prop', () => { | |
const props = { | |
name: 'Jenia' | |
}; | |
const wrapper = shallow<HelloPerson>(<HelloPerson {...props} />); |
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
test('should not fetch data if the name is not Eyal', (done) => { | |
driver.given.name('Tal').when.rendered(); | |
setImmediate(() => { | |
expect(nockImplementation).not.toHaveBeenCalled(); | |
done(); | |
}); | |
}); |
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 { HelloPersonDriver } from './hello-person.driver'; | |
describe('Hello Person', () => { | |
let driver: HelloPersonDriver; | |
beforeEach(() => { | |
driver = new HelloPersonDriver(); | |
}); | |
test('should render the name from the prop', () => { |
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 { HelloPersonDriver } from './hello-person.driver'; | |
describe('Hello Person', () => { | |
let driver: HelloPersonDriver; | |
beforeEach(() => { | |
driver = new HelloPersonDriver(); | |
}); | |
test('should render the name from the prop', () => { |
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 { HelloPerson, Props } from './hello_person.component'; | |
import { shallow } from 'enzyme'; | |
import * as dataService from '../services/data-service'; | |
export class HelloPersonDriver { | |
private wrapper; | |
private props: Props = { | |
name: 'some name' | |
} |
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 { reportUserLogin } from '../services/data-service'; | |
interface Props { | |
name: string; | |
} | |
export class HelloPerson extends React.PureComponent<Props> { | |
componentDidMount() { | |
const { name } = this.props; |
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 { HelloPersonDriver } from './hello-person.driver'; | |
describe('Hello Person', () => { | |
let driver: HelloPersonDriver; | |
beforeEach(() => { | |
driver = new HelloPersonDriver(); | |
}); | |
test('should render the name from the prop', () => { |
NewerOlder