diff options
Diffstat (limited to 'spec/javascripts')
3 files changed, 12 insertions, 5 deletions
diff --git a/spec/javascripts/ide/components/commit_sidebar/radio_group_spec.js b/spec/javascripts/ide/components/commit_sidebar/radio_group_spec.js index ffc2a4c9ddb..db1988be3e1 100644 --- a/spec/javascripts/ide/components/commit_sidebar/radio_group_spec.js +++ b/spec/javascripts/ide/components/commit_sidebar/radio_group_spec.js @@ -76,6 +76,7 @@ describe('IDE commit sidebar radio group', () => { const Component = Vue.extend(radioGroup); store.state.commit.commitAction = '1'; + store.state.commit.newBranchName = 'test-123'; vm = createComponentWithStore(Component, store, { value: '1', @@ -113,6 +114,12 @@ describe('IDE commit sidebar radio group', () => { done(); }); }); + + it('renders newBranchName if present', () => { + const input = vm.$el.querySelector('.form-control'); + + expect(input.value).toBe('test-123'); + }); }); describe('tooltipTitle', () => { diff --git a/spec/javascripts/ide/stores/modules/commit/actions_spec.js b/spec/javascripts/ide/stores/modules/commit/actions_spec.js index 06b8b452319..34d97347438 100644 --- a/spec/javascripts/ide/stores/modules/commit/actions_spec.js +++ b/spec/javascripts/ide/stores/modules/commit/actions_spec.js @@ -396,7 +396,7 @@ describe('IDE commit module actions', () => { .then(() => { expect(visitUrl).toHaveBeenCalledWith( `webUrl/merge_requests/new?merge_request[source_branch]=${ - store.getters['commit/newBranchName'] + store.getters['commit/placeholderBranchName'] }&merge_request[target_branch]=master`, ); diff --git a/spec/javascripts/ide/stores/modules/commit/getters_spec.js b/spec/javascripts/ide/stores/modules/commit/getters_spec.js index 3f4bf407a1f..702e78ef773 100644 --- a/spec/javascripts/ide/stores/modules/commit/getters_spec.js +++ b/spec/javascripts/ide/stores/modules/commit/getters_spec.js @@ -29,11 +29,11 @@ describe('IDE commit module getters', () => { }); }); - describe('newBranchName', () => { + describe('placeholderBranchName', () => { it('includes username, currentBranchId, patch & random number', () => { gon.current_username = 'username'; - const branch = getters.newBranchName(state, null, { + const branch = getters.placeholderBranchName(state, null, { currentBranchId: 'testing', }); @@ -46,7 +46,7 @@ describe('IDE commit module getters', () => { currentBranchId: 'master', }; const localGetters = { - newBranchName: 'newBranchName', + placeholderBranchName: 'newBranchName', }; beforeEach(() => { @@ -71,7 +71,7 @@ describe('IDE commit module getters', () => { expect(getters.branchName(state, localGetters, rootState)).toBe('state-newBranchName'); }); - it('uses getters newBranchName when state newBranchName is empty', () => { + it('uses placeholderBranchName when state newBranchName is empty', () => { Object.assign(state, { newBranchName: '', }); |