diff --git a/jujugui/static/gui/src/app/components/deployment-flow/sshkey/__snapshots__/test-sshkey.js.snap b/jujugui/static/gui/src/app/components/deployment-flow/sshkey/__snapshots__/test-sshkey.js.snap
new file mode 100644
index 0000000000..7feddbdd39
--- /dev/null
+++ b/jujugui/static/gui/src/app/components/deployment-flow/sshkey/__snapshots__/test-sshkey.js.snap
@@ -0,0 +1,131 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`DeploymentSSHKey can disable and enable the add 1`] = `
+
+
+ Keys will allow you SSH access to the machines provisioned by Juju for this model.
+
+
+
+
+
+
+
+
+
+
+
+
+
+`;
+
+exports[`DeploymentSSHKey can disable and enable the add 2`] = `
+
+
+ Keys will allow you SSH access to the machines provisioned by Juju for this model.
+
+
+
+
+
+
+
+
+
+
+
+
+
+`;
diff --git a/jujugui/static/gui/src/app/components/deployment-flow/sshkey/sshkey.js b/jujugui/static/gui/src/app/components/deployment-flow/sshkey/sshkey.js
index e4a75f313a..bd9d2f7afb 100644
--- a/jujugui/static/gui/src/app/components/deployment-flow/sshkey/sshkey.js
+++ b/jujugui/static/gui/src/app/components/deployment-flow/sshkey/sshkey.js
@@ -425,10 +425,6 @@ class DeploymentSSHKey extends React.Component {
return false;
}
- componentDidUpdate() {
- this._updateButtonState();
- }
-
render() {
const cloud = this.props.cloud;
if (!cloud) {
diff --git a/jujugui/static/gui/src/app/components/deployment-flow/sshkey/test-sshkey.js b/jujugui/static/gui/src/app/components/deployment-flow/sshkey/test-sshkey.js
index fe72fb5cd8..30ccecbaad 100644
--- a/jujugui/static/gui/src/app/components/deployment-flow/sshkey/test-sshkey.js
+++ b/jujugui/static/gui/src/app/components/deployment-flow/sshkey/test-sshkey.js
@@ -103,7 +103,6 @@ describe('DeploymentSSHKey', function() {
launchpadUsername: {getValue: () => 'rose'},
sshSource: {getValue: () => 'launchpad'}
};
- instance.componentDidUpdate();
instance._handleSourceChange();
wrapper.update();
const expected = (
@@ -296,8 +295,7 @@ describe('DeploymentSSHKey', function() {
}
}
};
- instance.componentDidUpdate();
- wrapper.update();
+ instance._updateButtonState();
assert.equal(wrapper.find('Button').prop('disabled'), false);
instance._addGithubKeysCallback(null, [
{id: 1, type: 'ssh-rsa', body: 'thekey', text: 'ssh-rsa thekey'}
@@ -524,33 +522,11 @@ describe('DeploymentSSHKey', function() {
it('can disable and enable the add', () => {
const wrapper = renderComponent();
- const instance = wrapper.instance();
- let expected = (
-
-
-
- );
- assert.compareJSX(wrapper.find('.deployment-ssh-key__add-key'), expected);
- instance.setState({
+ expect(wrapper).toMatchSnapshot();
+ wrapper.setState({
buttonDisabled: false
});
- wrapper.update();
- expected = (
-
-
-
- );
- assert.compareJSX(wrapper.find('.deployment-ssh-key__add-key'), expected);
+ expect(wrapper).toMatchSnapshot();
});
});