Last active
April 20, 2017 13:47
-
-
Save jmichelin/e0fc81be3e450bd94739b6cd39b3ed57 to your computer and use it in GitHub Desktop.
Basic test?
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
// .babelrc | |
{ | |
"presets": ["es2015", "react"] | |
} |
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
/** | |
* Created by jmichelin on 4/19/17. | |
*/ | |
import React from 'react'; | |
import expect from 'expect'; | |
import {shallow} from 'enzyme'; | |
import renderer from 'react-test-renderer'; | |
import Login from '../link'; | |
describe('Login (Snapshot)', () => { | |
it('Login renders the sign in screen', () => { | |
const component = renderer.create(<Login />); | |
const json = component.toJSON(); | |
expect(json).toMatchSnapshot(); | |
}); | |
}); | |
describe('Login', () => { | |
it('Login renders connect button', () => { | |
const login = shallow(<Login />); | |
expect(login.find('button').text()).toEqual('Connect with Spotify'); | |
}); | |
}); | |
test('Login renders connect button', () => { | |
const login = shallow(<Login />); | |
expect(login.find('button').text()).toEqual('Connect with Spotify'); | |
}); |
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
/** | |
* Created by jmichelin on 4/19/17. | |
*/ | |
import React from 'react'; | |
//import 'particles.js'; | |
//import SweetScroll from 'sweet-scroll'; | |
//import '../../public/Styles/main.scss'; | |
//import About from './About'; | |
//import particleConfig from '../../particlesjs-config.json'; | |
class Login extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
showAbout: false, | |
}; | |
} | |
componentDidMount() { | |
this.sweetScroll = new SweetScroll(); | |
particlesJS('particles-js', particleConfig, !1); | |
} | |
componentDidUpdate(prevProps, prevState) { | |
if (!prevState.showAbout) { | |
this.sweetScroll.toElement(document.getElementById('about')); | |
} | |
} | |
handleAuth() { | |
window.location = '/auth/signin'; | |
} | |
handleScroll() { | |
this.setState({ | |
showAbout: !this.state.showAbout, | |
}); | |
} | |
render() { | |
return ( | |
<div className="page-container"> | |
<div id="particles-js"> | |
<div className="top-content-container"> | |
<img className="header-logo" src="./assets/gigify.svg" alt="Smiley face" /> | |
<div className="page-subheader"> | |
Create Spotify playlists from your | |
upcoming Songkick gigs | |
</div> | |
<button | |
className="btn btn-lg spotify-auth-button fill" | |
type="button" | |
onClick={() => this.handleAuth()} | |
> | |
<i className="fa fa-spotify fa-3x spotify-icon" aria-hidden="true" /> | |
Connect with Spotify | |
</button> | |
<div className="down"> | |
<button className="downBtn" style={{ background: 'transparent', border: 'none' }} onClick={() => this.handleScroll()}> | |
<i | |
className="icon fa fa-chevron-down faa-pulse animated" | |
aria-hidden="true" | |
/> | |
</button> | |
</div> | |
</div> | |
</div> | |
<About /> | |
<div className="footer"> | |
<h6 className="footer-content"> | |
<img className="footer-logo" src="./assets/gigify-g.svg" alt="Smiley face" /> | <a href="https://github.com/gigify-music/gigify" className="github-link">Gigify Github</a></h6> | |
</div> | |
</div> | |
); | |
} | |
} | |
export default Login; |
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
{ | |
"name": "code-it", | |
"version": "1.0.0", | |
"description": "", | |
"main": "jp.js", | |
"scripts": { | |
"test": "jest" | |
}, | |
"dependencies": { | |
"react": "15.5.4", | |
"react-dom": "15.5.4" | |
}, | |
"devDependencies": { | |
"babel-jest": "19.0.0", | |
"babel-preset-es2015": "6.24.1", | |
"babel-preset-react": "6.24.1", | |
"enzyme": "2.8.2", | |
"expect": "1.20.2", | |
"jest": "19.0.2", | |
"react-test-renderer": "15.5.4" | |
}, | |
"author": "John Michelin <[email protected]> (http://www.javascriptjohn.com/)", | |
"license": "MIT" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment