diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2019-02-18 15:53:03 +0300 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2019-02-18 15:53:03 +0300 |
commit | fea813ab93b6f718b0469cbe5062112700df8a02 (patch) | |
tree | 022ec793c1dbdebf3f96a950cbcb8b1d2486bd84 /spec/javascripts/diffs | |
parent | 280fe56a3525ce9a64282e18353ea85307c1cdea (diff) | |
parent | d17de657fe782eb838545aabeee00285e181dce1 (diff) |
Merge branch 'diff-tree-resizable' into 'master'
Make the file tree in merge requests resizable
Closes #51857
See merge request gitlab-org/gitlab-ce!25097
Diffstat (limited to 'spec/javascripts/diffs')
-rw-r--r-- | spec/javascripts/diffs/components/app_spec.js | 26 | ||||
-rw-r--r-- | spec/javascripts/diffs/components/tree_list_spec.js | 12 |
2 files changed, 37 insertions, 1 deletions
diff --git a/spec/javascripts/diffs/components/app_spec.js b/spec/javascripts/diffs/components/app_spec.js index a2cbc0f3c72..5abdfe695d0 100644 --- a/spec/javascripts/diffs/components/app_spec.js +++ b/spec/javascripts/diffs/components/app_spec.js @@ -68,6 +68,32 @@ describe('diffs/components/app', () => { }); }); + describe('resizable', () => { + afterEach(() => { + localStorage.removeItem('mr_tree_list_width'); + }); + + it('sets initial width when no localStorage has been set', () => { + createComponent(); + + expect(vm.vm.treeWidth).toEqual(320); + }); + + it('sets initial width to localStorage size', () => { + localStorage.setItem('mr_tree_list_width', '200'); + + createComponent(); + + expect(vm.vm.treeWidth).toEqual(200); + }); + + it('sets width of tree list', () => { + createComponent(); + + expect(vm.find('.js-diff-tree-list').element.style.width).toEqual('320px'); + }); + }); + describe('empty state', () => { it('renders empty state when no diff files exist', () => { createComponent(); diff --git a/spec/javascripts/diffs/components/tree_list_spec.js b/spec/javascripts/diffs/components/tree_list_spec.js index 9e556698f34..cd7bf6405e5 100644 --- a/spec/javascripts/diffs/components/tree_list_spec.js +++ b/spec/javascripts/diffs/components/tree_list_spec.js @@ -28,7 +28,7 @@ describe('Diffs tree list component', () => { localStorage.removeItem('mr_diff_tree_list'); - vm = mountComponentWithStore(Component, { store }); + vm = mountComponentWithStore(Component, { store, props: { hideFileStats: false } }); }); afterEach(() => { @@ -77,6 +77,16 @@ describe('Diffs tree list component', () => { expect(vm.$el.querySelectorAll('.file-row')[1].textContent).toContain('app'); }); + it('hides file stats', done => { + vm.hideFileStats = true; + + vm.$nextTick(() => { + expect(vm.$el.querySelector('.file-row-stats')).toBe(null); + + done(); + }); + }); + it('calls toggleTreeOpen when clicking folder', () => { spyOn(vm.$store, 'dispatch').and.stub(); |