Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 960a66f

Browse files
committed
Enable the accept button after the user loads
1 parent c85a910 commit 960a66f

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

lib/controllers/create-dialog-controller.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ export class BareCreateDialogController extends React.Component {
8686
);
8787
}
8888

89+
componentDidUpdate(prevProps) {
90+
if (this.props.user !== prevProps.user) {
91+
this.recheckAcceptEnablement();
92+
}
93+
}
94+
8995
componentWillUnmount() {
9096
this.subs.dispose();
9197
}

test/controllers/create-dialog-controller.test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,20 @@ describe('CreateDialogController', function() {
194194

195195
assert.isFalse(wrapper.find(CreateDialogView).prop('acceptEnabled'));
196196
});
197+
198+
it('enables the accept button when user data loads', function() {
199+
const wrapper = shallow(buildApp({user: null}));
200+
wrapper.find(CreateDialogView).prop('repoName').setText('the-repo');
201+
wrapper.find(CreateDialogView).prop('localPath').setText(path.join('/local/path'));
202+
203+
assert.isFalse(wrapper.find(CreateDialogView).prop('acceptEnabled'));
204+
205+
wrapper.setProps({user: userBuilder(userQuery).build()});
206+
assert.isTrue(wrapper.find(CreateDialogView).prop('acceptEnabled'));
207+
208+
wrapper.setProps({});
209+
assert.isTrue(wrapper.find(CreateDialogView).prop('acceptEnabled'));
210+
});
197211
});
198212

199213
describe('acceptance', function() {

0 commit comments

Comments
 (0)