Skip to content

Commit

Permalink
feat(camunda-plugin): disable deploy button if form is not valid
Browse files Browse the repository at this point in the history
  • Loading branch information
barmac committed Feb 13, 2020
1 parent d751666 commit 050fcdf
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ export default class DeploymentConfigModal extends React.PureComponent {
<button
type="submit"
className="btn btn-primary"
disabled={ form.isSubmitting }
disabled={ form.isSubmitting || !form.isValid || !connectionState.isValid }
>
{ primaryAction || 'Deploy' }
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,72 @@ describe('<DeploymentConfigModal>', () => {
expect(wrapper.find('.hint.error')).to.have.length(1);
});


it('should disable deploy button when connection cannot be established', async () => {

// given
const configuration = {
deployment: {
tenantId: '',
name: 'diagram'
},
endpoint: {
url: 'http://localhost:8088/engine-rest',
authType: AuthTypes.none
}
};

const connectionChecker = new MockConnectionChecker();

const {
wrapper
} = createModal({
connectionChecker,
configuration
}, mount);

// when
await connectionChecker.triggerComplete({ connectionError: true });

wrapper.update();

// then
expect(wrapper.find('.btn-primary').props()).to.have.property('disabled', true);
});
});


it('should disable deploy button when form is invalid', async () => {

// given
const configuration = {
deployment: {
tenantId: '',
name: ''
},
endpoint: {
url: 'http://localhost:8088/engine-rest',
authType: AuthTypes.none
}
};

const connectionChecker = new MockConnectionChecker();

const {
wrapper
} = createModal({
connectionChecker,
configuration
}, mount);

// when
await connectionChecker.triggerComplete({});

wrapper.update();

// then
expect(wrapper.find('.btn-primary').props()).to.have.property('disabled', true);
});
});


Expand Down

0 comments on commit 050fcdf

Please sign in to comment.