Fakultas Ilmu Komputer UI

Commit 227688cc authored by alif fadila safriyanto's avatar alif fadila safriyanto
Browse files

1506688765 64 Kata kata motivasi pada dashboard

parent 223df12e
......@@ -216,6 +216,14 @@ describe('TopMenu', () => {
expect(topmenu.state.activeItem).to.equal(undefined);
});
it('check topmenu state containst today quotes', () => {
const topmenu = ReactTestUtils.renderIntoDocument(
<TopMenu user={adminUser2}>
<div> test </div>
</TopMenu>);
expect(topmenu.state.todayQuote).to.not.equal(undefined);
});
it('TopMenu state contain right current date time', () => {
moment.locale('id');
const date = new Date();
......
......@@ -5,6 +5,7 @@ import Server from '../lib/Server';
import Storage from '../lib/Storage';
import moment from 'moment';
var quotes = require('starwars');
const defaultPicture = 'https://semantic-ui.com/images/avatar/small/elliot.jpg';
export default class TopMenu extends React.Component {
......@@ -41,9 +42,11 @@ export default class TopMenu extends React.Component {
activeItem: 'Beranda',
logoutLoading: false,
currentDate: moment(new Date()).format('dddd') + ', ' + moment(new Date()).format('LL'),
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 });
......@@ -70,6 +73,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>
......
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