diff options
author | Phil Hughes <me@iamphill.com> | 2018-10-15 12:02:40 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-10-15 12:02:40 +0300 |
commit | ff55aa7ebb8a54e5dceee845904a8c75b46b3f1b (patch) | |
tree | 08043dbad20b1742f79089825fdbdc23a3120d11 /spec | |
parent | 05dd7f9718cdd74cfd20747e4bea534a1cba2ae1 (diff) |
Fixed file templates not clearing in Web IDE
This fixes a bug where the file templates would not be cleared
after changing the template type.
Previously the templates would get pushed into the array
creating a list of templates for the different types.
This changes that by clearing the templates array
when the template type gets changed.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/52487
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/ide/stores/modules/file_templates/mutations_spec.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/javascripts/ide/stores/modules/file_templates/mutations_spec.js b/spec/javascripts/ide/stores/modules/file_templates/mutations_spec.js index a51527d699f..8e0e3ae99a1 100644 --- a/spec/javascripts/ide/stores/modules/file_templates/mutations_spec.js +++ b/spec/javascripts/ide/stores/modules/file_templates/mutations_spec.js @@ -49,6 +49,14 @@ describe('IDE file templates mutations', () => { expect(state.selectedTemplateType).toBe('type'); }); + + it('clears templates', () => { + state.templates = ['test']; + + mutations[types.SET_SELECTED_TEMPLATE_TYPE](state, 'type'); + + expect(state.templates).toEqual([]); + }); }); describe(types.SET_UPDATE_SUCCESS, () => { |