Commit f9ac9550 authored by Natalia Tepluhina's avatar Natalia Tepluhina Committed by David O'Regan

Updates slots syntax in DynamicScroller

Fixed contributors slot syntax

Fixed slot syntax in ci cd analytics

Fixed slot scope in charts and discussion

Fixed slot syntax in paginated list spec

Fixed slot syntax in resizeable chart spec

Fixed slot syntax in note and issuable form

Fixed members and milestones slot syntax

Fixed slots in discussion-notes

Fixes slot syntax in time series

Noteables slots fixes

Terraform slots syntax fixed

Fixed time series

Fixed slots in analytics

Added modal stub

Fixed rules slot

Fixed burnup and burndown chart

Fixed cluster agents slots

Added eslint config

Fixed related items tree

Fixed slots in grouped metrics

Fixed slots in unit tests

Fixed ready to merge spec

Fixed ci_cd_anaytics spec

Fixed terraform list spec

Added stubbed GlTab to cluster agent spec

Stubbed NoteableNote in specs

Stubbed GlModal in dashboard actions test

Fixed issuable form spec

Fixed discussion notes spec

Fixed time series spec

Fixed fork_form spec

Updated snapshot for analytics

Fixed commit edit spec
parent b0146e2d
...@@ -17,6 +17,14 @@ settings: ...@@ -17,6 +17,14 @@ settings:
webpack: webpack:
config: './config/webpack.config.js' config: './config/webpack.config.js'
rules: rules:
# BEGIN Disallow deprecated slot syntax
# TODO: Remove once
# https://gitlab.com/gitlab-org/frontend/eslint-plugin/-/issues/31 is closed
# and consumed by GitLab.
vue/no-deprecated-scope-attribute: error
vue/no-deprecated-slot-attribute: error
vue/no-deprecated-slot-scope-attribute: error
# END Disallow deprecated slot syntax
import/no-commonjs: error import/no-commonjs: error
import/no-default-export: off import/no-default-export: off
no-underscore-dangle: no-underscore-dangle:
......
...@@ -94,9 +94,11 @@ export default { ...@@ -94,9 +94,11 @@ export default {
@handleUpdateNote="update" @handleUpdateNote="update"
@toggleResolveStatus="toggleResolveDiscussion(draft.id)" @toggleResolveStatus="toggleResolveDiscussion(draft.id)"
> >
<strong slot="note-header-info" class="badge draft-pending-label gl-mr-2"> <template #note-header-info>
{{ __('Pending') }} <strong class="badge draft-pending-label gl-mr-2">
</strong> {{ __('Pending') }}
</strong>
</template>
</noteable-note> </noteable-note>
</ul> </ul>
......
...@@ -204,15 +204,16 @@ export default { ...@@ -204,15 +204,16 @@ export default {
<h4 class="gl-mb-2 gl-mt-5">{{ __('Commits to') }} {{ branch }}</h4> <h4 class="gl-mb-2 gl-mt-5">{{ __('Commits to') }} {{ branch }}</h4>
<span>{{ __('Excluding merge commits. Limited to 6,000 commits.') }}</span> <span>{{ __('Excluding merge commits. Limited to 6,000 commits.') }}</span>
<resizable-chart-container> <resizable-chart-container>
<gl-area-chart <template #default="{ width }">
slot-scope="{ width }" <gl-area-chart
class="gl-mb-5" class="gl-mb-5"
:width="width" :width="width"
:data="masterChartData" :data="masterChartData"
:option="masterChartOptions" :option="masterChartOptions"
:height="masterChartHeight" :height="masterChartHeight"
@created="onMasterChartCreated" @created="onMasterChartCreated"
/> />
</template>
</resizable-chart-container> </resizable-chart-container>
<div class="row"> <div class="row">
...@@ -226,14 +227,15 @@ export default { ...@@ -226,14 +227,15 @@ export default {
{{ n__('%d commit', '%d commits', contributor.commits) }} ({{ contributor.email }}) {{ n__('%d commit', '%d commits', contributor.commits) }} ({{ contributor.email }})
</p> </p>
<resizable-chart-container> <resizable-chart-container>
<gl-area-chart <template #default="{ width }">
slot-scope="{ width }" <gl-area-chart
:width="width" :width="width"
:data="contributor.dates" :data="contributor.dates"
:option="individualChartOptions" :option="individualChartOptions"
:height="individualChartHeight" :height="individualChartHeight"
@created="onIndividualChartCreated" @created="onIndividualChartCreated"
/> />
</template>
</resizable-chart-container> </resizable-chart-container>
</div> </div>
</div> </div>
......
...@@ -72,16 +72,17 @@ export default { ...@@ -72,16 +72,17 @@ export default {
:show-suggest-popover="true" :show-suggest-popover="true"
:textarea-value="issuableDescription" :textarea-value="issuableDescription"
> >
<textarea <template #textarea>
id="issuable-description" <textarea
ref="textarea" id="issuable-description"
slot="textarea" ref="textarea"
v-model="issuableDescription" v-model="issuableDescription"
dir="auto" dir="auto"
class="note-textarea qa-issuable-form-description rspec-issuable-form-description js-gfm-input js-autosize markdown-area" class="note-textarea qa-issuable-form-description rspec-issuable-form-description js-gfm-input js-autosize markdown-area"
:aria-label="__('Description')" :aria-label="__('Description')"
:placeholder="__('Write a comment or drag your files here…')" :placeholder="__('Write a comment or drag your files here…')"
></textarea> ></textarea>
</template>
</markdown-field> </markdown-field>
</div> </div>
</div> </div>
......
...@@ -116,7 +116,7 @@ export default { ...@@ -116,7 +116,7 @@ export default {
:title-link-attributes="tab.attrs" :title-link-attributes="tab.attrs"
:query-param-value="tab.queryParamValue" :query-param-value="tab.queryParamValue"
> >
<template slot="title"> <template #title>
<span>{{ tab.title }}</span> <span>{{ tab.title }}</span>
<gl-badge size="sm" class="gl-tab-counter-badge">{{ getTabCount(tab) }}</gl-badge> <gl-badge size="sm" class="gl-tab-counter-badge">{{ getTabCount(tab) }}</gl-badge>
</template> </template>
......
...@@ -171,7 +171,7 @@ export default { ...@@ -171,7 +171,7 @@ export default {
<template> <template>
<gl-dropdown v-bind="$attrs" class="milestone-combobox" @shown="focusSearchBox"> <gl-dropdown v-bind="$attrs" class="milestone-combobox" @shown="focusSearchBox">
<template slot="button-content"> <template #button-content>
<span data-testid="milestone-combobox-button-content" class="gl-flex-grow-1 text-muted">{{ <span data-testid="milestone-combobox-button-content" class="gl-flex-grow-1 text-muted">{{
selectedMilestonesLabel selectedMilestonesLabel
}}</span> }}</span>
......
...@@ -402,22 +402,20 @@ export default { ...@@ -402,22 +402,20 @@ export default {
@created="onChartCreated" @created="onChartCreated"
@updated="onChartUpdated" @updated="onChartUpdated"
> >
<template v-if="tooltip.type === 'deployments'"> <template #tooltip-title>
<template slot="tooltip-title"> <template v-if="tooltip.type === 'deployments'">
{{ __('Deployed') }} {{ __('Deployed') }}
</template> </template>
<div slot="tooltip-content" class="d-flex align-items-center"> <div v-else class="text-nowrap">
{{ tooltip.title }}
</div>
</template>
<template #tooltip-content>
<div v-if="tooltip.type === 'deployments'" class="d-flex align-items-center">
<gl-icon name="commit" class="mr-2" /> <gl-icon name="commit" class="mr-2" />
<gl-link :href="tooltip.commitUrl">{{ tooltip.sha }}</gl-link> <gl-link :href="tooltip.commitUrl">{{ tooltip.sha }}</gl-link>
</div> </div>
</template> <template v-else>
<template v-else>
<template slot="tooltip-title">
<div class="text-nowrap">
{{ tooltip.title }}
</div>
</template>
<template slot="tooltip-content" :tooltip="tooltip">
<div <div
v-for="(content, key) in tooltip.content" v-for="(content, key) in tooltip.content"
:key="key" :key="key"
......
...@@ -138,10 +138,10 @@ export default { ...@@ -138,10 +138,10 @@ export default {
</script> </script>
<template> <template>
<!-- <!--
This component should be replaced with a variant developed This component should be replaced with a variant developed
as part of https://gitlab.com/gitlab-org/gitlab-ui/-/issues/936 as part of https://gitlab.com/gitlab-org/gitlab-ui/-/issues/936
The variant will create a dropdown with an icon, no text and no caret The variant will create a dropdown with an icon, no text and no caret
--> -->
<gl-dropdown <gl-dropdown
v-gl-tooltip v-gl-tooltip
...@@ -177,20 +177,22 @@ export default { ...@@ -177,20 +177,22 @@ export default {
@formValidation="setFormValidity" @formValidation="setFormValidity"
/> />
</form> </form>
<div slot="modal-footer"> <template #modal-footer>
<gl-button @click="hideAddMetricModal"> <div>
{{ __('Cancel') }} <gl-button @click="hideAddMetricModal">
</gl-button> {{ __('Cancel') }}
<gl-button </gl-button>
v-track-event="getAddMetricTrackingOptions()" <gl-button
data-testid="add-metric-modal-submit-button" v-track-event="getAddMetricTrackingOptions()"
:disabled="!customMetricsFormIsValid" data-testid="add-metric-modal-submit-button"
variant="success" :disabled="!customMetricsFormIsValid"
@click="submitCustomMetricsForm" variant="success"
> @click="submitCustomMetricsForm"
{{ __('Save changes') }} >
</gl-button> {{ __('Save changes') }}
</div> </gl-button>
</div>
</template>
</gl-modal> </gl-modal>
</template> </template>
......
...@@ -130,15 +130,18 @@ export default { ...@@ -130,15 +130,18 @@ export default {
@handleDeleteNote="$emit('deleteNote')" @handleDeleteNote="$emit('deleteNote')"
@startReplying="$emit('startReplying')" @startReplying="$emit('startReplying')"
> >
<note-edited-text <template #discussion-resolved-text>
v-if="discussion.resolved" <note-edited-text
slot="discussion-resolved-text" v-if="discussion.resolved"
:edited-at="discussion.resolved_at" :edited-at="discussion.resolved_at"
:edited-by="discussion.resolved_by" :edited-by="discussion.resolved_by"
:action-text="resolvedText" :action-text="resolvedText"
class-name="discussion-headline-light js-discussion-headline discussion-resolved-text" class-name="discussion-headline-light js-discussion-headline discussion-resolved-text"
/> />
<slot slot="avatar-badge" name="avatar-badge"></slot> </template>
<template #avatar-badge>
<slot name="avatar-badge"></slot>
</template>
</component> </component>
<discussion-notes-replies-wrapper :is-diff-discussion="discussion.diff_discussion"> <discussion-notes-replies-wrapper :is-diff-discussion="discussion.diff_discussion">
<toggle-replies-widget <toggle-replies-widget
...@@ -175,7 +178,9 @@ export default { ...@@ -175,7 +178,9 @@ export default {
:discussion-resolve-path="discussion.resolve_path" :discussion-resolve-path="discussion.resolve_path"
@handleDeleteNote="$emit('deleteNote')" @handleDeleteNote="$emit('deleteNote')"
> >
<slot v-if="index === 0" slot="avatar-badge" name="avatar-badge"></slot> <template #avatar-badge>
<slot v-if="index === 0" name="avatar-badge"></slot>
</template>
</component> </component>
<slot :show-replies="isExpanded || !hasReplies" name="footer"></slot> <slot :show-replies="isExpanded || !hasReplies" name="footer"></slot>
</template> </template>
......
...@@ -265,7 +265,9 @@ export default { ...@@ -265,7 +265,9 @@ export default {
@startReplying="showReplyForm" @startReplying="showReplyForm"
@deleteNote="deleteNoteHandler" @deleteNote="deleteNoteHandler"
> >
<slot slot="avatar-badge" name="avatar-badge"></slot> <template #avatar-badge>
<slot name="avatar-badge"></slot>
</template>
<template #footer="{ showReplies }"> <template #footer="{ showReplies }">
<draft-note <draft-note
v-if="showDraft(discussion.reply_id)" v-if="showDraft(discussion.reply_id)"
......
...@@ -392,7 +392,9 @@ export default { ...@@ -392,7 +392,9 @@ export default {
:img-alt="author.name" :img-alt="author.name"
:img-size="40" :img-size="40"
> >
<slot slot="avatar-badge" name="avatar-badge"></slot> <template #avatar-badge>
<slot name="avatar-badge"></slot>
</template>
</user-avatar-link> </user-avatar-link>
</div> </div>
<div class="timeline-content"> <div class="timeline-content">
...@@ -403,7 +405,9 @@ export default { ...@@ -403,7 +405,9 @@ export default {
:note-id="note.id" :note-id="note.id"
:is-confidential="note.confidential" :is-confidential="note.confidential"
> >
<slot slot="note-header-info" name="note-header-info"></slot> <template #note-header-info>
<slot name="note-header-info"></slot>
</template>
<span v-if="commit" v-safe-html="actionText"></span> <span v-if="commit" v-safe-html="actionText"></span>
<span v-else-if="note.created_at" class="d-none d-sm-inline">&middot;</span> <span v-else-if="note.created_at" class="d-none d-sm-inline">&middot;</span>
</note-header> </note-header>
......
...@@ -301,7 +301,7 @@ export default { ...@@ -301,7 +301,7 @@ export default {
:state="form.fields.namespace.state" :state="form.fields.namespace.state"
required required
> >
<template slot="first"> <template #first>
<option :value="null" disabled>{{ s__('ForkProject|Select a namespace') }}</option> <option :value="null" disabled>{{ s__('ForkProject|Select a namespace') }}</option>
</template> </template>
<option v-for="namespace in namespaces" :key="namespace.id" :value="namespace"> <option v-for="namespace in namespaces" :key="namespace.id" :value="namespace">
......
...@@ -85,28 +85,29 @@ export default { ...@@ -85,28 +85,29 @@ export default {
:action-cancel="$options.cancelProps" :action-cancel="$options.cancelProps"
@primary="onSubmit" @primary="onSubmit"
> >
<div slot="modal-title" class="modal-title-with-label"> <template #modal-title>
<gl-sprintf <div class="modal-title-with-label">
:message=" <gl-sprintf
s__( :message="
'Labels|%{spanStart}Promote label%{spanEnd} %{labelTitle} %{spanStart}to Group Label?%{spanEnd}', s__(
) 'Labels|%{spanStart}Promote label%{spanEnd} %{labelTitle} %{spanStart}to Group Label?%{spanEnd}',
" )
> "
<template #labelTitle>
<span
class="label color-label"
:style="`background-color: ${labelColor}; color: ${labelTextColor};`"
>
{{ labelTitle }}
</span>
</template>
<template #span="{ content }"
><span>{{ content }}</span></template
> >
</gl-sprintf> <template #labelTitle>
</div> <span
class="label color-label"
:style="`background-color: ${labelColor}; color: ${labelTextColor};`"
>
{{ labelTitle }}
</span>
</template>
<template #span="{ content }"
><span>{{ content }}</span></template
>
</gl-sprintf>
</div>
</template>
{{ text }} {{ text }}
</gl-modal> </gl-modal>
</template> </template>
...@@ -81,11 +81,13 @@ export default { ...@@ -81,11 +81,13 @@ export default {
:invalid-feedback="urlError" :invalid-feedback="urlError"
> >
<gl-form-input id="video-modal-url-input" ref="urlInput" v-model="url" /> <gl-form-input id="video-modal-url-input" ref="urlInput" v-model="url" />
<gl-sprintf slot="description" :message="description" class="text-gl-muted"> <template #description>
<template #id> <gl-sprintf :message="description" class="text-gl-muted">
<strong>{{ __('0t1DgySidms') }}</strong> <template #id>
</template> <strong>{{ __('0t1DgySidms') }}</strong>
</gl-sprintf> </template>
</gl-sprintf>
</template>
</gl-form-group> </gl-form-group>
</gl-modal> </gl-modal>
</template> </template>
...@@ -98,7 +98,7 @@ export default { ...@@ -98,7 +98,7 @@ export default {
<section> <section>
<gl-tabs> <gl-tabs>
<gl-tab> <gl-tab>
<template slot="title"> <template #title>
<p class="gl-m-0"> <p class="gl-m-0">
{{ s__('Terraform|States') }} {{ s__('Terraform|States') }}
<gl-badge v-if="statesCount">{{ statesCount }}</gl-badge> <gl-badge v-if="statesCount">{{ statesCount }}</gl-badge>
......
...@@ -629,11 +629,9 @@ export default { ...@@ -629,11 +629,9 @@ export default {
input-id="squash-message-edit" input-id="squash-message-edit"
squash squash
> >
<commit-message-dropdown <template #header>
slot="header" <commit-message-dropdown v-model="squashCommitMessage" :commits="commits" />
v-model="squashCommitMessage" </template>
:commits="commits"
/>
</commit-edit> </commit-edit>
<commit-edit <commit-edit
v-if="shouldShowMergeEdit" v-if="shouldShowMergeEdit"
...@@ -641,14 +639,16 @@ export default { ...@@ -641,14 +639,16 @@ export default {
:label="__('Merge commit message')" :label="__('Merge commit message')"
input-id="merge-message-edit" input-id="merge-message-edit"
> >
<label slot="checkbox"> <template #checkbox>
<input <label>
id="include-description" <input
type="checkbox" id="include-description"
@change="updateMergeCommitMessage($event.target.checked)" type="checkbox"
/> @change="updateMergeCommitMessage($event.target.checked)"
{{ __('Include merge request description') }} />
</label> {{ __('Include merge request description') }}
</label>
</template>
</commit-edit> </commit-edit>
</ul> </ul>
</commits-header> </commits-header>
......
...@@ -68,7 +68,7 @@ export default { ...@@ -68,7 +68,7 @@ export default {
split split
@click="handleClick(selectedAction, $event)" @click="handleClick(selectedAction, $event)"
> >
<template slot="button-content"> <template #button-content>
<span class="gl-new-dropdown-button-text" v-bind="selectedAction.attrs"> <span class="gl-new-dropdown-button-text" v-bind="selectedAction.attrs">
{{ selectedAction.text }} {{ selectedAction.text }}
</span> </span>
......
...@@ -28,18 +28,23 @@ export default { ...@@ -28,18 +28,23 @@ export default {
<slot></slot> <slot></slot>
</p> </p>
<resizable-chart-container> <resizable-chart-container>
<gl-area-chart <template #default="{ width }">
slot-scope="{ width }" <gl-area-chart
v-bind="$attrs" v-bind="$attrs"
:width="width" :width="width"
:height="$options.chartContainerHeight" :height="$options.chartContainerHeight"
:data="chartData" :data="chartData"
:include-legend-avg-max="false" :include-legend-avg-max="false"
:option="areaChartOptions" :option="areaChartOptions"
> >
<slot slot="tooltip-title" name="tooltip-title"></slot> <template #tooltip-title>
<slot slot="tooltip-content" name="tooltip-content"></slot> <slot name="tooltip-title"></slot>
</gl-area-chart> </template>
<template #tooltip-content>
<slot name="tooltip-content"></slot>
</template>
</gl-area-chart>
</template>
</resizable-chart-container> </resizable-chart-container>
</div> </div>
</template> </template>
...@@ -46,9 +46,12 @@ export default { ...@@ -46,9 +46,12 @@ export default {
:area-chart-options="chartOptions" :area-chart-options="chartOptions"
> >
{{ dateRange }} {{ dateRange }}
<template #tooltip-title>
<slot slot="tooltip-title" name="tooltip-title"></slot> <slot name="tooltip-title"></slot>
<slot slot="tooltip-content" name="tooltip-content"></slot> </template>
<template #tooltip-content>
<slot name="tooltip-content"></slot>
</template>
</ci-cd-analytics-area-chart> </ci-cd-analytics-area-chart>
</div> </div>
</template> </template>
...@@ -7,7 +7,7 @@ import { __ } from '~/locale'; ...@@ -7,7 +7,7 @@ import { __ } from '~/locale';
* *
* @example * @example
* <expand-button> * <expand-button>
* <template slot="expanded"> * <template #expanded>
* Text goes here. * Text goes here.
* </template> * </template>
* </expand-button> * </expand-button>
......
...@@ -74,6 +74,8 @@ export default { ...@@ -74,6 +74,8 @@ export default {
@hidden="syncHide" @hidden="syncHide"
> >
<slot></slot> <slot></slot>
<slot slot="modal-footer" name="modal-footer" :ok="ok" :cancel="cancel"></slot> <template #modal-footer>
<slot name="modal-footer" :ok="ok" :cancel="cancel"></slot>
</template>
</gl-modal> </gl-modal>
</template> </template>
...@@ -111,7 +111,7 @@ export default { ...@@ -111,7 +111,7 @@ export default {
<div class="note-header"> <div class="note-header">
<note-header :author="note.author" :created-at="note.created_at" :note-id="note.id"> <note-header :author="note.author" :created-at="note.created_at" :note-id="note.id">
<span v-safe-html="actionTextHtml"></span> <span v-safe-html="actionTextHtml"></span>
<template v-if="canSeeDescriptionVersion" slot="extra-controls"> <template v-if="canSeeDescriptionVersion" #extra-controls>
&middot; &middot;
<gl-button <gl-button
variant="link" variant="link"
......
...@@ -89,10 +89,14 @@ export default { ...@@ -89,10 +89,14 @@ export default {
:x-axis-title="xAxisTitle" :x-axis-title="xAxisTitle"
:format-tooltip-text="renderTooltip" :format-tooltip-text="renderTooltip"
> >
<div slot="tooltip-title">{{ tooltipTitle }} ({{ xAxisTitle }})</div> <template #tooltip-title>
<div slot="tooltip-content" class="d-flex"> <div>{{ tooltipTitle }} ({{ xAxisTitle }})</div>
<div class="flex-grow-1">{{ yAxisTitle }}:&nbsp;</div> </template>
<div class="font-weight-bold">{{ tooltipContent }}</div> <template #tooltip-content>
</div> <div class="d-flex">
<div class="flex-grow-1">{{ yAxisTitle }}:&nbsp;</div>
<div class="font-weight-bold">{{ tooltipContent }}</div>
</div>
</template>
</gl-discrete-scatter-chart> </gl-discrete-scatter-chart>
</template> </template>
...@@ -115,35 +115,43 @@ export default { ...@@ -115,35 +115,43 @@ export default {
<gl-accordion :header-level="3"> <gl-accordion :header-level="3">
<gl-accordion-item :title="accordionTitle"> <gl-accordion-item :title="accordionTitle">
<app> <app>
<mr-rules slot="rules" /> <template #rules>
<div slot="footer"> <mr-rules />
<mr-rules-hidden-inputs /> </template>
<div <template #footer>
v-if="canUpdateApprovers && showCodeOwnerTip" <div>
class="form-text text-muted" <mr-rules-hidden-inputs />
data-testid="codeowners-tip" <div
> v-if="canUpdateApprovers && showCodeOwnerTip"
<gl-sprintf class="form-text text-muted"
:message=" data-testid="codeowners-tip"
__(
'Tip: add a %{linkStart}CODEOWNERS%{linkEnd} to automatically add approvers based on file paths and file types.',
)
"
> >
<template #link="{ content }"> <gl-sprintf
<gl-link :href="$options.codeOwnerHelpPage" target="_blank">{{ :message="
content __(
}}</gl-link> 'Tip: add a %{linkStart}CODEOWNERS%{linkEnd} to automatically add approvers based on file paths and file types.',
</template> )
</gl-sprintf> "
>
<template #link="{ content }">
<gl-link :href="$options.codeOwnerHelpPage" target="_blank">{{
content
}}</gl-link>
</template>
</gl-sprintf>
</div>
</div> </div>
</div> </template>
</app> </app>
</gl-accordion-item> </gl-accordion-item>
</gl-accordion> </gl-accordion>
</div> </div>
<app v-else> <app v-else>
<mr-rules slot="rules" /> <template #rules>
<mr-rules-hidden-inputs slot="footer" /> <mr-rules />
</template>
<template #footer>
<mr-rules-hidden-inputs />
</template>
</app> </app>
</template> </template>
...@@ -11,5 +11,9 @@ export default { ...@@ -11,5 +11,9 @@ export default {
</script> </script>
<template> <template>
<app :is-mr-edit="false"><project-rules slot="rules" /></app> <app :is-mr-edit="false">
<template #rules>
<project-rules />
</template>
</app>
</template> </template>
...@@ -338,12 +338,9 @@ export default { ...@@ -338,12 +338,9 @@ export default {
:namespace-type="namespaceType" :namespace-type="namespaceType"
:display-value="displayValue" :display-value="displayValue"
> >
<timebox-summary-cards <template #default="{ columns: openColumns, loading: summaryLoading, total }">
slot-scope="{ columns: openColumns, loading: summaryLoading, total }" <timebox-summary-cards :columns="openColumns" :loading="summaryLoading" :total="total" />
:columns="openColumns" </template>
:loading="summaryLoading"
:total="total"
/>
</open-timebox-summary> </open-timebox-summary>
</template> </template>
<div class="row"> <div class="row">
......
...@@ -149,8 +149,8 @@ export default { ...@@ -149,8 +149,8 @@ export default {
:include-legend-avg-max="false" :include-legend-avg-max="false"
@created="setChart" @created="setChart"
> >
<template slot="tooltip-title">{{ tooltip.title }}</template> <template #tooltip-title>{{ tooltip.title }}</template>
<template slot="tooltip-content">{{ tooltip.content }}</template> <template #tooltip-content>{{ tooltip.content }}</template>
</gl-line-chart> </gl-line-chart>
</div> </div>
</template> </template>
...@@ -138,8 +138,8 @@ export default { ...@@ -138,8 +138,8 @@ export default {
:include-legend-avg-max="false" :include-legend-avg-max="false"
@created="setChart" @created="setChart"
> >
<template slot="tooltip-title">{{ tooltip.title }}</template> <template #tooltip-title>{{ tooltip.title }}</template>
<template slot="tooltip-content"> <template #tooltip-content>
<div>{{ tooltip.total }}</div> <div>{{ tooltip.total }}</div>
<div>{{ tooltip.completed }}</div> <div>{{ tooltip.completed }}</div>
</template> </template>
......
...@@ -129,7 +129,7 @@ export default { ...@@ -129,7 +129,7 @@ export default {
<gl-tabs> <gl-tabs>
<gl-tab> <gl-tab>
<template slot="title"> <template #title>
<span data-testid="cluster-agent-token-count"> <span data-testid="cluster-agent-token-count">
{{ $options.i18n.tokens }} {{ $options.i18n.tokens }}
......
...@@ -81,19 +81,21 @@ export default { ...@@ -81,19 +81,21 @@ export default {
:primary-button-link="clustersHelpPath" :primary-button-link="clustersHelpPath"
:primary-button-text="__('Learn more about deploying to a cluster')" :primary-button-text="__('Learn more about deploying to a cluster')"
> >
<div slot="description"> <template #description>
<gl-sprintf <div>
:message=" <gl-sprintf
__( :message="
'Ensure your %{linkStart}environment is part of the deploy stage%{linkEnd} of your CI pipeline to track deployments to your cluster.', __(
) 'Ensure your %{linkStart}environment is part of the deploy stage%{linkEnd} of your CI pipeline to track deployments to your cluster.',
" )
> "
<template #link="{ content }"> >
<gl-link :href="environmentsHelpPath">{{ content }}</gl-link> <template #link="{ content }">
</template> <gl-link :href="environmentsHelpPath">{{ content }}</gl-link>
</gl-sprintf> </template>
</div> </gl-sprintf>
</div>
</template>
</gl-empty-state> </gl-empty-state>
<gl-table <gl-table
......
...@@ -173,19 +173,21 @@ export default { ...@@ -173,19 +173,21 @@ export default {
:active-slot-names="[visibleForm]" :active-slot-names="[visibleForm]"
class="gl-p-5 gl-pb-0" class="gl-p-5 gl-pb-0"
> >
<h6 v-for="slot in formSlots" :key="slot.name" :slot="slot.name"> <template v-for="slot in formSlots" #[slot.name]>
{{ slot.value }} <h6 :key="slot.name">
<gl-icon {{ slot.value }}
v-gl-tooltip.hover <gl-icon
name="question-o" v-gl-tooltip.hover
class="gl-text-gray-500" name="question-o"
:title=" class="gl-text-gray-500"
__( :title="
'The parent epic is confidential and can only contain confidential epics and issues', __(
) 'The parent epic is confidential and can only contain confidential epics and issues',
" )
/> "
</h6> />
</h6>
</template>
</slot-switch> </slot-switch>
<slot-switch <slot-switch
v-if="visibleForm" v-if="visibleForm"
...@@ -196,35 +198,38 @@ export default { ...@@ -196,35 +198,38 @@ export default {
'gl-show-field-errors': itemAddFailure, 'gl-show-field-errors': itemAddFailure,
}" }"
> >
<add-item-form <template #[$options.FORM_SLOTS.addItem]>
:slot="$options.FORM_SLOTS.addItem" <add-item-form
:issuable-type="issuableType" :issuable-type="issuableType"
:input-value="itemInputValue" :input-value="itemInputValue"
:is-submitting="itemAddInProgress" :is-submitting="itemAddInProgress"
:pending-references="pendingReferences" :pending-references="pendingReferences"
:auto-complete-sources="itemAutoCompleteSources" :auto-complete-sources="itemAutoCompleteSources"
:path-id-separator="itemPathIdSeparator" :path-id-separator="itemPathIdSeparator"
:has-error="itemAddFailure" :has-error="itemAddFailure"
:item-add-failure-type="itemAddFailureType" :item-add-failure-type="itemAddFailureType"
:item-add-failure-message="itemAddFailureMessage" :item-add-failure-message="itemAddFailureMessage"
:confidential="parentItem.confidential" :confidential="parentItem.confidential"
@pendingIssuableRemoveRequest="handlePendingItemRemove" @pendingIssuableRemoveRequest="handlePendingItemRemove"
@addIssuableFormInput="handleAddItemFormInput" @addIssuableFormInput="handleAddItemFormInput"
@addIssuableFormBlur="handleAddItemFormBlur" @addIssuableFormBlur="handleAddItemFormBlur"
@addIssuableFormSubmit="handleAddItemFormSubmit" @addIssuableFormSubmit="handleAddItemFormSubmit"
@addIssuableFormCancel="handleAddItemFormCancel" @addIssuableFormCancel="handleAddItemFormCancel"
/> />
<create-epic-form </template>
:slot="$options.FORM_SLOTS.createEpic" <template #[$options.FORM_SLOTS.createEpic]>
:is-submitting="itemCreateInProgress" <create-epic-form
@createEpicFormSubmit="handleCreateEpicFormSubmit" :is-submitting="itemCreateInProgress"
@createEpicFormCancel="handleCreateEpicFormCancel" @createEpicFormSubmit="handleCreateEpicFormSubmit"
/> @createEpicFormCancel="handleCreateEpicFormCancel"
<create-issue-form />
:slot="$options.FORM_SLOTS.createIssue" </template>
@cancel="toggleCreateIssueForm({ toggleState: false })" <template #[$options.FORM_SLOTS.createIssue]>
@submit="createNewIssue" <create-issue-form
/> @cancel="toggleCreateIssueForm({ toggleState: false })"
@submit="createNewIssue"
/>
</template>
</slot-switch> </slot-switch>
<related-items-tree-body <related-items-tree-body
v-if="!itemsFetchResultEmpty" v-if="!itemsFetchResultEmpty"
......
...@@ -83,9 +83,9 @@ export default { ...@@ -83,9 +83,9 @@ export default {
</div> </div>
</form> </form>
<template slot="modal-cancel">{{ s__('Cancel') }}</template> <template #modal-cancel>{{ s__('Cancel') }}</template>
<template slot="modal-ok"> <template #modal-ok>
<gl-loading-icon v-if="isApproving" inline /> <gl-loading-icon v-if="isApproving" inline />
{{ s__('Approve') }} {{ s__('Approve') }}
</template> </template>
......
...@@ -92,25 +92,27 @@ export default { ...@@ -92,25 +92,27 @@ export default {
class="mr-widget-border-top grouped-security-reports mr-report" class="mr-widget-border-top grouped-security-reports mr-report"
@toggleEvent="handleToggleEvent" @toggleEvent="handleToggleEvent"
> >
<div slot="body" class="mr-widget-grouped-section report-block"> <template #body>
<smart-virtual-list <div class="mr-widget-grouped-section report-block">
:length="metrics.length" <smart-virtual-list
:remain="$options.maxShownReportItems" :length="metrics.length"
:size="$options.typicalReportItemHeight" :remain="$options.maxShownReportItems"
class="report-block-container" :size="$options.typicalReportItemHeight"
wtag="ul" class="report-block-container"
wclass="report-block-list" wtag="ul"
> wclass="report-block-list"
<report-item >
v-for="(metric, index) in metrics" <report-item
:key="index" v-for="(metric, index) in metrics"
:issue="metric" :key="index"
status="none" :issue="metric"
:status-icon-size="24" status="none"
:component="$options.componentNames.MetricsReportsIssueBody" :status-icon-size="24"
class="gl-ml-2 gl-mt-2 gl-mb-3" :component="$options.componentNames.MetricsReportsIssueBody"
/> class="gl-ml-2 gl-mt-2 gl-mb-3"
</smart-virtual-list> />
</div> </smart-virtual-list>
</div>
</template>
</report-section> </report-section>
</template> </template>
import { GlSprintf } from '@gitlab/ui'; import { GlSprintf, GlModal } from '@gitlab/ui';
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount, createLocalVue } from '@vue/test-utils';
import Vuex from 'vuex'; import Vuex from 'vuex';
import LicenseComplianceModal from 'ee/approvals/components/license_compliance/modal.vue'; import LicenseComplianceModal from 'ee/approvals/components/license_compliance/modal.vue';
...@@ -57,6 +57,7 @@ describe('EE Approvals LicenseCompliance Modal', () => { ...@@ -57,6 +57,7 @@ describe('EE Approvals LicenseCompliance Modal', () => {
stubs: { stubs: {
GlModalVuex, GlModalVuex,
GlSprintf, GlSprintf,
GlModal,
RuleForm: mocks.RuleForm, RuleForm: mocks.RuleForm,
}, },
}); });
......
import { GlAlert, GlKeysetPagination, GlLoadingIcon, GlSprintf } from '@gitlab/ui'; import { GlAlert, GlKeysetPagination, GlLoadingIcon, GlSprintf, GlTab } from '@gitlab/ui';
import { createLocalVue, shallowMount } from '@vue/test-utils'; import { createLocalVue, shallowMount } from '@vue/test-utils';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import ClusterAgentShow from 'ee/clusters/agents/components/show.vue'; import ClusterAgentShow from 'ee/clusters/agents/components/show.vue';
...@@ -44,7 +44,7 @@ describe('ClusterAgentShow', () => { ...@@ -44,7 +44,7 @@ describe('ClusterAgentShow', () => {
localVue, localVue,
apolloProvider, apolloProvider,
propsData, propsData,
stubs: { GlSprintf, TimeAgoTooltip }, stubs: { GlSprintf, TimeAgoTooltip, GlTab },
}); });
}; };
...@@ -54,6 +54,7 @@ describe('ClusterAgentShow', () => { ...@@ -54,6 +54,7 @@ describe('ClusterAgentShow', () => {
wrapper = shallowMount(ClusterAgentShow, { wrapper = shallowMount(ClusterAgentShow, {
propsData, propsData,
mocks: { $apollo, clusterAgent }, mocks: { $apollo, clusterAgent },
stubs: { GlTab },
}); });
}; };
......
import { getByRole } from '@testing-library/dom'; import { getByRole } from '@testing-library/dom';
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount, createLocalVue } from '@vue/test-utils';
import { stubComponent } from 'helpers/stub_component';
import DraftNote from '~/batch_comments/components/draft_note.vue'; import DraftNote from '~/batch_comments/components/draft_note.vue';
import { createStore } from '~/batch_comments/stores'; import { createStore } from '~/batch_comments/stores';
import NoteableNote from '~/notes/components/noteable_note.vue'; import NoteableNote from '~/notes/components/noteable_note.vue';
...@@ -8,6 +9,14 @@ import { createDraft } from '../mock_data'; ...@@ -8,6 +9,14 @@ import { createDraft } from '../mock_data';
const localVue = createLocalVue(); const localVue = createLocalVue();
const NoteableNoteStub = stubComponent(NoteableNote, {
template: `
<div>
<slot name="note-header-info">Test</slot>
</div>
`,
});
describe('Batch comments draft note component', () => { describe('Batch comments draft note component', () => {
let store; let store;
let wrapper; let wrapper;
...@@ -26,6 +35,9 @@ describe('Batch comments draft note component', () => { ...@@ -26,6 +35,9 @@ describe('Batch comments draft note component', () => {
store, store,
propsData, propsData,
localVue, localVue,
stubs: {
NoteableNote: NoteableNoteStub,
},
}); });
jest.spyOn(wrapper.vm.$store, 'dispatch').mockImplementation(); jest.spyOn(wrapper.vm.$store, 'dispatch').mockImplementation();
......
...@@ -23,6 +23,9 @@ const createComponent = ({ ...@@ -23,6 +23,9 @@ const createComponent = ({
<button class="js-issuable-save">Submit issuable</button> <button class="js-issuable-save">Submit issuable</button>
`, `,
}, },
stubs: {
MarkdownField,
},
}); });
}; };
......
...@@ -51,6 +51,8 @@ describe('Time series component', () => { ...@@ -51,6 +51,8 @@ describe('Time series component', () => {
}, },
stubs: { stubs: {
GlPopover: true, GlPopover: true,
GlLineChart,
GlAreaChart,
}, },
attachTo: document.body, attachTo: document.body,
}); });
...@@ -202,7 +204,7 @@ describe('Time series component', () => { ...@@ -202,7 +204,7 @@ describe('Time series component', () => {
describe('when series is of line type', () => { describe('when series is of line type', () => {
beforeEach(() => { beforeEach(() => {
createWrapper(); createWrapper({}, mount);
wrapper.vm.formatTooltipText(mockLineSeriesData()); wrapper.vm.formatTooltipText(mockLineSeriesData());
return wrapper.vm.$nextTick(); return wrapper.vm.$nextTick();
}); });
......
import { GlDropdownItem } from '@gitlab/ui'; import { GlDropdownItem, GlModal } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import CustomMetricsFormFields from '~/custom_metrics/components/custom_metrics_form_fields.vue'; import CustomMetricsFormFields from '~/custom_metrics/components/custom_metrics_form_fields.vue';
import { redirectTo } from '~/lib/utils/url_utility'; import { redirectTo } from '~/lib/utils/url_utility';
...@@ -43,6 +43,9 @@ describe('Actions menu', () => { ...@@ -43,6 +43,9 @@ describe('Actions menu', () => {
wrapper = shallowMount(ActionsMenu, { wrapper = shallowMount(ActionsMenu, {
propsData: { ...dashboardActionsMenuProps, ...props }, propsData: { ...dashboardActionsMenuProps, ...props },
store, store,
stubs: {
GlModal,
},
...options, ...options,
}); });
}; };
...@@ -82,7 +85,7 @@ describe('Actions menu', () => { ...@@ -82,7 +85,7 @@ describe('Actions menu', () => {
it('modal for custom metrics form is rendered', () => { it('modal for custom metrics form is rendered', () => {
expect(findAddMetricModal().exists()).toBe(true); expect(findAddMetricModal().exists()).toBe(true);
expect(findAddMetricModal().attributes().modalid).toBe('addMetric'); expect(findAddMetricModal().props('modalId')).toBe('addMetric');
}); });
it('add metric modal submit button exists', () => { it('add metric modal submit button exists', () => {
......
import { getByRole } from '@testing-library/dom'; import { getByRole } from '@testing-library/dom';
import { shallowMount } from '@vue/test-utils'; import { shallowMount, mount } from '@vue/test-utils';
import '~/behaviors/markdown/render_gfm'; import '~/behaviors/markdown/render_gfm';
import DiscussionNotes from '~/notes/components/discussion_notes.vue'; import DiscussionNotes from '~/notes/components/discussion_notes.vue';
import NoteableNote from '~/notes/components/noteable_note.vue'; import NoteableNote from '~/notes/components/noteable_note.vue';
...@@ -23,8 +23,8 @@ describe('DiscussionNotes', () => { ...@@ -23,8 +23,8 @@ describe('DiscussionNotes', () => {
let wrapper; let wrapper;
const getList = () => getByRole(wrapper.element, 'list'); const getList = () => getByRole(wrapper.element, 'list');
const createComponent = (props) => { const createComponent = (props, mountingMethod = shallowMount) => {
wrapper = shallowMount(DiscussionNotes, { wrapper = mountingMethod(DiscussionNotes, {
store, store,
propsData: { propsData: {
discussion: discussionMock, discussion: discussionMock,
...@@ -33,7 +33,11 @@ describe('DiscussionNotes', () => { ...@@ -33,7 +33,11 @@ describe('DiscussionNotes', () => {
...props, ...props,
}, },
scopedSlots: { scopedSlots: {
footer: '<p slot-scope="{ showReplies }">showReplies:{{showReplies}}</p>', footer: `
<template #default="{ showReplies }">
<p>showReplies:{{ showReplies }}</p>,
</template>
`,
}, },
slots: { slots: {
'avatar-badge': '<span class="avatar-badge-slot-content" />', 'avatar-badge': '<span class="avatar-badge-slot-content" />',
...@@ -112,7 +116,7 @@ describe('DiscussionNotes', () => { ...@@ -112,7 +116,7 @@ describe('DiscussionNotes', () => {
}); });
it('passes down avatar-badge slot content', () => { it('passes down avatar-badge slot content', () => {
createComponent(); createComponent({}, mount);
expect(wrapper.find('.avatar-badge-slot-content').exists()).toBe(true); expect(wrapper.find('.avatar-badge-slot-content').exists()).toBe(true);
}); });
}); });
......
...@@ -155,7 +155,7 @@ describe('ForkForm component', () => { ...@@ -155,7 +155,7 @@ describe('ForkForm component', () => {
describe('forks namespaces', () => { describe('forks namespaces', () => {
beforeEach(() => { beforeEach(() => {
mockGetRequest({ namespaces: MOCK_NAMESPACES_RESPONSE }); mockGetRequest({ namespaces: MOCK_NAMESPACES_RESPONSE });
createComponent(); createFullComponent();
}); });
it('make GET request from endpoint', async () => { it('make GET request from endpoint', async () => {
......
...@@ -21,11 +21,7 @@ exports[`CiCdAnalyticsAreaChart matches the snapshot 1`] = ` ...@@ -21,11 +21,7 @@ exports[`CiCdAnalyticsAreaChart matches the snapshot 1`] = `
option="[object Object]" option="[object Object]"
thresholds="" thresholds=""
width="0" width="0"
> />
<template />
<template />
</glareachart-stub>
</div> </div>
</div> </div>
`; `;
...@@ -47,6 +47,9 @@ describe('TerraformList', () => { ...@@ -47,6 +47,9 @@ describe('TerraformList', () => {
localVue, localVue,
apolloProvider, apolloProvider,
propsData, propsData,
stubs: {
GlTab,
},
}); });
}; };
......
...@@ -63,7 +63,7 @@ describe('Commits edit component', () => { ...@@ -63,7 +63,7 @@ describe('Commits edit component', () => {
beforeEach(() => { beforeEach(() => {
createComponent({ createComponent({
header: `<div class="test-header">${testCommitMessage}</div>`, header: `<div class="test-header">${testCommitMessage}</div>`,
checkbox: `<label slot="checkbox" class="test-checkbox">${testLabel}</label >`, checkbox: `<label class="test-checkbox">${testLabel}</label >`,
}); });
}); });
......
...@@ -70,6 +70,9 @@ const createComponent = (customConfig = {}, mergeRequestWidgetGraphql = false) = ...@@ -70,6 +70,9 @@ const createComponent = (customConfig = {}, mergeRequestWidgetGraphql = false) =
mergeRequestWidgetGraphql, mergeRequestWidgetGraphql,
}, },
}, },
stubs: {
CommitEdit,
},
}); });
}; };
......
...@@ -121,7 +121,9 @@ describe('ImageDiffViewer', () => { ...@@ -121,7 +121,9 @@ describe('ImageDiffViewer', () => {
:new-size="newSize" :new-size="newSize"
:old-size="oldSize" :old-size="oldSize"
> >
<span slot="image-overlay" class="overlay">test</span> <template #image-overlay>
<span class="overlay">test</span>
</template>
</image-diff-viewer> </image-diff-viewer>
`), `),
}).$mount(); }).$mount();
......
...@@ -7,9 +7,11 @@ describe('Pagination links component', () => { ...@@ -7,9 +7,11 @@ describe('Pagination links component', () => {
let glPaginatedList; let glPaginatedList;
const template = ` const template = `
<div class="slot" slot-scope="{ listItem }"> <template #default="{ listItem }">
<span class="item">Item Name: {{listItem.id}}</span> <div class="slot">
</div> <span class="item">Item Name: {{ listItem.id }}</span>
</div>
</template>
`; `;
const props = { const props = {
......
...@@ -2,20 +2,22 @@ ...@@ -2,20 +2,22 @@
exports[`Resizable Chart Container renders the component 1`] = ` exports[`Resizable Chart Container renders the component 1`] = `
<div> <div>
<div <template>
class="slot" <div
> class="slot"
<span
class="width"
> >
0 <span
</span> class="width"
>
<span 0
class="height" </span>
>
0 <span
</span> class="height"
</div> >
0
</span>
</div>
</template>
</div> </div>
`; `;
...@@ -16,10 +16,12 @@ describe('Resizable Chart Container', () => { ...@@ -16,10 +16,12 @@ describe('Resizable Chart Container', () => {
wrapper = mount(ResizableChartContainer, { wrapper = mount(ResizableChartContainer, {
scopedSlots: { scopedSlots: {
default: ` default: `
<div class="slot" slot-scope="{ width, height }"> <template #default="{ width, height }">
<span class="width">{{width}}</span> <div class="slot">
<span class="height">{{height}}</span> <span class="width">{{width}}</span>
</div> <span class="height">{{height}}</span>
</div>
</template>
`, `,
}, },
}); });
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
@visible="onScrollerVisible" @visible="onScrollerVisible"
v-on="listeners" v-on="listeners"
> >
<template slot-scope="{ item: itemWithSize, index, active }"> <template #default="{ item: itemWithSize, index, active }">
<slot <slot
v-bind="{ v-bind="{
item: itemWithSize.item, item: itemWithSize.item,
...@@ -20,10 +20,10 @@ ...@@ -20,10 +20,10 @@
}" }"
/> />
</template> </template>
<template slot="before"> <template #before>
<slot name="before" /> <slot name="before" />
</template> </template>
<template slot="after"> <template #after>
<slot name="after" /> <slot name="after" />
</template> </template>
</RecycleScroller> </RecycleScroller>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment