Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
289 additions
and
155 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React, { Component } from 'react' | ||
import { inject, observer } from 'mobx-react/index' | ||
import { Route, Redirect } from 'react-router-dom' | ||
|
||
@inject('deploymentStore') | ||
@observer | ||
export class ProtectedRoute extends Component { | ||
render() { | ||
const { component: Component, deploymentStore, ...props } = this.props | ||
return ( | ||
<Route | ||
{...props} | ||
render={props => (!deploymentStore.deployInProgress ? <Component {...props} /> : <Redirect to="/" />)} | ||
/> | ||
) | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React, { Component } from 'react' | ||
import logdown from 'logdown' | ||
import cancelDeploy from '../../utils/cancelDeploy' | ||
|
||
const logger = logdown('TW:Home:CancelCrowdsale') | ||
|
||
export class CancelCrowdsale extends Component { | ||
cancel = () => { | ||
logger.log('Cancel crowdsale') | ||
cancelDeploy() | ||
} | ||
|
||
render() { | ||
return ( | ||
<button onClick={() => this.cancel()} className="hm-Home_BtnChoose"> | ||
Cancel crowdsale | ||
</button> | ||
) | ||
} | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React, { Component } from 'react' | ||
|
||
export class ResumeCrowdsale extends Component { | ||
resume = () => { | ||
localStorage.reload = true | ||
window.location = '/4' | ||
} | ||
|
||
render() { | ||
return ( | ||
<button onClick={() => this.resume()} className="hm-Home_BtnNew"> | ||
Resume crowdsale | ||
</button> | ||
) | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import React from 'react' | ||
import { Link } from 'react-router-dom' | ||
|
||
export const LogoWhite = () => { | ||
return <Link className="sw-LogoWhite" to="/" /> | ||
// eslint-disable-next-line | ||
return <a className="sw-LogoWhite" href="/" /> | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import React from 'react' | ||
import Adapter from 'enzyme-adapter-react-15' | ||
import { configure, mount, shallow, render } from 'enzyme' | ||
import { MemoryRouter } from 'react-router' | ||
import { CancelCrowdsale } from '../../../src/components/Home/CancelCrowdsale' | ||
|
||
configure({ adapter: new Adapter() }) | ||
|
||
describe('CancelCrowdsale', () => { | ||
const history = { | ||
push: jest.fn() | ||
} | ||
|
||
it('should render screen with shallow without throwing an error', () => { | ||
const wrapper = shallow(<CancelCrowdsale />) | ||
|
||
expect(wrapper).toMatchSnapshot() | ||
}) | ||
|
||
it('should render screen with mount without throwing an error', () => { | ||
// Given | ||
const wrapper = mount( | ||
<MemoryRouter initialEntries={['/']}> | ||
<CancelCrowdsale /> | ||
</MemoryRouter> | ||
) | ||
|
||
// When | ||
const tree = wrapper.find('.hm-Home_BtnChoose') | ||
|
||
// Then | ||
expect(tree).toHaveLength(1) | ||
}) | ||
|
||
it('should render screen with render without throwing an error', () => { | ||
// Given | ||
const wrapper = render( | ||
<MemoryRouter initialEntries={['/']}> | ||
<CancelCrowdsale /> | ||
</MemoryRouter> | ||
) | ||
// When | ||
const tree = wrapper.html() | ||
|
||
// Then | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
|
||
it(`should simulate click`, () => { | ||
// Given | ||
const wrapper = shallow(<CancelCrowdsale history={history} />) | ||
const instance = wrapper.instance() | ||
const cancelHandler = jest.spyOn(instance, 'cancel') | ||
instance.forceUpdate() | ||
// When | ||
const buttonCancelCrowdsale = wrapper.find('.hm-Home_BtnChoose') | ||
buttonCancelCrowdsale.simulate('click') | ||
|
||
// Then | ||
expect(buttonCancelCrowdsale.length).toBe(1) | ||
expect(cancelHandler).toHaveBeenCalledTimes(1) | ||
}) | ||
}) |
Oops, something went wrong.