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>
<strong class="badge draft-pending-label gl-mr-2">
{{ __('Pending') }} {{ __('Pending') }}
</strong> </strong>
</template>
</noteable-note> </noteable-note>
</ul> </ul>
......
...@@ -204,8 +204,8 @@ export default { ...@@ -204,8 +204,8 @@ 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>
<template #default="{ width }">
<gl-area-chart <gl-area-chart
slot-scope="{ width }"
class="gl-mb-5" class="gl-mb-5"
:width="width" :width="width"
:data="masterChartData" :data="masterChartData"
...@@ -213,6 +213,7 @@ export default { ...@@ -213,6 +213,7 @@ export default {
: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>
<template #default="{ width }">
<gl-area-chart <gl-area-chart
slot-scope="{ width }"
: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"
> >
<template #textarea>
<textarea <textarea
id="issuable-description" id="issuable-description"
ref="textarea" ref="textarea"
slot="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 #tooltip-title>
<template v-if="tooltip.type === 'deployments'"> <template v-if="tooltip.type === 'deployments'">
<template slot="tooltip-title">
{{ __('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"
......
...@@ -177,7 +177,8 @@ export default { ...@@ -177,7 +177,8 @@ export default {
@formValidation="setFormValidity" @formValidation="setFormValidity"
/> />
</form> </form>
<div slot="modal-footer"> <template #modal-footer>
<div>
<gl-button @click="hideAddMetricModal"> <gl-button @click="hideAddMetricModal">
{{ __('Cancel') }} {{ __('Cancel') }}
</gl-button> </gl-button>
...@@ -191,6 +192,7 @@ export default { ...@@ -191,6 +192,7 @@ export default {
{{ __('Save changes') }} {{ __('Save changes') }}
</gl-button> </gl-button>
</div> </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')"
> >
<template #discussion-resolved-text>
<note-edited-text <note-edited-text
v-if="discussion.resolved" v-if="discussion.resolved"
slot="discussion-resolved-text"
: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,7 +85,8 @@ export default { ...@@ -85,7 +85,8 @@ 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>
<div class="modal-title-with-label">
<gl-sprintf <gl-sprintf
:message=" :message="
s__( s__(
...@@ -106,7 +107,7 @@ export default { ...@@ -106,7 +107,7 @@ export default {
> >
</gl-sprintf> </gl-sprintf>
</div> </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>
<gl-sprintf :message="description" class="text-gl-muted">
<template #id> <template #id>
<strong>{{ __('0t1DgySidms') }}</strong> <strong>{{ __('0t1DgySidms') }}</strong>
</template> </template>
</gl-sprintf> </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,7 +639,8 @@ export default { ...@@ -641,7 +639,8 @@ 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>
<label>
<input <input
id="include-description" id="include-description"
type="checkbox" type="checkbox"
...@@ -649,6 +648,7 @@ export default { ...@@ -649,6 +648,7 @@ export default {
/> />
{{ __('Include merge request description') }} {{ __('Include merge request description') }}
</label> </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,8 +28,8 @@ export default { ...@@ -28,8 +28,8 @@ export default {
<slot></slot> <slot></slot>
</p> </p>
<resizable-chart-container> <resizable-chart-container>
<template #default="{ width }">
<gl-area-chart <gl-area-chart
slot-scope="{ width }"
v-bind="$attrs" v-bind="$attrs"
:width="width" :width="width"
:height="$options.chartContainerHeight" :height="$options.chartContainerHeight"
...@@ -37,9 +37,14 @@ export default { ...@@ -37,9 +37,14 @@ export default {
: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>
</template>
<template #tooltip-content>
<slot name="tooltip-content"></slot>
</template>
</gl-area-chart> </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>
</template>
<template #tooltip-content>
<div class="d-flex">
<div class="flex-grow-1">{{ yAxisTitle }}:&nbsp;</div> <div class="flex-grow-1">{{ yAxisTitle }}:&nbsp;</div>
<div class="font-weight-bold">{{ tooltipContent }}</div> <div class="font-weight-bold">{{ tooltipContent }}</div>
</div> </div>
</template>
</gl-discrete-scatter-chart> </gl-discrete-scatter-chart>
</template> </template>
...@@ -115,8 +115,11 @@ export default { ...@@ -115,8 +115,11 @@ 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 />
</template>
<template #footer>
<div>
<mr-rules-hidden-inputs /> <mr-rules-hidden-inputs />
<div <div
v-if="canUpdateApprovers && showCodeOwnerTip" v-if="canUpdateApprovers && showCodeOwnerTip"
...@@ -138,12 +141,17 @@ export default { ...@@ -138,12 +141,17 @@ export default {
</gl-sprintf> </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,7 +81,8 @@ export default { ...@@ -81,7 +81,8 @@ 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>
<div>
<gl-sprintf <gl-sprintf
:message=" :message="
__( __(
...@@ -94,6 +95,7 @@ export default { ...@@ -94,6 +95,7 @@ export default {
</template> </template>
</gl-sprintf> </gl-sprintf>
</div> </div>
</template>
</gl-empty-state> </gl-empty-state>
<gl-table <gl-table
......
...@@ -173,7 +173,8 @@ export default { ...@@ -173,7 +173,8 @@ 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]>
<h6 :key="slot.name">
{{ slot.value }} {{ slot.value }}
<gl-icon <gl-icon
v-gl-tooltip.hover v-gl-tooltip.hover
...@@ -186,6 +187,7 @@ export default { ...@@ -186,6 +187,7 @@ export default {
" "
/> />
</h6> </h6>
</template>
</slot-switch> </slot-switch>
<slot-switch <slot-switch
v-if="visibleForm" v-if="visibleForm"
...@@ -196,8 +198,8 @@ export default { ...@@ -196,8 +198,8 @@ export default {
'gl-show-field-errors': itemAddFailure, 'gl-show-field-errors': itemAddFailure,
}" }"
> >
<template #[$options.FORM_SLOTS.addItem]>
<add-item-form <add-item-form
:slot="$options.FORM_SLOTS.addItem"
:issuable-type="issuableType" :issuable-type="issuableType"
:input-value="itemInputValue" :input-value="itemInputValue"
:is-submitting="itemAddInProgress" :is-submitting="itemAddInProgress"
...@@ -214,17 +216,20 @@ export default { ...@@ -214,17 +216,20 @@ export default {
@addIssuableFormSubmit="handleAddItemFormSubmit" @addIssuableFormSubmit="handleAddItemFormSubmit"
@addIssuableFormCancel="handleAddItemFormCancel" @addIssuableFormCancel="handleAddItemFormCancel"
/> />
</template>
<template #[$options.FORM_SLOTS.createEpic]>
<create-epic-form <create-epic-form
:slot="$options.FORM_SLOTS.createEpic"
:is-submitting="itemCreateInProgress" :is-submitting="itemCreateInProgress"
@createEpicFormSubmit="handleCreateEpicFormSubmit" @createEpicFormSubmit="handleCreateEpicFormSubmit"
@createEpicFormCancel="handleCreateEpicFormCancel" @createEpicFormCancel="handleCreateEpicFormCancel"
/> />
</template>
<template #[$options.FORM_SLOTS.createIssue]>
<create-issue-form <create-issue-form
:slot="$options.FORM_SLOTS.createIssue"
@cancel="toggleCreateIssueForm({ toggleState: false })" @cancel="toggleCreateIssueForm({ toggleState: false })"
@submit="createNewIssue" @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,7 +92,8 @@ export default { ...@@ -92,7 +92,8 @@ 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>
<div class="mr-widget-grouped-section report-block">
<smart-virtual-list <smart-virtual-list
:length="metrics.length" :length="metrics.length"
:remain="$options.maxShownReportItems" :remain="$options.maxShownReportItems"
...@@ -112,5 +113,6 @@ export default { ...@@ -112,5 +113,6 @@ export default {
/> />
</smart-virtual-list> </smart-virtual-list>
</div> </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">
<span class="item">Item Name: {{ listItem.id }}</span>
</div> </div>
</template>
`; `;
const props = { const props = {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
exports[`Resizable Chart Container renders the component 1`] = ` exports[`Resizable Chart Container renders the component 1`] = `
<div> <div>
<template>
<div <div
class="slot" class="slot"
> >
...@@ -17,5 +18,6 @@ exports[`Resizable Chart Container renders the component 1`] = ` ...@@ -17,5 +18,6 @@ exports[`Resizable Chart Container renders the component 1`] = `
0 0
</span> </span>
</div> </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 }">
<div class="slot">
<span class="width">{{width}}</span> <span class="width">{{width}}</span>
<span class="height">{{height}}</span> <span class="height">{{height}}</span>
</div> </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