Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-12-08 18:09:45 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-12-08 18:09:45 +0300
commit4f0f7d580907e598013ad4b445db60ceacaa4724 (patch)
tree96f8b3224f962ff7011611cfdfa65bdbe079c5cd /spec/frontend/jobs
parent148b75b329294f6b6ae409bbf8d70590e63c6bc9 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/jobs')
-rw-r--r--spec/frontend/jobs/components/log/line_spec.js81
1 files changed, 22 insertions, 59 deletions
diff --git a/spec/frontend/jobs/components/log/line_spec.js b/spec/frontend/jobs/components/log/line_spec.js
index 354bc62de29..914ae2424c8 100644
--- a/spec/frontend/jobs/components/log/line_spec.js
+++ b/spec/frontend/jobs/components/log/line_spec.js
@@ -22,7 +22,6 @@ const mockProps = ({ text = 'Running with gitlab-runner 12.1.0 (de7731dd)' } = {
describe('Job Log Line', () => {
let wrapper;
let data;
- let originalGon;
const createComponent = (props = {}) => {
wrapper = shallowMount(Line, {
@@ -41,19 +40,10 @@ describe('Job Log Line', () => {
.attributes();
beforeEach(() => {
- originalGon = window.gon;
- window.gon.features = {
- ciJobLineLinks: false,
- };
-
data = mockProps();
createComponent(data);
});
- afterEach(() => {
- window.gon = originalGon;
- });
-
it('renders the line number component', () => {
expect(wrapper.find(LineNumber).exists()).toBe(true);
});
@@ -66,44 +56,7 @@ describe('Job Log Line', () => {
expect(findLine().classes()).toContain(data.line.content[0].style);
});
- describe.each([true, false])('when feature ci_job_line_links enabled = %p', ciJobLineLinks => {
- beforeEach(() => {
- window.gon.features = {
- ciJobLineLinks,
- };
- });
-
- it('renders text with symbols', () => {
- const text = 'apt-get update < /dev/null > /dev/null';
- createComponent(mockProps({ text }));
-
- expect(findLine().text()).toBe(text);
- });
-
- it.each`
- tag | text
- ${'a'} | ${'<a href="#">linked</a>'}
- ${'script'} | ${'<script>doEvil();</script>'}
- ${'strong'} | ${'<strong>highlighted</strong>'}
- `('escapes `<$tag>` tags in text', ({ tag, text }) => {
- createComponent(mockProps({ text }));
-
- expect(
- findLine()
- .find(tag)
- .exists(),
- ).toBe(false);
- expect(findLine().text()).toBe(text);
- });
- });
-
- describe('when ci_job_line_links is enabled', () => {
- beforeEach(() => {
- window.gon.features = {
- ciJobLineLinks: true,
- };
- });
-
+ describe('job urls as links', () => {
it('renders an http link', () => {
createComponent(mockProps({ text: httpUrl }));
@@ -130,21 +83,21 @@ describe('Job Log Line', () => {
expect(findLink().classes()).toEqual(['gl-reset-color!', 'gl-text-decoration-underline']);
});
- it('renders a links with queries, surrounded by questions marks', () => {
+ it('renders links with queries, surrounded by questions marks', () => {
createComponent(mockProps({ text: `Did you see my url ${queryUrl}??` }));
expect(findLine().text()).toBe('Did you see my url https://example.com?param=val??');
expect(findLinkAttributeByIndex(0).href).toBe(queryUrl);
});
- it('renders a links with queries, surrounded by exclamation marks', () => {
+ it('renders links with queries, surrounded by exclamation marks', () => {
createComponent(mockProps({ text: `No! The ${queryUrl}!?` }));
expect(findLine().text()).toBe('No! The https://example.com?param=val!?');
expect(findLinkAttributeByIndex(0).href).toBe(queryUrl);
});
- it('renders a multiple links surrounded by text', () => {
+ it('renders multiple links surrounded by text', () => {
createComponent(
mockProps({ text: `Well, my HTTP url: ${httpUrl} and my HTTPS url: ${httpsUrl}` }),
);
@@ -158,7 +111,7 @@ describe('Job Log Line', () => {
expect(findLinkAttributeByIndex(1).href).toBe(httpsUrl);
});
- it('renders a multiple links surrounded by text, with other symbols', () => {
+ it('renders multiple links surrounded by text, with other symbols', () => {
createComponent(
mockProps({ text: `${httpUrl}, ${httpUrl}: ${httpsUrl}; ${httpsUrl}. ${httpsUrl}...` }),
);
@@ -175,15 +128,25 @@ describe('Job Log Line', () => {
expect(findLinkAttributeByIndex(4).href).toBe(httpsUrl);
});
+ it('renders text with symbols in it', () => {
+ const text = 'apt-get update < /dev/null > /dev/null';
+ createComponent(mockProps({ text }));
+
+ expect(findLine().text()).toBe(text);
+ });
+
const jshref = 'javascript:doEvil();'; // eslint-disable-line no-script-url
- test.each`
- type | text
- ${'js'} | ${jshref}
- ${'file'} | ${'file:///a-file'}
- ${'ftp'} | ${'ftp://example.com/file'}
- ${'email'} | ${'email@example.com'}
- ${'no scheme'} | ${'example.com/page'}
+ it.each`
+ type | text
+ ${'html link'} | ${'<a href="#">linked</a>'}
+ ${'html script'} | ${'<script>doEvil();</script>'}
+ ${'html strong'} | ${'<strong>highlighted</strong>'}
+ ${'js'} | ${jshref}
+ ${'file'} | ${'file:///a-file'}
+ ${'ftp'} | ${'ftp://example.com/file'}
+ ${'email'} | ${'email@example.com'}
+ ${'no scheme'} | ${'example.com/page'}
`('does not render a $type link', ({ text }) => {
createComponent(mockProps({ text }));
expect(findLink().exists()).toBe(false);