diff options
Diffstat (limited to 'spec/javascripts/diffs/components/diff_file_spec.js')
-rw-r--r-- | spec/javascripts/diffs/components/diff_file_spec.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/javascripts/diffs/components/diff_file_spec.js b/spec/javascripts/diffs/components/diff_file_spec.js index ba04c8c4a4c..d9b298e84da 100644 --- a/spec/javascripts/diffs/components/diff_file_spec.js +++ b/spec/javascripts/diffs/components/diff_file_spec.js @@ -109,6 +109,31 @@ describe('DiffFile', () => { done(); }); }); + + it('should update store state', done => { + spyOn(vm.$store, 'dispatch'); + + vm.isCollapsed = true; + + vm.$nextTick(() => { + expect(vm.$store.dispatch).toHaveBeenCalledWith('diffs/setFileCollapsed', { + filePath: vm.file.file_path, + collapsed: true, + }); + + done(); + }); + }); + + it('updates local state when changing file state', done => { + vm.file.viewer.collapsed = true; + + vm.$nextTick(() => { + expect(vm.isCollapsed).toBe(true); + + done(); + }); + }); }); }); |