Skip to content

Commit

Permalink
[GH-33] Require events value are not emtpy upon a subscription save (#65
Browse files Browse the repository at this point in the history
)

* check that events are not empty on save

* check for null value. This occurs when individually removing all the
events vs big x on RHS of select
  • Loading branch information
jfrerich authored Aug 12, 2020
1 parent 06cfafa commit eed9fc7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions webapp/src/components/confluence_field.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,13 @@ export default class ConfluenceField extends React.PureComponent {
}

isValid = () => {
const {value, required} = this.props;
if (required && ((typeof value === 'string' && !value.trim()) || !value)) {
const {fieldType, value, required} = this.props;
if (required &&
(value === null ||
(typeof value === 'string' && !value.trim()) ||
(fieldType === 'dropDown' && value.length === 0) ||
!value)
) {
this.setState({
valid: false,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ exports[`components/ChannelSettingsModal subscription modal snapshot test 1`] =
}
readOnly={false}
removeValidation={[Function]}
required={false}
required={true}
theme={Object {}}
value={
Array [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ export default class SubscriptionModal extends React.PureComponent {
label={'Events'}
name={'events'}
fieldType={'dropDown'}
required={false}
required={true}
theme={this.props.theme}
options={Constants.CONFLUENCE_EVENTS}
value={this.state.events}
Expand Down

0 comments on commit eed9fc7

Please sign in to comment.