Skip to content
代码片段 群组 项目
提交 b201c1de 编辑于 作者: Vitaly Slobodin's avatar Vitaly Slobodin
浏览文件

Merge branch...

Merge branch '391107-fix-spec-violations-in-spec-frontend-vue_shared-components-file_row_spec-js' into 'master'

Fix spec violations in file_row_spec.js

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/112292



Merged-by: default avatarVitaly Slobodin <vslobodin@gitlab.com>
Approved-by: default avatarVitaly Slobodin <vslobodin@gitlab.com>
Co-authored-by: default avatarMartin Wortschack <mwortschack@gitlab.com>
No related branches found
No related tags found
无相关合并请求
...@@ -6,6 +6,9 @@ import FileIcon from '~/vue_shared/components/file_icon.vue'; ...@@ -6,6 +6,9 @@ import FileIcon from '~/vue_shared/components/file_icon.vue';
import FileRow from '~/vue_shared/components/file_row.vue'; import FileRow from '~/vue_shared/components/file_row.vue';
import FileHeader from '~/vue_shared/components/file_row_header.vue'; import FileHeader from '~/vue_shared/components/file_row_header.vue';
const scrollIntoViewMock = jest.fn();
HTMLElement.prototype.scrollIntoView = scrollIntoViewMock;
describe('File row component', () => { describe('File row component', () => {
let wrapper; let wrapper;
...@@ -72,11 +75,10 @@ describe('File row component', () => { ...@@ -72,11 +75,10 @@ describe('File row component', () => {
}, },
level: 0, level: 0,
}); });
jest.spyOn(wrapper.vm, '$emit');
wrapper.element.click(); wrapper.element.click();
expect(wrapper.vm.$emit).toHaveBeenCalledWith('toggleTreeOpen', fileName); expect(wrapper.emitted('toggleTreeOpen')[0][0]).toEqual(fileName);
}); });
it('calls scrollIntoView if made active', () => { it('calls scrollIntoView if made active', () => {
...@@ -89,14 +91,12 @@ describe('File row component', () => { ...@@ -89,14 +91,12 @@ describe('File row component', () => {
level: 0, level: 0,
}); });
jest.spyOn(wrapper.vm, 'scrollIntoView');
wrapper.setProps({ wrapper.setProps({
file: { ...wrapper.props('file'), active: true }, file: { ...wrapper.props('file'), active: true },
}); });
return nextTick().then(() => { return nextTick().then(() => {
expect(wrapper.vm.scrollIntoView).toHaveBeenCalled(); expect(scrollIntoViewMock).toHaveBeenCalled();
}); });
}); });
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册