MM-17519: do not stringify booleans (#3693)

Match the webapp behaviour so as to avoid stringifying booleans in the interactive dialog payloads.

Fixes: https://mattermost.atlassian.net/browse/MM-17519
This commit is contained in:
Jesse Hallam 2019-12-12 12:25:27 -04:00 committed by Saturnino Abril
parent d542da6a06
commit ae3d0107f8
2 changed files with 3 additions and 3 deletions

View file

@ -41,7 +41,7 @@ export default class BoolSetting extends PureComponent {
};
handleChange = (value) => {
this.props.onChange(this.props.id, `${value}`);
this.props.onChange(this.props.id, Boolean(value));
};
render() {

View file

@ -26,10 +26,10 @@ describe('components/widgets/settings/TextSetting', () => {
wrapper.instance().handleChange(false);
expect(onChange).toHaveBeenCalledTimes(1);
expect(onChange).toHaveBeenCalledWith('elementid', 'false');
expect(onChange).toHaveBeenCalledWith('elementid', false);
wrapper.instance().handleChange(true);
expect(onChange).toHaveBeenCalledTimes(2);
expect(onChange).toHaveBeenCalledWith('elementid', 'true');
expect(onChange).toHaveBeenCalledWith('elementid', true);
});
});