Skip to content

Commit

Permalink
code clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
RachelDau committed Dec 11, 2023
1 parent 86ff23e commit e6e3e51
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Object {
"nav:resetContext": [Function],
"nav:setContext": [Function],
"nav:setFlag": [Function],
"nav:setNotificationStatus": [Function],
"nav:showChildren": [Function],
"nav:toggle": [Function],
"nav:unlock": [Function],
Expand Down Expand Up @@ -527,33 +526,6 @@ Object {
}
`;

exports[`NavStore nav:setNotificationStatus event fires and updates state 1`] = `
Array [
"navstore:change",
]
`;

exports[`NavStore nav:setNotificationStatus event fires and updates state 2`] = `
Array [
Object {
"action": "nav:setNotificationStatus",
"draftId": undefined,
"eventVersion": "1.0.0",
"payload": Object {
"from": true,
"to": false,
},
"visitId": undefined,
},
]
`;

exports[`NavStore nav:setNotificationStatus event fires and updates state 3`] = `
Object {
"notification": false,
}
`;

exports[`NavStore nav:showChildren event fires and updates state 1`] = `
Array [
"navstore:change",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1082,23 +1082,4 @@ describe('NavStore', () => {
expect(NavUtil.goto).toHaveBeenCalledWith('mockFirstTargetId')
expect(NavUtil.goto).toHaveBeenCalledTimes(1)
})

test('nav:setNotificationStatus event fires and updates state', () => {
const notification = true
NavStore.setState({
notification
})
// simulate trigger
Dispatcher.trigger.mockReturnValueOnce()

// go
eventCallbacks['nav:setNotificationStatus']({ value: { notification: !notification } })
expect(Dispatcher.trigger).toHaveBeenCalledTimes(1)
expect(Dispatcher.trigger.mock.calls[0]).toMatchSnapshot()
expect(ViewerAPI.postEvent).toHaveBeenCalledTimes(1)
expect(ViewerAPI.postEvent.mock.calls[0]).toMatchSnapshot()
const payloadToAPI = ViewerAPI.postEvent.mock.calls[0][0].payload
expect(payloadToAPI).toEqual({ from: notification, to: !notification })
expect(NavStore.getState()).toMatchSnapshot()
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -408,12 +408,6 @@
&.is-not-open .viewer--components--logo {
opacity: 0;
}

&.is-not-notification-enabled {
.nav-menu {
display: none;
}
}
}

.is-previewing .viewer--components--nav {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,20 +212,6 @@ class NavStore extends Store {
if (navItem) {
NavUtil.setFlag(payload.value.id, 'correct', payload.value.score === 100)
}
},
'nav:setNotificationStatus': payload => {
ViewerAPI.postEvent({
draftId: this.state.draftId,
action: 'nav:setNotificationStatus',
eventVersion: '1.0.0',
visitId: this.state.visitId,
payload: {
from: this.state.notification,
to: payload.value.notification
}
})
this.state.notification = payload.value.notification
return this.triggerChange()
}
},
this
Expand Down

0 comments on commit e6e3e51

Please sign in to comment.