Fakultas Ilmu Komputer UI

Commit 8df39292 authored by alif fadila safriyanto's avatar alif fadila safriyanto
Browse files

[GREEN] check topmenu state containst today quotes

parent 4a9777b8
......@@ -220,8 +220,7 @@ describe('TopMenu', () => {
<TopMenu user={adminUser2}>
<div> test </div>
</TopMenu>);
const topMenuQuote = topmenu.state.todayQuote;
expect(topMenuQuote).to.exist;
expect(topmenu.state.todayQuote).to.not.equal(undefined);
});
});
......@@ -4,6 +4,7 @@ import { Link, browserHistory } from 'react-router';
import Server from '../lib/Server';
import Storage from '../lib/Storage';
var quotes = require('starwars');
const defaultPicture = 'https://semantic-ui.com/images/avatar/small/elliot.jpg';
export default class TopMenu extends React.Component {
......@@ -35,9 +36,14 @@ export default class TopMenu extends React.Component {
constructor(props) {
super(props);
/* istanbul ignore next */
this.state = { activeItem: 'Beranda', logoutLoading: false };
this.state = {
activeItem: 'Beranda',
logoutLoading: false,
todayQuote: quotes(),
};
this.logout = this.logout.bind(this);
this.logoutCompany = this.logoutCompany.bind(this);
console.log(this.state.todayQuote);
}
handleItemClick = (e, { name }) => this.setState({ activeItem: name });
......@@ -64,6 +70,9 @@ export default class TopMenu extends React.Component {
const data = TopMenu.getInfo(this.props.user);
return (
<div>
<div style={{ padding: '10px 0', fontStyle: 'italic', textAlign: 'center' }}>
{ this.state.todayQuote }
</div>
{ this.props.user.data.is_staff && this.props.user.data.company && (
<div className="admin-bar">
<p>
......
......@@ -52,6 +52,7 @@
"react-test-utils": "0.0.1",
"webpack": "^1.13.2",
"webpack-bundle-tracker": "0.0.93",
"quotes-go": "^1.0.5",
"webpack-dev-server": "^1.16.2"
},
"dependencies": {
......@@ -59,6 +60,7 @@
"babel-core": "^6.24.0",
"babel-preset-react": "^6.16.0",
"object-assign": "^4.1.1",
"quotes-go": "^1.0.5",
"react": "15.4.2",
"react-addons-test-utils": "15.4.2",
"react-ckeditor-wrapper": "^1.0.22",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment