Fakultas Ilmu Komputer UI

Commit bfe4c363 authored by RAMA WIDRAGAMA PUTRA's avatar RAMA WIDRAGAMA PUTRA
Browse files

Merge branch '1606880485-216' into 'master'

1606880485 216

See merge request !247
parents 865ff315 1d18e791
Pipeline #26712 passed with stages
in 14 minutes and 15 seconds
...@@ -11,25 +11,78 @@ export default class NotificationPage extends React.Component { ...@@ -11,25 +11,78 @@ export default class NotificationPage extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = {
list : [
{
title: "Your Application Has Been Rejected",
text: "Tutuplapak has rejected your applications",
timestamp: "2019-10-10T13:00:00",
},
{
title: "Your Application Has Been Accepted",
text: "Tutuplapak has rejected your applications",
timestamp: "2019-12-10T13:00:00",
},
{
title: "Your Application Has Been Responded",
text: "Tutuplapak has rejected your applications",
timestamp: "2019-11-10T13:00:00",
},
]
console.log('Notifikasi');
Storage.set('menu-active-state', 'Notifikasi');
} }
console.log('Notifikasi');
Storage.set('menu-active-state', 'Notifikasi');
}
// componentDidUpdate(prevprops,prevstate){
// this.updateList();
// }
// updateList = () => {
// }
onClickDismiss = (index) => {
var array = [...this.state.list];
array.splice(index, 1);
console.log("eh kepencet")
console.log(index)
this.setState({
list : array
})
}
render() { render() {
var id=-1
return ( return (
<div className="notificationPage"> <div className="notificationPage">
<Segment className="notifikasi"> <Segment className="notifikasi">
<Notification {
title="Your Application Has Been Rejected" this.state.list.map(item=>{
text="Tutuplapak has rejected your applications" id=id+1
timestamp="2019-10-10T13:00:00" console.log(id)
/> return (
<Notification <Notification
title="Lorem Ipsum" id={id}
text="Dolor Sit Amet" title={item.title}
timestamp="1970-01-01T06:00:00" text={item.text}
timestamp={item.timestamp}
dismiss = {this.onClickDismiss}
/> />
)}
)}
</Segment> </Segment>
</div> </div>
); );
......
...@@ -62,4 +62,15 @@ describe('NotificationPage', () => { ...@@ -62,4 +62,15 @@ describe('NotificationPage', () => {
); );
expect(topmenu.state.activeItem).to.equal('Notifikasi'); expect(topmenu.state.activeItem).to.equal('Notifikasi');
}); });
it('test click dismiss notif',()=>{
const notifpage = ReactTestUtils.renderIntoDocument(
<NotificationPage
user={{ data: studentSession }}
/>,
);
notifpage.onClickDismiss(0);
expect(notifpage.state.list.length).to.equal(2);
});
}); });
...@@ -252,6 +252,24 @@ describe('TopMenu', () => { ...@@ -252,6 +252,24 @@ describe('TopMenu', () => {
expect(topmenu.state.isOpen).to.equal(false); expect(topmenu.state.isOpen).to.equal(false);
}); });
it('check popup is open', () => {
const topmenu = ReactTestUtils.renderIntoDocument(
<TopMenu user={adminUser2}>
<div> test </div>
</TopMenu>);
topmenu.handleOpen();
expect(topmenu.state.isOpen).to.equal(true);
});
it('check popup is close', () => {
const topmenu = ReactTestUtils.renderIntoDocument(
<TopMenu user={adminUser2}>
<div> test </div>
</TopMenu>);
topmenu.handleClose();
expect(topmenu.state.isOpen).to.equal(false);
});
it('TopMenu state contain right current date time', () => { it('TopMenu state contain right current date time', () => {
moment.locale('id'); moment.locale('id');
const date = new Date(); const date = new Date();
......
...@@ -51,7 +51,9 @@ export default class Notification extends React.Component { ...@@ -51,7 +51,9 @@ export default class Notification extends React.Component {
<p>{this.props.text}</p> <p>{this.props.text}</p>
</Grid.Column> </Grid.Column>
<Grid.Column floated="right" width={2}> <Grid.Column floated="right" width={2}>
<Button primary>Dismiss</Button> <Button onClick={(e)=>
this.props.dismiss(this.props.id)
}primary>Dismiss</Button>
<p>{this.getElapsedTime(new Date())}</p> <p>{this.getElapsedTime(new Date())}</p>
</Grid.Column> </Grid.Column>
</Grid.Row> </Grid.Row>
......
This diff is collapsed.
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