Skip to content
代码片段 群组 项目
未验证 提交 2b079068 编辑于 作者: Ezekiel Kigbo's avatar Ezekiel Kigbo 提交者: GitLab
浏览文件

Merge branch 'move-target-blank-test-non-dynamic' into 'master'

No related branches found
No related tags found
无相关合并请求
......@@ -381,6 +381,7 @@ describe('ee/security_dashboard/components/shared/vulnerability_details_graphql/
describe('with location data', () => {
const findFileLocation = () => wrapper.findByTestId('location-file-list-item');
const findFileLink = () => findFileLocation().findComponent(GlLink);
const TEST_LOCATION = {
file: 'index.js',
......@@ -408,7 +409,7 @@ describe('ee/security_dashboard/components/shared/vulnerability_details_graphql/
it('renders the file name as text', () => {
expect(findFileLocation().text()).toContain('index.js');
expect(findFileLocation().findComponent(GlLink).exists()).toBe(false);
expect(findFileLink().exists()).toBe(false);
});
it.each`
......@@ -432,6 +433,20 @@ describe('ee/security_dashboard/components/shared/vulnerability_details_graphql/
});
describe('with a blob path', () => {
it('opens file in a new tab', () => {
createComponent({
propsData: {
...TEST_VULNERABILITY,
location: {
file: 'index.js',
blobPath: 'index.js',
},
},
});
expect(findFileLink().attributes('target')).toBe('_blank');
});
it('does not append a line range when line numbers are not present', () => {
createComponent({
propsData: {
......@@ -461,9 +476,7 @@ describe('ee/security_dashboard/components/shared/vulnerability_details_graphql/
},
});
const fileLink = findFileLocation().findComponent(GlLink);
expect(fileLink.attributes('href')).toBe(blobPath);
expect(findFileLink().attributes('href')).toBe(blobPath);
});
it.each`
......@@ -490,11 +503,10 @@ describe('ee/security_dashboard/components/shared/vulnerability_details_graphql/
});
const { blobPath, file } = location;
const fileLink = findFileLocation().findComponent(GlLink);
const fileLink = findFileLink();
expect(fileLink.attributes('href')).toBe(`${blobPath}#L${expectedLineRange}`);
expect(fileLink.text()).toBe(`${file}:${expectedLineRange}`);
expect(fileLink.attributes('target')).toBe('_blank');
},
);
});
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册