Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
f0fc9fc715
commit
51da0a2d39
|
|
@ -60,15 +60,15 @@ export default {
|
|||
{
|
||||
key: 'severity',
|
||||
label: s__('AlertManagement|Severity'),
|
||||
tdClass: `${tdClass} rounded-top text-capitalize`,
|
||||
thClass: `${thClass} gl-w-eighth`,
|
||||
tdClass: `${tdClass} rounded-top text-capitalize sortable-cell`,
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
key: 'startedAt',
|
||||
label: s__('AlertManagement|Start time'),
|
||||
thClass: `${thClass} js-started-at w-15p`,
|
||||
tdClass,
|
||||
tdClass: `${tdClass} sortable-cell`,
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
|
|
@ -81,7 +81,7 @@ export default {
|
|||
key: 'eventCount',
|
||||
label: s__('AlertManagement|Events'),
|
||||
thClass: `${thClass} text-right gl-w-12`,
|
||||
tdClass: `${tdClass} text-md-right`,
|
||||
tdClass: `${tdClass} text-md-right sortable-cell`,
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
|
|
@ -89,7 +89,6 @@ export default {
|
|||
label: s__('AlertManagement|Issue'),
|
||||
thClass: 'gl-w-12 gl-pointer-events-none',
|
||||
tdClass,
|
||||
sortable: false,
|
||||
},
|
||||
{
|
||||
key: 'assignees',
|
||||
|
|
@ -99,9 +98,9 @@ export default {
|
|||
},
|
||||
{
|
||||
key: 'status',
|
||||
thClass: `${thClass} w-15p`,
|
||||
label: s__('AlertManagement|Status'),
|
||||
tdClass: `${tdClass} rounded-bottom`,
|
||||
thClass: `${thClass} w-15p`,
|
||||
tdClass: `${tdClass} rounded-bottom sortable-cell`,
|
||||
sortable: true,
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -107,6 +107,9 @@ export default {
|
|||
},
|
||||
mounted() {
|
||||
this.toggleOnPasteListener(this.$route.name);
|
||||
if (this.$route.path === '/designs') {
|
||||
this.$el.scrollIntoView();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
resetFilesToBeSaved() {
|
||||
|
|
@ -274,7 +277,7 @@ export default {
|
|||
<span class="gl-font-weight-bold gl-mr-3">{{ s__('DesignManagement|Designs') }}</span>
|
||||
<design-version-dropdown />
|
||||
</div>
|
||||
<div v-show="hasDesigns" class="qa-selector-toolbar gl-display-flex">
|
||||
<div v-show="hasDesigns" class="qa-selector-toolbar gl-display-flex gl-align-items-center">
|
||||
<gl-button
|
||||
v-if="isLatestVersion"
|
||||
variant="link"
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ export const buildUneditableCloseTokens = (token, tagType = TAG_TYPES.block) =>
|
|||
|
||||
export const buildTextToken = content => buildToken('text', null, { content });
|
||||
|
||||
export const buildUneditableTokens = token => {
|
||||
export const buildUneditableBlockTokens = token => {
|
||||
return [...buildUneditableOpenTokens(token), buildUneditableCloseToken()];
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { buildUneditableTokens } from './build_uneditable_token';
|
||||
import { renderUneditableLeaf as render } from './render_utils';
|
||||
|
||||
const embeddedRubyRegex = /(^<%.+%>$)/;
|
||||
|
||||
|
|
@ -6,8 +6,4 @@ const canRender = ({ literal }) => {
|
|||
return embeddedRubyRegex.test(literal);
|
||||
};
|
||||
|
||||
const render = (_, { origin }) => {
|
||||
return buildUneditableTokens(origin());
|
||||
};
|
||||
|
||||
export default { canRender, render };
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { buildUneditableOpenTokens, buildUneditableCloseToken } from './build_uneditable_token';
|
||||
import { renderUneditableBranch as render } from './render_utils';
|
||||
|
||||
const identifierRegex = /(^\[.+\]: .+)/;
|
||||
|
||||
|
|
@ -10,7 +10,4 @@ const canRender = (node, context) => {
|
|||
return isIdentifier(context.getChildrenText(node));
|
||||
};
|
||||
|
||||
const render = (_, { entering, origin }) =>
|
||||
entering ? buildUneditableOpenTokens(origin()) : buildUneditableCloseToken();
|
||||
|
||||
export default { canRender, render };
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { buildUneditableOpenTokens, buildUneditableCloseToken } from './build_uneditable_token';
|
||||
import { renderUneditableBranch as render } from './render_utils';
|
||||
|
||||
const isKramdownTOC = ({ type, literal }) => type === 'text' && literal === 'TOC';
|
||||
|
||||
|
|
@ -21,7 +21,4 @@ const canRender = node => {
|
|||
return false;
|
||||
};
|
||||
|
||||
const render = (_, { entering, origin }) =>
|
||||
entering ? buildUneditableOpenTokens(origin()) : buildUneditableCloseToken();
|
||||
|
||||
export default { canRender, render };
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { buildUneditableTokens } from './build_uneditable_token';
|
||||
import { renderUneditableLeaf as render } from './render_utils';
|
||||
|
||||
const kramdownRegex = /(^{:.+}$)/;
|
||||
|
||||
|
|
@ -6,8 +6,4 @@ const canRender = ({ literal }) => {
|
|||
return kramdownRegex.test(literal);
|
||||
};
|
||||
|
||||
const render = (_, { origin }) => {
|
||||
return buildUneditableTokens(origin());
|
||||
};
|
||||
|
||||
export default { canRender, render };
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
import {
|
||||
buildUneditableBlockTokens,
|
||||
buildUneditableOpenTokens,
|
||||
buildUneditableCloseToken,
|
||||
} from './build_uneditable_token';
|
||||
|
||||
export const renderUneditableLeaf = (_, { origin }) => buildUneditableBlockTokens(origin());
|
||||
|
||||
export const renderUneditableBranch = (_, { entering, origin }) =>
|
||||
entering ? buildUneditableOpenTokens(origin()) : buildUneditableCloseToken();
|
||||
|
|
@ -14,12 +14,15 @@
|
|||
|
||||
td,
|
||||
th {
|
||||
@include gl-pl-9;
|
||||
@include gl-py-5;
|
||||
@include gl-outline-none;
|
||||
@include gl-relative;
|
||||
}
|
||||
|
||||
.sortable-cell {
|
||||
padding-left: calc(0.75rem + 0.65em);
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: transparent;
|
||||
font-weight: $gl-font-weight-bold;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
- page_title _('Request details')
|
||||
%h3.page-title
|
||||
Request details
|
||||
= _("Request details")
|
||||
|
||||
%hr
|
||||
|
||||
= link_to 'Resend Request', retry_admin_hook_hook_log_path(@hook, @hook_log), method: :post, class: "btn btn-default float-right gl-ml-3"
|
||||
= link_to _("Resend Request"), retry_admin_hook_hook_log_path(@hook, @hook_log), method: :post, class: "btn btn-default float-right gl-ml-3"
|
||||
|
||||
= render partial: 'shared/hook_logs/content', locals: { hook_log: @hook_log }
|
||||
|
|
|
|||
|
|
@ -1,15 +1,14 @@
|
|||
%h3.page-title Authorization required
|
||||
%h3.page-title
|
||||
= _("Authorization required")
|
||||
%main{ :role => "main" }
|
||||
%p.h4
|
||||
Authorize
|
||||
%strong.text-info= @chat_name_params[:chat_name]
|
||||
to use your account?
|
||||
= _("Authorize <strong>%{user}</strong> to use your account?").html_safe % { user: @chat_name_params[:chat_name] }
|
||||
|
||||
%hr
|
||||
.actions
|
||||
= form_tag profile_chat_names_path, method: :post do
|
||||
= hidden_field_tag :token, @chat_name_token.token
|
||||
= submit_tag "Authorize", class: "btn btn-success wide float-left"
|
||||
= submit_tag _("Authorize"), class: "btn btn-success wide float-left"
|
||||
= form_tag deny_profile_chat_names_path, method: :delete do
|
||||
= hidden_field_tag :token, @chat_name_token.token
|
||||
= submit_tag "Deny", class: "btn btn-danger gl-ml-3"
|
||||
= submit_tag _("Deny"), class: "btn btn-danger gl-ml-3"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Resolve Anchor tags to Designs is not working
|
||||
merge_request: 37307
|
||||
author:
|
||||
type: fixed
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Alert management list spacing
|
||||
merge_request: 37320
|
||||
author:
|
||||
type: fixed
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Fix vertical alignment of design management toolbar buttons
|
||||
merge_request: 37398
|
||||
author:
|
||||
type: fixed
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class CreateVulnerabilityHistoricalStatistics < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
INDEX_NAME = 'index_vuln_historical_statistics_on_project_id_and_date'
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
def up
|
||||
with_lock_retries do
|
||||
create_table :vulnerability_historical_statistics do |t|
|
||||
t.timestamps_with_timezone null: false
|
||||
t.references :project, null: false, index: false, foreign_key: { on_delete: :cascade }
|
||||
t.integer :total, default: 0, null: false
|
||||
t.integer :critical, default: 0, null: false
|
||||
t.integer :high, default: 0, null: false
|
||||
t.integer :medium, default: 0, null: false
|
||||
t.integer :low, default: 0, null: false
|
||||
t.integer :unknown, default: 0, null: false
|
||||
t.integer :info, default: 0, null: false
|
||||
t.date :date, null: false
|
||||
t.integer :letter_grade, limit: 1, null: false
|
||||
t.index [:project_id, :date], unique: true, name: INDEX_NAME
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
with_lock_retries do
|
||||
drop_table :vulnerability_historical_statistics
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -16117,6 +16117,31 @@ CREATE SEQUENCE public.vulnerability_feedback_id_seq
|
|||
|
||||
ALTER SEQUENCE public.vulnerability_feedback_id_seq OWNED BY public.vulnerability_feedback.id;
|
||||
|
||||
CREATE TABLE public.vulnerability_historical_statistics (
|
||||
id bigint NOT NULL,
|
||||
created_at timestamp with time zone NOT NULL,
|
||||
updated_at timestamp with time zone NOT NULL,
|
||||
project_id bigint NOT NULL,
|
||||
total integer DEFAULT 0 NOT NULL,
|
||||
critical integer DEFAULT 0 NOT NULL,
|
||||
high integer DEFAULT 0 NOT NULL,
|
||||
medium integer DEFAULT 0 NOT NULL,
|
||||
low integer DEFAULT 0 NOT NULL,
|
||||
unknown integer DEFAULT 0 NOT NULL,
|
||||
info integer DEFAULT 0 NOT NULL,
|
||||
date date NOT NULL,
|
||||
letter_grade smallint NOT NULL
|
||||
);
|
||||
|
||||
CREATE SEQUENCE public.vulnerability_historical_statistics_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
ALTER SEQUENCE public.vulnerability_historical_statistics_id_seq OWNED BY public.vulnerability_historical_statistics.id;
|
||||
|
||||
CREATE TABLE public.vulnerability_identifiers (
|
||||
id bigint NOT NULL,
|
||||
created_at timestamp with time zone NOT NULL,
|
||||
|
|
@ -17112,6 +17137,8 @@ ALTER TABLE ONLY public.vulnerability_exports ALTER COLUMN id SET DEFAULT nextva
|
|||
|
||||
ALTER TABLE ONLY public.vulnerability_feedback ALTER COLUMN id SET DEFAULT nextval('public.vulnerability_feedback_id_seq'::regclass);
|
||||
|
||||
ALTER TABLE ONLY public.vulnerability_historical_statistics ALTER COLUMN id SET DEFAULT nextval('public.vulnerability_historical_statistics_id_seq'::regclass);
|
||||
|
||||
ALTER TABLE ONLY public.vulnerability_identifiers ALTER COLUMN id SET DEFAULT nextval('public.vulnerability_identifiers_id_seq'::regclass);
|
||||
|
||||
ALTER TABLE ONLY public.vulnerability_issue_links ALTER COLUMN id SET DEFAULT nextval('public.vulnerability_issue_links_id_seq'::regclass);
|
||||
|
|
@ -18388,6 +18415,9 @@ ALTER TABLE ONLY public.vulnerability_exports
|
|||
ALTER TABLE ONLY public.vulnerability_feedback
|
||||
ADD CONSTRAINT vulnerability_feedback_pkey PRIMARY KEY (id);
|
||||
|
||||
ALTER TABLE ONLY public.vulnerability_historical_statistics
|
||||
ADD CONSTRAINT vulnerability_historical_statistics_pkey PRIMARY KEY (id);
|
||||
|
||||
ALTER TABLE ONLY public.vulnerability_identifiers
|
||||
ADD CONSTRAINT vulnerability_identifiers_pkey PRIMARY KEY (id);
|
||||
|
||||
|
|
@ -20589,6 +20619,8 @@ CREATE INDEX index_users_star_projects_on_project_id ON public.users_star_projec
|
|||
|
||||
CREATE UNIQUE INDEX index_users_star_projects_on_user_id_and_project_id ON public.users_star_projects USING btree (user_id, project_id);
|
||||
|
||||
CREATE UNIQUE INDEX index_vuln_historical_statistics_on_project_id_and_date ON public.vulnerability_historical_statistics USING btree (project_id, date);
|
||||
|
||||
CREATE INDEX index_vulnerabilities_on_author_id ON public.vulnerabilities USING btree (author_id);
|
||||
|
||||
CREATE INDEX index_vulnerabilities_on_confirmed_by_id ON public.vulnerabilities USING btree (confirmed_by_id);
|
||||
|
|
@ -22159,6 +22191,9 @@ ALTER TABLE ONLY public.list_user_preferences
|
|||
ALTER TABLE ONLY public.project_custom_attributes
|
||||
ADD CONSTRAINT fk_rails_719c3dccc5 FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE ONLY public.vulnerability_historical_statistics
|
||||
ADD CONSTRAINT fk_rails_72b73ed023 FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE ONLY public.slack_integrations
|
||||
ADD CONSTRAINT fk_rails_73db19721a FOREIGN KEY (service_id) REFERENCES public.services(id) ON DELETE CASCADE;
|
||||
|
||||
|
|
@ -23945,6 +23980,7 @@ COPY "schema_migrations" (version) FROM STDIN;
|
|||
20200713071042
|
||||
20200713141854
|
||||
20200713152443
|
||||
20200715135130
|
||||
20200715202659
|
||||
20200716044023
|
||||
20200716120419
|
||||
|
|
|
|||
|
|
@ -42,4 +42,3 @@ swap:
|
|||
where's: where is
|
||||
who's: who is
|
||||
why's: why is
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ ignorecase: true
|
|||
level: warning
|
||||
link: https://docs.gitlab.com/ee/development/documentation/styleguide.html#language-to-avoid
|
||||
raw:
|
||||
- "(going to( |\n|[[:punct:]])[a-zA-Z]*|"
|
||||
- "will( |\n|[[:punct:]])[a-zA-Z]*|"
|
||||
- "won't( |\n|[[:punct:]])[a-zA-Z]*|"
|
||||
- "[a-zA-Z]*'ll( |\n|[[:punct:]])[a-zA-Z]*)"
|
||||
- "(going to( |\n|[[:punct:]])[a-zA-Z]*|"
|
||||
- "will( |\n|[[:punct:]])[a-zA-Z]*|"
|
||||
- "won't( |\n|[[:punct:]])[a-zA-Z]*|"
|
||||
- "[a-zA-Z]*'ll( |\n|[[:punct:]])[a-zA-Z]*)"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
# Checks for references to versions of GitLab that are no longer supported.
|
||||
#
|
||||
# For a list of all options, see https://errata-ai.github.io/vale/styles/
|
||||
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
|
||||
extends: existence
|
||||
message: 'Can this reference to "%s" be refactored?'
|
||||
link: https://docs.gitlab.com/ee/development/documentation/styleguide.html#importance-of-referencing-gitlab-versions-and-tiers
|
||||
|
|
|
|||
|
|
@ -884,7 +884,8 @@ They reflect configuration defined for this instance of Praefect.
|
|||
|
||||
## Strong consistency
|
||||
|
||||
> Introduced in GitLab 13.1 in [alpha](https://about.gitlab.com/handbook/product/#alpha-beta-ga), disabled by default.
|
||||
> - Introduced in GitLab 13.1 in [alpha](https://about.gitlab.com/handbook/product/#alpha-beta-ga), disabled by default.
|
||||
> - Entered [beta](https://about.gitlab.com/handbook/product/#alpha-beta-ga) in GitLab 13.2, disabled by default.
|
||||
|
||||
Praefect guarantees eventual consistency by replicating all writes to secondary nodes
|
||||
after the write to the primary Gitaly node has happened.
|
||||
|
|
|
|||
|
|
@ -383,3 +383,47 @@ production_plan:
|
|||
artifacts:
|
||||
name: Production
|
||||
```
|
||||
|
||||
## Using a GitLab managed Terraform state backend as a remote data source
|
||||
|
||||
You can use a GitLab-managed Terraform state as a
|
||||
[Terraform data source](https://www.terraform.io/docs/providers/terraform/d/remote_state.html).
|
||||
To use your existing Terraform state backend as a data source, provide the following details
|
||||
as [Terraform input variables](https://www.terraform.io/docs/configuration/variables.html):
|
||||
|
||||
- **address**: The URL of the remote state backend you want to use as a data source.
|
||||
For example, `https://gitlab.com/api/v4/projects/<TARGET-PROJECT-ID>/terraform/state/<TARGET-STATE-NAME>`.
|
||||
- **username**: The username to authenticate with the data source. If you are using a [Personal Access Token](../profile/personal_access_tokens.md) for
|
||||
authentication, this is your GitLab username. If you are using GitLab CI, this is `'gitlab-ci-token'`.
|
||||
- **password**: The password to authenticate with the data source. If you are using a Personal Access Token for
|
||||
authentication, this is the token value. If you are using GitLab CI, it is the contents of the `${CI_JOB_TOKEN}` CI variable.
|
||||
|
||||
An example setup is shown below:
|
||||
|
||||
1. Create a file named `example.auto.tfvars` with the following contents:
|
||||
|
||||
```plaintext
|
||||
example_remote_state_address=https://gitlab.com/api/v4/projects/<TARGET-PROJECT-ID>/terraform/state/<TARGET-STATE-NAME>
|
||||
example_username=<GitLab username>
|
||||
example_access_token=<GitLab Personal Acceess Token>
|
||||
```
|
||||
|
||||
1. Define the data source by adding the following code block in a `.tf` file (such as `data.tf`):
|
||||
|
||||
```hcl
|
||||
data "terraform_remote_state" "example" {
|
||||
backend = "http"
|
||||
|
||||
config = {
|
||||
address = var.example_remote_state_address
|
||||
username = var.example_username
|
||||
password = var.example_access_token
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Outputs from the data source can now be referenced within your Terraform resources
|
||||
using `data.terraform_remote_state.example.outputs.<OUTPUT-NAME>`.
|
||||
|
||||
You need at least [developer access](../permissions.md) to the target project
|
||||
to read the Terraform state.
|
||||
|
|
|
|||
|
|
@ -3429,6 +3429,9 @@ msgstr ""
|
|||
msgid "Authorization key"
|
||||
msgstr ""
|
||||
|
||||
msgid "Authorization required"
|
||||
msgstr ""
|
||||
|
||||
msgid "Authorization was granted by entering your username and password in the application."
|
||||
msgstr ""
|
||||
|
||||
|
|
@ -3438,6 +3441,9 @@ msgstr ""
|
|||
msgid "Authorize %{link_to_client} to use your account?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Authorize <strong>%{user}</strong> to use your account?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Authorize external services to send alerts to GitLab"
|
||||
msgstr ""
|
||||
|
||||
|
|
@ -20114,6 +20120,9 @@ msgstr[1] ""
|
|||
msgid "Requires values to meet regular expression requirements."
|
||||
msgstr ""
|
||||
|
||||
msgid "Resend Request"
|
||||
msgstr ""
|
||||
|
||||
msgid "Resend confirmation email"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ exports[`Design management index page designs renders designs list and header wi
|
|||
</div>
|
||||
|
||||
<div
|
||||
class="qa-selector-toolbar gl-display-flex"
|
||||
class="qa-selector-toolbar gl-display-flex gl-align-items-center"
|
||||
>
|
||||
<gl-button-stub
|
||||
category="tertiary"
|
||||
|
|
|
|||
|
|
@ -25,6 +25,9 @@ const mockPageEl = {
|
|||
};
|
||||
jest.spyOn(utils, 'getPageLayoutElement').mockReturnValue(mockPageEl);
|
||||
|
||||
const scrollIntoViewMock = jest.fn();
|
||||
HTMLElement.prototype.scrollIntoView = scrollIntoViewMock;
|
||||
|
||||
const localVue = createLocalVue();
|
||||
const router = createRouter();
|
||||
localVue.use(VueRouter);
|
||||
|
|
@ -567,5 +570,14 @@ describe('Design management index page', () => {
|
|||
expect(mockPageEl.classList.remove).toHaveBeenCalledTimes(1);
|
||||
expect(mockPageEl.classList.remove).toHaveBeenCalledWith(...DESIGN_DETAIL_LAYOUT_CLASSLIST);
|
||||
});
|
||||
|
||||
it('should trigger a scrollIntoView method if designs route is detected', () => {
|
||||
router.replace({
|
||||
path: '/designs',
|
||||
});
|
||||
createComponent(true);
|
||||
|
||||
expect(scrollIntoViewMock).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import {
|
|||
buildUneditableOpenTokens,
|
||||
buildUneditableCloseToken,
|
||||
buildUneditableCloseTokens,
|
||||
buildUneditableTokens,
|
||||
buildUneditableBlockTokens,
|
||||
buildUneditableInlineTokens,
|
||||
buildUneditableHtmlAsTextTokens,
|
||||
} from '~/vue_shared/components/rich_content_editor/services/renderers/build_uneditable_token';
|
||||
|
|
@ -51,9 +51,9 @@ describe('Build Uneditable Token renderer helper', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('buildUneditableTokens', () => {
|
||||
describe('buildUneditableBlockTokens', () => {
|
||||
it('returns a 3-item array of tokens with the originToken wrapped in the middle of block tokens', () => {
|
||||
const result = buildUneditableTokens(originToken);
|
||||
const result = buildUneditableBlockTokens(originToken);
|
||||
|
||||
expect(result).toHaveLength(3);
|
||||
expect(result).toStrictEqual(uneditableTokens);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import renderer from '~/vue_shared/components/rich_content_editor/services/renderers/render_embedded_ruby_text';
|
||||
import { buildUneditableTokens } from '~/vue_shared/components/rich_content_editor/services/renderers/build_uneditable_token';
|
||||
import { renderUneditableLeaf } from '~/vue_shared/components/rich_content_editor/services/renderers/render_utils';
|
||||
|
||||
import { buildMockTextNode, normalTextNode } from './mock_data';
|
||||
|
||||
|
|
@ -17,14 +17,8 @@ describe('Render Embedded Ruby Text renderer', () => {
|
|||
});
|
||||
|
||||
describe('render', () => {
|
||||
const origin = jest.fn();
|
||||
|
||||
it('should return uneditable tokens', () => {
|
||||
const context = { origin };
|
||||
|
||||
expect(renderer.render(embeddedRubyTextNode, context)).toStrictEqual(
|
||||
buildUneditableTokens(origin()),
|
||||
);
|
||||
it('should delegate rendering to the renderUneditableLeaf util', () => {
|
||||
expect(renderer.render).toBe(renderUneditableLeaf);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
import renderer from '~/vue_shared/components/rich_content_editor/services/renderers/render_identifier_paragraph';
|
||||
import {
|
||||
buildUneditableOpenTokens,
|
||||
buildUneditableCloseToken,
|
||||
} from '~/vue_shared/components/rich_content_editor/services/renderers/build_uneditable_token';
|
||||
import { renderUneditableBranch } from '~/vue_shared/components/rich_content_editor/services/renderers/render_utils';
|
||||
|
||||
import { buildMockTextNode } from './mock_data';
|
||||
|
||||
|
|
@ -40,26 +37,8 @@ describe('Render Identifier Paragraph renderer', () => {
|
|||
});
|
||||
|
||||
describe('render', () => {
|
||||
let origin;
|
||||
|
||||
beforeEach(() => {
|
||||
origin = jest.fn();
|
||||
});
|
||||
|
||||
it('should return uneditable open tokens when entering', () => {
|
||||
const context = { entering: true, origin };
|
||||
|
||||
expect(renderer.render(identifierParagraphNode, context)).toStrictEqual(
|
||||
buildUneditableOpenTokens(origin()),
|
||||
);
|
||||
});
|
||||
|
||||
it('should return an uneditable close tokens when exiting', () => {
|
||||
const context = { entering: false, origin };
|
||||
|
||||
expect(renderer.render(identifierParagraphNode, context)).toStrictEqual(
|
||||
buildUneditableCloseToken(origin()),
|
||||
);
|
||||
it('should delegate rendering to the renderUneditableBranch util', () => {
|
||||
expect(renderer.render).toBe(renderUneditableBranch);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
import renderer from '~/vue_shared/components/rich_content_editor/services/renderers/render_kramdown_list';
|
||||
import {
|
||||
buildUneditableOpenTokens,
|
||||
buildUneditableCloseToken,
|
||||
} from '~/vue_shared/components/rich_content_editor/services/renderers/build_uneditable_token';
|
||||
import { renderUneditableBranch } from '~/vue_shared/components/rich_content_editor/services/renderers/render_utils';
|
||||
|
||||
import { buildMockTextNode } from './mock_data';
|
||||
|
||||
|
|
@ -34,22 +31,8 @@ describe('Render Kramdown List renderer', () => {
|
|||
});
|
||||
|
||||
describe('render', () => {
|
||||
const origin = jest.fn();
|
||||
|
||||
it('should return uneditable open tokens when entering', () => {
|
||||
const context = { entering: true, origin };
|
||||
|
||||
expect(renderer.render(kramdownListNode, context)).toStrictEqual(
|
||||
buildUneditableOpenTokens(origin()),
|
||||
);
|
||||
});
|
||||
|
||||
it('should return an uneditable close tokens when exiting', () => {
|
||||
const context = { entering: false, origin };
|
||||
|
||||
expect(renderer.render(kramdownListNode, context)).toStrictEqual(
|
||||
buildUneditableCloseToken(origin()),
|
||||
);
|
||||
it('should delegate rendering to the renderUneditableBranch util', () => {
|
||||
expect(renderer.render).toBe(renderUneditableBranch);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import renderer from '~/vue_shared/components/rich_content_editor/services/renderers/render_kramdown_text';
|
||||
import { buildUneditableTokens } from '~/vue_shared/components/rich_content_editor/services/renderers/build_uneditable_token';
|
||||
import { renderUneditableLeaf } from '~/vue_shared/components/rich_content_editor/services/renderers/render_utils';
|
||||
|
||||
import { buildMockTextNode, normalTextNode } from './mock_data';
|
||||
|
||||
|
|
@ -17,14 +17,8 @@ describe('Render Kramdown Text renderer', () => {
|
|||
});
|
||||
|
||||
describe('render', () => {
|
||||
const origin = jest.fn();
|
||||
|
||||
it('should return uneditable tokens', () => {
|
||||
const context = { origin };
|
||||
|
||||
expect(renderer.render(kramdownTextNode, context)).toStrictEqual(
|
||||
buildUneditableTokens(origin()),
|
||||
);
|
||||
it('should delegate rendering to the renderUneditableLeaf util', () => {
|
||||
expect(renderer.render).toBe(renderUneditableLeaf);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
import {
|
||||
renderUneditableLeaf,
|
||||
renderUneditableBranch,
|
||||
} from '~/vue_shared/components/rich_content_editor/services/renderers/render_utils';
|
||||
|
||||
import {
|
||||
buildUneditableBlockTokens,
|
||||
buildUneditableOpenTokens,
|
||||
} from '~/vue_shared/components/rich_content_editor/services/renderers/build_uneditable_token';
|
||||
|
||||
import { originToken, uneditableCloseToken } from './mock_data';
|
||||
|
||||
describe('Render utils', () => {
|
||||
describe('renderUneditableLeaf', () => {
|
||||
it('should return uneditable block tokens around an origin token', () => {
|
||||
const context = { origin: jest.fn().mockReturnValueOnce(originToken) };
|
||||
const result = renderUneditableLeaf({}, context);
|
||||
|
||||
expect(result).toStrictEqual(buildUneditableBlockTokens(originToken));
|
||||
});
|
||||
});
|
||||
|
||||
describe('renderUneditableBranch', () => {
|
||||
let origin;
|
||||
|
||||
beforeEach(() => {
|
||||
origin = jest.fn().mockReturnValueOnce(originToken);
|
||||
});
|
||||
|
||||
it('should return uneditable block open token followed by the origin token when entering', () => {
|
||||
const context = { entering: true, origin };
|
||||
const result = renderUneditableBranch({}, context);
|
||||
|
||||
expect(result).toStrictEqual(buildUneditableOpenTokens(originToken));
|
||||
});
|
||||
|
||||
it('should return uneditable block closing token when exiting', () => {
|
||||
const context = { entering: false, origin };
|
||||
const result = renderUneditableBranch({}, context);
|
||||
|
||||
expect(result).toStrictEqual(uneditableCloseToken);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -516,6 +516,7 @@ project:
|
|||
- webex_teams_service
|
||||
- build_report_results
|
||||
- vulnerability_statistic
|
||||
- vulnerability_historical_statistics
|
||||
award_emoji:
|
||||
- awardable
|
||||
- user
|
||||
|
|
|
|||
Loading…
Reference in New Issue