Skip to content

Commit

Permalink
Handle contact_status_changed events in simulator
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Jul 29, 2020
1 parent b468904 commit 076c75b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/simulator/LogEvent.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ describe(LogEvent.name, () => {
...commonEventProps
});
});
it('should render contact_status_changed event', () => {
testEventRender({
type: 'contact_status_changed',
status: 'blocked',
...commonEventProps
});
});
it('should render contact_urns_changed event', () => {
testEventRender({
type: 'contact_urns_changed',
Expand Down
6 changes: 6 additions & 0 deletions src/components/simulator/LogEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,12 @@ export default class LogEvent extends React.Component<EventProps, LogEventState>
language: this.props.language
})
);
case 'contact_status_changed':
return renderInfo(
i18n.t('simulator.contact_status_changed', 'Set status to "[[status]]"', {
status: this.props.status
})
);
case 'info':
return renderInfo(this.props.text);
case 'input_labels_added':
Expand Down
18 changes: 18 additions & 0 deletions src/components/simulator/__snapshots__/LogEvent.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,24 @@ exports[`LogEvent should render contact_name_changed event 1`] = `
</body>
`;

exports[`LogEvent should render contact_status_changed event 1`] = `
<body>
<div>
<div
class="evt"
>
<div
class="info"
>
<span>
Set status to "blocked"
</span>
</div>
</div>
</div>
</body>
`;

exports[`LogEvent should render contact_urns_changed event 1`] = `
<body>
<div>
Expand Down
1 change: 1 addition & 0 deletions src/config/i18n/defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@
"contact_field_changed": "Set contact \"[[field]]\" to \"[[value]]\"",
"contact_field_cleared": "Cleared contact \"[[field]]\"",
"contact_language_changed": "Set preferred language to \"[[language]]\"",
"contact_status_changed": "Set status to \"[[status]]\"",
"contact_name_changed": "Set contact name to \"[[name]]\"",
"flow_entered": "Entered flow \"[[flow]]\"",
"httplog_dialog": "HTTP Request Details",
Expand Down

0 comments on commit 076c75b

Please sign in to comment.