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
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/features/projects/branches_spec.rb2
-rw-r--r--spec/frontend/ci/pipeline_editor/components/header/pipeline_status_spec.js4
-rw-r--r--spec/frontend/commit/components/commit_box_pipeline_status_spec.js16
-rw-r--r--spec/frontend/repository/components/__snapshots__/last_commit_spec.js.snap2
-rw-r--r--spec/frontend/vue_shared/components/ci_badge_link_spec.js4
-rw-r--r--spec/helpers/ci/status_helper_spec.rb46
-rw-r--r--spec/lib/banzai/filter/references/reference_filter_spec.rb7
-rw-r--r--spec/views/projects/tags/index.html.haml_spec.rb8
8 files changed, 67 insertions, 22 deletions
diff --git a/spec/features/projects/branches_spec.rb b/spec/features/projects/branches_spec.rb
index 50df7bb7ca5..de805820de6 100644
--- a/spec/features/projects/branches_spec.rb
+++ b/spec/features/projects/branches_spec.rb
@@ -299,7 +299,7 @@ RSpec.describe 'Branches', feature_category: :groups_and_projects do
it 'shows pipeline status when available' do
page.within first('.all-branches li') do
- expect(page).to have_css 'a.ci-status-icon-success'
+ expect(page).to have_css 'a.gl-badge .ci-status-icon-success'
end
end
diff --git a/spec/frontend/ci/pipeline_editor/components/header/pipeline_status_spec.js b/spec/frontend/ci/pipeline_editor/components/header/pipeline_status_spec.js
index 1a2ed60a6f4..9bb0618b758 100644
--- a/spec/frontend/ci/pipeline_editor/components/header/pipeline_status_spec.js
+++ b/spec/frontend/ci/pipeline_editor/components/header/pipeline_status_spec.js
@@ -1,4 +1,4 @@
-import { GlIcon, GlLink, GlLoadingIcon, GlSprintf } from '@gitlab/ui';
+import { GlIcon, GlLoadingIcon, GlSprintf } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import Vue from 'vue';
import VueApollo from 'vue-apollo';
@@ -43,7 +43,7 @@ describe('Pipeline Status', () => {
},
projectFullPath: mockProjectFullPath,
},
- stubs: { GlLink, GlSprintf },
+ stubs: { GlSprintf },
});
};
diff --git a/spec/frontend/commit/components/commit_box_pipeline_status_spec.js b/spec/frontend/commit/components/commit_box_pipeline_status_spec.js
index 80b75a0a65e..844a2d81832 100644
--- a/spec/frontend/commit/components/commit_box_pipeline_status_spec.js
+++ b/spec/frontend/commit/components/commit_box_pipeline_status_spec.js
@@ -1,11 +1,11 @@
-import { GlLoadingIcon, GlLink } from '@gitlab/ui';
+import { GlLoadingIcon } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import Vue from 'vue';
import VueApollo from 'vue-apollo';
import createMockApollo from 'helpers/mock_apollo_helper';
import waitForPromises from 'helpers/wait_for_promises';
import { createAlert } from '~/alert';
-import CiIcon from '~/vue_shared/components/ci_icon.vue';
+import CiBadgeLink from '~/vue_shared/components/ci_badge_link.vue';
import CommitBoxPipelineStatus from '~/projects/commit_box/info/components/commit_box_pipeline_status.vue';
import {
COMMIT_BOX_POLL_INTERVAL,
@@ -32,8 +32,7 @@ describe('Commit box pipeline status', () => {
const failedHandler = jest.fn().mockRejectedValue(new Error('GraphQL error'));
const findLoadingIcon = () => wrapper.findComponent(GlLoadingIcon);
- const findStatusIcon = () => wrapper.findComponent(CiIcon);
- const findPipelineLink = () => wrapper.findComponent(GlLink);
+ const findCiBadgeLink = () => wrapper.findComponent(CiBadgeLink);
const advanceToNextFetch = () => {
jest.advanceTimersByTime(COMMIT_BOX_POLL_INTERVAL);
@@ -50,6 +49,9 @@ describe('Commit box pipeline status', () => {
provide: {
...mockProvide,
},
+ stubs: {
+ CiBadgeLink,
+ },
apolloProvider: createMockApolloProvider(handler),
});
};
@@ -59,7 +61,7 @@ describe('Commit box pipeline status', () => {
createComponent();
expect(findLoadingIcon().exists()).toBe(true);
- expect(findStatusIcon().exists()).toBe(false);
+ expect(findCiBadgeLink().exists()).toBe(false);
});
});
@@ -71,7 +73,7 @@ describe('Commit box pipeline status', () => {
});
it('should display pipeline status after the query is resolved successfully', () => {
- expect(findStatusIcon().exists()).toBe(true);
+ expect(findCiBadgeLink().exists()).toBe(true);
expect(findLoadingIcon().exists()).toBe(false);
expect(createAlert).toHaveBeenCalledTimes(0);
@@ -88,7 +90,7 @@ describe('Commit box pipeline status', () => {
},
} = mockPipelineStatusResponse;
- expect(findPipelineLink().attributes('href')).toBe(detailsPath);
+ expect(findCiBadgeLink().attributes('href')).toBe(detailsPath);
});
});
diff --git a/spec/frontend/repository/components/__snapshots__/last_commit_spec.js.snap b/spec/frontend/repository/components/__snapshots__/last_commit_spec.js.snap
index e48041c1032..208af4ba24a 100644
--- a/spec/frontend/repository/components/__snapshots__/last_commit_spec.js.snap
+++ b/spec/frontend/repository/components/__snapshots__/last_commit_spec.js.snap
@@ -14,7 +14,7 @@ exports[`Repository last commit component renders commit widget 1`] = `
aria-label="Pipeline: failed"
class="js-commit-pipeline"
details-path="https://test.com/pipeline"
- size="lg"
+ size="md"
status="[object Object]"
/>
</div>
diff --git a/spec/frontend/vue_shared/components/ci_badge_link_spec.js b/spec/frontend/vue_shared/components/ci_badge_link_spec.js
index fa42e87ec70..46fe5a0a74e 100644
--- a/spec/frontend/vue_shared/components/ci_badge_link_spec.js
+++ b/spec/frontend/vue_shared/components/ci_badge_link_spec.js
@@ -150,9 +150,9 @@ describe('CI Badge Link Component', () => {
expect(findBadge().props('size')).toBe('lg');
});
- it('should have class `gl-p-2!` when `showText` is false', () => {
+ it('should have class `gl-px-2` when `showText` is false', () => {
createComponent({ status: statuses.success, size: 'lg', showText: false });
- expect(findBadge().classes()).toContain('gl-p-2!');
+ expect(findBadge().classes()).toContain('gl-px-2');
});
});
diff --git a/spec/helpers/ci/status_helper_spec.rb b/spec/helpers/ci/status_helper_spec.rb
index 66c821df8f1..17fe474b360 100644
--- a/spec/helpers/ci/status_helper_spec.rb
+++ b/spec/helpers/ci/status_helper_spec.rb
@@ -55,10 +55,6 @@ RSpec.describe Ci::StatusHelper do
is_expected.to include("href=\"/commit-path\"")
end
- it "does not contain a span element" do
- is_expected.not_to include("<span")
- end
-
it "has 'Pipeline' as the status type in the title" do
is_expected.to include("title=\"Pipeline: passed\"")
end
@@ -88,7 +84,8 @@ RSpec.describe Ci::StatusHelper do
subject { helper.render_status_with_link("success", cssclass: "extra-class") }
it "has appended extra class to icon classes" do
- is_expected.to include("class=\"ci-status-link ci-status-icon-success d-inline-flex extra-class\"")
+ is_expected.to include('class="ci-status-link ci-status-icon-success d-inline-flex ' \
+ 'gl-line-height-1 extra-class"')
end
end
@@ -107,5 +104,44 @@ RSpec.describe Ci::StatusHelper do
is_expected.to include("<svg class=\"s24\"")
end
end
+
+ context "when status is success-with-warnings" do
+ subject { helper.render_status_with_link("success-with-warnings") }
+
+ it "renders warning variant of gl-badge" do
+ is_expected.to include('gl-badge badge badge-pill badge-warning')
+ end
+ end
+
+ context "when status is manual" do
+ subject { helper.render_status_with_link("manual") }
+
+ it "renders neutral variant of gl-badge" do
+ is_expected.to include('gl-badge badge badge-pill badge-neutral')
+ end
+ end
+ end
+
+ describe '#badge_variant' do
+ using RSpec::Parameterized::TableSyntax
+
+ where(:status, :expected_badge_variant_class) do
+ 'success' | 'badge-success'
+ 'success-with-warnings' | 'badge-warning'
+ 'pending' | 'badge-warning'
+ 'failed' | 'badge-danger'
+ 'running' | 'badge-info'
+ 'canceled' | 'badge-neutral'
+ 'manual' | 'badge-neutral'
+ 'other-status' | 'badge-muted'
+ end
+
+ with_them do
+ subject { helper.render_status_with_link(status) }
+
+ it 'uses the correct badge variant classes for gl-badge' do
+ is_expected.to include("gl-badge badge badge-pill #{expected_badge_variant_class}")
+ end
+ end
end
end
diff --git a/spec/lib/banzai/filter/references/reference_filter_spec.rb b/spec/lib/banzai/filter/references/reference_filter_spec.rb
index b55b8fd41fa..a2aa4a33ed7 100644
--- a/spec/lib/banzai/filter/references/reference_filter_spec.rb
+++ b/spec/lib/banzai/filter/references/reference_filter_spec.rb
@@ -34,6 +34,13 @@ RSpec.describe Banzai::Filter::References::ReferenceFilter, feature_category: :t
expect { |b| filter.each_node(&b) }.not_to yield_control
end
+
+ it 'skips text nodes in inline diff elements' do
+ document = Nokogiri::HTML.fragment('<span class="idiff">foo</span>')
+ filter = described_class.new(document, project: project)
+
+ expect { |b| filter.each_node(&b) }.not_to yield_control
+ end
end
describe '#nodes' do
diff --git a/spec/views/projects/tags/index.html.haml_spec.rb b/spec/views/projects/tags/index.html.haml_spec.rb
index dfa27afb72f..01e8d23fb9f 100644
--- a/spec/views/projects/tags/index.html.haml_spec.rb
+++ b/spec/views/projects/tags/index.html.haml_spec.rb
@@ -91,14 +91,14 @@ RSpec.describe 'projects/tags/index.html.haml' do
render
- expect(page.find('.tags .content-list li', text: tag)).to have_css 'a.ci-status-icon-success'
- expect(page.all('.tags .content-list li')).to all(have_css('svg.s24'))
+ expect(page.find('.tags .content-list li', text: tag)).to have_css '.gl-badge .ci-status-icon-success'
+ expect(page.all('.tags .content-list li')).to all(have_css('svg.s16'))
end
it 'shows no build status or placeholder when no pipelines present' do
render
- expect(page.all('.tags .content-list li')).not_to have_css 'svg.s24'
+ expect(page.all('.tags .content-list li')).not_to have_css 'svg.s16'
end
it 'shows no build status or placeholder when pipelines are private' do
@@ -107,7 +107,7 @@ RSpec.describe 'projects/tags/index.html.haml' do
render
- expect(page.all('.tags .content-list li')).not_to have_css 'svg.s24'
+ expect(page.all('.tags .content-list li')).not_to have_css 'svg.s16'
end
end