Commit dcdbe435 authored by Natalia Tepluhina's avatar Natalia Tepluhina

Refactor Design management application to match new visual styles

parent 348c4e6e
<script> <script>
import { GlDeprecatedButton, GlModal, GlModalDirective } from '@gitlab/ui'; import { GlButton, GlModal, GlModalDirective } from '@gitlab/ui';
import { uniqueId } from 'lodash'; import { uniqueId } from 'lodash';
import { s__ } from '~/locale';
export default { export default {
name: 'DeleteButton', name: 'DeleteButton',
components: { components: {
GlDeprecatedButton, GlButton,
GlModal, GlModal,
}, },
directives: { directives: {
...@@ -25,7 +26,12 @@ export default { ...@@ -25,7 +26,12 @@ export default {
buttonVariant: { buttonVariant: {
type: String, type: String,
required: false, required: false,
default: '', default: 'info',
},
buttonSize: {
type: String,
required: false,
default: 'medium',
}, },
hasSelectedDesigns: { hasSelectedDesigns: {
type: Boolean, type: Boolean,
...@@ -38,27 +44,38 @@ export default { ...@@ -38,27 +44,38 @@ export default {
modalId: uniqueId('design-deletion-confirmation-'), modalId: uniqueId('design-deletion-confirmation-'),
}; };
}, },
modal: {
title: s__('DesignManagement|Delete designs confirmation'),
actionPrimary: {
text: s__('Delete'),
attributes: { variant: 'danger' },
},
actionCancel: {
text: s__('Cancel'),
},
},
}; };
</script> </script>
<template> <template>
<div> <div class="gl-display-flex gl-align-items-center gl-h-full">
<gl-modal <gl-modal
:modal-id="modalId" :modal-id="modalId"
:title="s__('DesignManagement|Delete designs confirmation')" :title="$options.modal.title"
:ok-title="s__('DesignManagement|Delete')" :action-primary="$options.modal.actionPrimary"
ok-variant="danger" :action-cancel="$options.modal.actionCancel"
@ok="$emit('deleteSelectedDesigns')" @ok="$emit('deleteSelectedDesigns')"
> >
<p>{{ s__('DesignManagement|Are you sure you want to delete the selected designs?') }}</p> <p>{{ s__('DesignManagement|Are you sure you want to delete the selected designs?') }}</p>
</gl-modal> </gl-modal>
<gl-deprecated-button <gl-button
v-gl-modal-directive="modalId" v-gl-modal-directive="modalId"
:variant="buttonVariant" :variant="buttonVariant"
:disabled="isDeleting || !hasSelectedDesigns" :size="buttonSize"
:class="buttonClass" :class="buttonClass"
:disabled="isDeleting || !hasSelectedDesigns"
> >
<slot></slot> <slot></slot>
</gl-deprecated-button> </gl-button>
</div> </div>
</template> </template>
...@@ -127,7 +127,7 @@ export default { ...@@ -127,7 +127,7 @@ export default {
params: { id: filename }, params: { id: filename },
query: $route.query, query: $route.query,
}" }"
class="card cursor-pointer text-plain js-design-list-item design-list-item" class="card cursor-pointer text-plain js-design-list-item design-list-item design-list-item-new"
> >
<div class="card-body p-0 d-flex-center overflow-hidden position-relative"> <div class="card-body p-0 d-flex-center overflow-hidden position-relative">
<div v-if="icon.name" class="design-event position-absolute"> <div v-if="icon.name" class="design-event position-absolute">
......
<script> <script>
import { GlDeprecatedButton, GlLoadingIcon, GlTooltipDirective } from '@gitlab/ui'; import { GlButton, GlLoadingIcon, GlTooltipDirective } from '@gitlab/ui';
import { VALID_DESIGN_FILE_MIMETYPE } from '../../constants'; import { VALID_DESIGN_FILE_MIMETYPE } from '../../constants';
export default { export default {
components: { components: {
GlDeprecatedButton, GlButton,
GlLoadingIcon, GlLoadingIcon,
}, },
directives: { directives: {
...@@ -30,7 +30,7 @@ export default { ...@@ -30,7 +30,7 @@ export default {
<template> <template>
<div> <div>
<gl-deprecated-button <gl-button
v-gl-tooltip.hover v-gl-tooltip.hover
:title=" :title="
s__( s__(
...@@ -39,11 +39,12 @@ export default { ...@@ -39,11 +39,12 @@ export default {
" "
:disabled="isSaving" :disabled="isSaving"
variant="success" variant="success"
size="small"
@click="openFileUpload" @click="openFileUpload"
> >
{{ s__('DesignManagement|Upload designs') }} {{ s__('DesignManagement|Upload designs') }}
<gl-loading-icon v-if="isSaving" inline class="ml-1" /> <gl-loading-icon v-if="isSaving" inline class="ml-1" />
</gl-deprecated-button> </gl-button>
<input <input
ref="fileUpload" ref="fileUpload"
......
...@@ -12,6 +12,12 @@ export default { ...@@ -12,6 +12,12 @@ export default {
GlLink, GlLink,
GlSprintf, GlSprintf,
}, },
props: {
hasDesigns: {
type: Boolean,
required: true,
},
},
data() { data() {
return { return {
dragCounter: 0, dragCounter: 0,
...@@ -76,28 +82,29 @@ export default { ...@@ -76,28 +82,29 @@ export default {
> >
<slot> <slot>
<button <button
class="card design-dropzone-card design-dropzone-border w-100 h-100 d-flex-center p-3" class="card design-dropzone-card design-dropzone-border w-100 h-100 gl-align-items-center gl-justify-content-center gl-p-3"
@click="openFileUpload" @click="openFileUpload"
> >
<div class="d-flex-center flex-column text-center"> <div
<gl-icon name="doc-new" :size="48" class="mb-4" /> :class="{ 'gl-flex-direction-column': hasDesigns }"
<p> class="gl-display-flex gl-align-items-center gl-justify-content-center gl-text-center"
<gl-sprintf data-testid="dropzone-area"
:message=" >
__( <gl-icon name="upload" :size="24" :class="hasDesigns ? 'gl-mb-2' : 'gl-mr-4'" />
'%{lineOneStart}Drag and drop to upload your designs%{lineOneEnd} or %{linkStart}click to upload%{linkEnd}.', <gl-sprintf
) :message="
" __(
> '%{contentStart}Drop files to attach, or %{contentEnd}%{linkStart}browse%{linkEnd}',
<template #lineOne="{ content }" )
><span class="d-block">{{ content }}</span> "
</template> >
<template #content="{ content }">
<template #link="{ content }"> <span class="gl-font-weight-bold">{{ content }}&nbsp;</span>
<gl-link class="h-100 w-100" @click.stop="openFileUpload">{{ content }}</gl-link> </template>
</template> <template #link="{ content }">
</gl-sprintf> <gl-link @click.stop="openFileUpload">{{ content }}</gl-link>
</p> </template>
</gl-sprintf>
</div> </div>
</button> </button>
...@@ -117,7 +124,7 @@ export default { ...@@ -117,7 +124,7 @@ export default {
class="card design-dropzone-border design-dropzone-overlay w-100 h-100 position-absolute d-flex-center p-3 bg-white" class="card design-dropzone-border design-dropzone-overlay w-100 h-100 position-absolute d-flex-center p-3 bg-white"
> >
<div v-show="!isDragDataValid" class="mw-50 text-center"> <div v-show="!isDragDataValid" class="mw-50 text-center">
<h3>{{ __('Oh no!') }}</h3> <h3 :class="{ 'gl-font-base gl-display-inline': !hasDesigns }">{{ __('Oh no!') }}</h3>
<span>{{ <span>{{
__( __(
'You are trying to upload something other than an image. Please upload a .png, .jpg, .jpeg, .gif, .bmp, .tiff or .ico.', 'You are trying to upload something other than an image. Please upload a .png, .jpg, .jpeg, .gif, .bmp, .tiff or .ico.',
...@@ -125,7 +132,7 @@ export default { ...@@ -125,7 +132,7 @@ export default {
}}</span> }}</span>
</div> </div>
<div v-show="isDragDataValid" class="mw-50 text-center"> <div v-show="isDragDataValid" class="mw-50 text-center">
<h3>{{ __('Incoming!') }}</h3> <h3 :class="{ 'gl-font-base gl-display-inline': !hasDesigns }">{{ __('Incoming!') }}</h3>
<span>{{ __('Drop your designs to start your upload.') }}</span> <span>{{ __('Drop your designs to start your upload.') }}</span>
</div> </div>
</div> </div>
......
<script> <script>
import { GlDropdown, GlDropdownItem } from '@gitlab/ui'; import { GlNewDropdown, GlNewDropdownItem } from '@gitlab/ui';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
import allVersionsMixin from '../../mixins/all_versions'; import allVersionsMixin from '../../mixins/all_versions';
import { findVersionId } from '../../utils/design_management_utils'; import { findVersionId } from '../../utils/design_management_utils';
export default { export default {
components: { components: {
GlDropdown, GlNewDropdown,
GlDropdownItem, GlNewDropdownItem,
}, },
mixins: [allVersionsMixin], mixins: [allVersionsMixin],
computed: { computed: {
...@@ -50,8 +50,8 @@ export default { ...@@ -50,8 +50,8 @@ export default {
</script> </script>
<template> <template>
<gl-dropdown :text="dropdownText" variant="link" class="design-version-dropdown"> <gl-new-dropdown :text="dropdownText" size="small" class="design-version-dropdown">
<gl-dropdown-item v-for="(version, index) in allVersions" :key="version.node.id"> <gl-new-dropdown-item v-for="(version, index) in allVersions" :key="version.node.id">
<router-link <router-link
class="d-flex js-version-link" class="d-flex js-version-link"
:to="{ path: $route.path, query: { version: findVersionId(version.node.id) } }" :to="{ path: $route.path, query: { version: findVersionId(version.node.id) } }"
...@@ -71,6 +71,6 @@ export default { ...@@ -71,6 +71,6 @@ export default {
class="fa fa-check pull-right" class="fa fa-check pull-right"
></i> ></i>
</router-link> </router-link>
</gl-dropdown-item> </gl-new-dropdown-item>
</gl-dropdown> </gl-new-dropdown>
</template> </template>
<script> <script>
import { GlLoadingIcon, GlDeprecatedButton, GlAlert } from '@gitlab/ui'; import { GlLoadingIcon, GlButton, GlAlert } from '@gitlab/ui';
import createFlash from '~/flash'; import createFlash from '~/flash';
import { s__, sprintf } from '~/locale'; import { s__, sprintf } from '~/locale';
import UploadButton from '../components/upload/button.vue'; import UploadButton from '../components/upload/button.vue';
...@@ -33,7 +33,7 @@ export default { ...@@ -33,7 +33,7 @@ export default {
components: { components: {
GlLoadingIcon, GlLoadingIcon,
GlAlert, GlAlert,
GlDeprecatedButton, GlButton,
UploadButton, UploadButton,
Design, Design,
DesignDestroyer, DesignDestroyer,
...@@ -96,6 +96,14 @@ export default { ...@@ -96,6 +96,14 @@ export default {
? s__('DesignManagement|Deselect all') ? s__('DesignManagement|Deselect all')
: s__('DesignManagement|Select all'); : s__('DesignManagement|Select all');
}, },
isDesignListEmpty() {
return !this.isSaving && !this.hasDesigns;
},
designDropzoneWrapperClass() {
return this.isDesignListEmpty
? 'col-12'
: 'gl-flex-direction-column col-md-6 col-lg-3 gl-mb-3';
},
}, },
mounted() { mounted() {
this.toggleOnPasteListener(this.$route.name); this.toggleOnPasteListener(this.$route.name);
...@@ -259,18 +267,22 @@ export default { ...@@ -259,18 +267,22 @@ export default {
</script> </script>
<template> <template>
<div data-testid="designs-root"> <div data-testid="designs-root" class="gl-mt-2">
<header v-if="showToolbar" class="row-content-block border-top-0 p-2 d-flex"> <header v-if="showToolbar" class="row-content-block border-top-0 p-2 d-flex">
<div class="d-flex justify-content-between align-items-center w-100"> <div class="gl-display-flex gl-justify-content-space-between gl-align-items-center gl-w-full">
<design-version-dropdown /> <div>
<div :class="['qa-selector-toolbar', { 'd-flex': hasDesigns, 'd-none': !hasDesigns }]"> <span class="gl-font-weight-bold gl-mr-3">{{ s__('DesignManagement|Designs') }}</span>
<gl-deprecated-button <design-version-dropdown />
</div>
<div v-show="hasDesigns" class="qa-selector-toolbar gl-display-flex">
<gl-button
v-if="isLatestVersion" v-if="isLatestVersion"
variant="link" variant="link"
class="mr-2 js-select-all" size="small"
class="gl-mr-2 js-select-all"
@click="toggleDesignsSelection" @click="toggleDesignsSelection"
>{{ selectAllButtonText }}</gl-deprecated-button >{{ selectAllButtonText }}
> </gl-button>
<design-destroyer <design-destroyer
#default="{ mutate, loading }" #default="{ mutate, loading }"
:filenames="selectedDesigns" :filenames="selectedDesigns"
...@@ -280,7 +292,9 @@ export default { ...@@ -280,7 +292,9 @@ export default {
<delete-button <delete-button
v-if="isLatestVersion" v-if="isLatestVersion"
:is-deleting="loading" :is-deleting="loading"
button-class="btn-danger btn-inverted mr-2" button-variant="danger"
button-class="gl-mr-4"
button-size="small"
:has-selected-designs="hasSelectedDesigns" :has-selected-designs="hasSelectedDesigns"
@deleteSelectedDesigns="mutate()" @deleteSelectedDesigns="mutate()"
> >
...@@ -298,11 +312,22 @@ export default { ...@@ -298,11 +312,22 @@ export default {
{{ __('An error occurred while loading designs. Please try again.') }} {{ __('An error occurred while loading designs. Please try again.') }}
</gl-alert> </gl-alert>
<ol v-else class="list-unstyled row"> <ol v-else class="list-unstyled row">
<li class="col-md-6 col-lg-4 mb-3"> <span
<design-dropzone class="design-list-item" @change="onUploadDesign" /> v-if="isDesignListEmpty && !allVersions.length"
class="gl-font-weight-bold gl-font-weight-bold gl-ml-5 gl-mb-4"
>{{ s__('DesignManagement|Designs') }}</span
>
<li :class="designDropzoneWrapperClass" data-testid="design-dropzone-wrapper">
<design-dropzone
:class="{ 'design-list-item design-list-item-new': !isDesignListEmpty }"
:has-designs="hasDesigns"
@change="onUploadDesign"
/>
</li> </li>
<li v-for="design in designs" :key="design.id" class="col-md-6 col-lg-4 mb-3"> <li v-for="design in designs" :key="design.id" class="col-md-6 col-lg-3 gl-mb-3">
<design-dropzone @change="onExistingDesignDropzoneChange($event, design.filename)" <design-dropzone
:has-designs="hasDesigns"
@change="onExistingDesignDropzoneChange($event, design.filename)"
><design v-bind="design" :is-uploading="isDesignToBeSaved(design.filename)" ><design v-bind="design" :is-uploading="isDesignToBeSaved(design.filename)"
/></design-dropzone> /></design-dropzone>
......
...@@ -17,3 +17,8 @@ ...@@ -17,3 +17,8 @@
height: 230px; height: 230px;
} }
} }
// This is temporary class to be removed after feature flag removal: https://gitlab.com/gitlab-org/gitlab/-/issues/223197
.design-list-item-new {
height: 210px;
}
...@@ -4,15 +4,24 @@ ...@@ -4,15 +4,24 @@
- else - else
.js-design-management{ data: { project_path: @project.full_path, issue_iid: @issue.iid, issue_path: project_issue_path(@project, @issue) } } .js-design-management{ data: { project_path: @project.full_path, issue_iid: @issue.iid, issue_path: project_issue_path(@project, @issue) } }
- else - else
.mt-4 - if Feature.enabled?(:design_management_moved, @project)
.row.empty-state .row.empty-state.design-dropzone-border.gl-mt-5
.col-12 .text-content.center.gl-font-weight-bold
.text-content - requirements_link_url = help_page_path('user/project/issues/design_management', anchor: 'requirements')
%h4.center - requirements_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: requirements_link_url }
= _('The one place for your designs') - support_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: support_url }
%p.center - link_end = '</a>'.html_safe
- requirements_link_url = help_page_path('user/project/issues/design_management', anchor: 'requirements') = s_("DesignManagement|To enable design management, you'll need to %{requirements_link_start}meet the requirements%{requirements_link_end}. If you need help, reach out to our %{support_link_start}support team%{support_link_end} for assistance.").html_safe % { requirements_link_start: requirements_link_start, requirements_link_end: link_end, support_link_start: support_link_start, support_link_end: link_end }
- requirements_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: requirements_link_url } - else
- support_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: support_url } .mt-4
- link_end = '</a>'.html_safe .row.empty-state
= s_("DesignManagement|To enable design management, you'll need to %{requirements_link_start}meet the requirements%{requirements_link_end}. If you need help, reach out to our %{support_link_start}support team%{support_link_end} for assistance.").html_safe % { requirements_link_start: requirements_link_start, requirements_link_end: link_end, support_link_start: support_link_start, support_link_end: link_end } .col-12
.text-content
%h4.center
= _('The one place for your designs')
%p.center
- requirements_link_url = help_page_path('user/project/issues/design_management', anchor: 'requirements')
- requirements_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: requirements_link_url }
- support_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: support_url }
- link_end = '</a>'.html_safe
= s_("DesignManagement|To enable design management, you'll need to %{requirements_link_start}meet the requirements%{requirements_link_end}. If you need help, reach out to our %{support_link_start}support team%{support_link_end} for assistance.").html_safe % { requirements_link_start: requirements_link_start, requirements_link_end: link_end, support_link_start: support_link_start, support_link_end: link_end }
...@@ -299,6 +299,9 @@ msgstr "" ...@@ -299,6 +299,9 @@ msgstr ""
msgid "%{containerScanningLinkStart}Container Scanning%{containerScanningLinkEnd} and/or %{dependencyScanningLinkStart}Dependency Scanning%{dependencyScanningLinkEnd} must be enabled. %{securityBotLinkStart}GitLab-Security-Bot%{securityBotLinkEnd} will be the author of the auto-created merge request. %{moreInfoLinkStart}More information%{moreInfoLinkEnd}." msgid "%{containerScanningLinkStart}Container Scanning%{containerScanningLinkEnd} and/or %{dependencyScanningLinkStart}Dependency Scanning%{dependencyScanningLinkEnd} must be enabled. %{securityBotLinkStart}GitLab-Security-Bot%{securityBotLinkEnd} will be the author of the auto-created merge request. %{moreInfoLinkStart}More information%{moreInfoLinkEnd}."
msgstr "" msgstr ""
msgid "%{contentStart}Drop files to attach, or %{contentEnd}%{linkStart}browse%{linkEnd}"
msgstr ""
msgid "%{cores} cores" msgid "%{cores} cores"
msgstr "" msgstr ""
...@@ -7928,6 +7931,9 @@ msgstr "" ...@@ -7928,6 +7931,9 @@ msgstr ""
msgid "DesignManagement|Deselect all" msgid "DesignManagement|Deselect all"
msgstr "" msgstr ""
msgid "DesignManagement|Designs"
msgstr ""
msgid "DesignManagement|Discard comment" msgid "DesignManagement|Discard comment"
msgstr "" msgstr ""
...@@ -7970,7 +7976,7 @@ msgstr "" ...@@ -7970,7 +7976,7 @@ msgstr ""
msgid "DesignManagement|The maximum number of designs allowed to be uploaded is %{upload_limit}. Please try again." msgid "DesignManagement|The maximum number of designs allowed to be uploaded is %{upload_limit}. Please try again."
msgstr "" msgstr ""
msgid "DesignManagement|To enable design management, you'll need to %{requirements_link_start}meet the requirements%{requirements_link_end}. If you need help, reach out to our %{support_link_start}support team%{support_link_end} for assistance." msgid "DesignManagement|To enable design management, you'll need to %{requirements_link_start}meet the requirements%{requirements_link_end}. If you need help, reach out to our %{support_link_start}support team%{support_link_end} for assistance."
msgstr "" msgstr ""
msgid "DesignManagement|Unresolve thread" msgid "DesignManagement|Unresolve thread"
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { GlDeprecatedButton, GlModal, GlModalDirective } from '@gitlab/ui'; import { GlButton, GlModal, GlModalDirective } from '@gitlab/ui';
import BatchDeleteButton from '~/design_management_new/components/delete_button.vue'; import BatchDeleteButton from '~/design_management_new/components/delete_button.vue';
describe('Batch delete button component', () => { describe('Batch delete button component', () => {
let wrapper; let wrapper;
const findButton = () => wrapper.find(GlDeprecatedButton); const findButton = () => wrapper.find(GlButton);
const findModal = () => wrapper.find(GlModal); const findModal = () => wrapper.find(GlModal);
function createComponent(isDeleting = false) { function createComponent(isDeleting = false) {
......
...@@ -10,7 +10,7 @@ exports[`Design management list item component when item appears in view after i ...@@ -10,7 +10,7 @@ exports[`Design management list item component when item appears in view after i
exports[`Design management list item component with no notes renders item with correct status icon for creation event 1`] = ` exports[`Design management list item component with no notes renders item with correct status icon for creation event 1`] = `
<router-link-stub <router-link-stub
class="card cursor-pointer text-plain js-design-list-item design-list-item" class="card cursor-pointer text-plain js-design-list-item design-list-item design-list-item-new"
to="[object Object]" to="[object Object]"
> >
<div <div
...@@ -78,7 +78,7 @@ exports[`Design management list item component with no notes renders item with c ...@@ -78,7 +78,7 @@ exports[`Design management list item component with no notes renders item with c
exports[`Design management list item component with no notes renders item with correct status icon for deletion event 1`] = ` exports[`Design management list item component with no notes renders item with correct status icon for deletion event 1`] = `
<router-link-stub <router-link-stub
class="card cursor-pointer text-plain js-design-list-item design-list-item" class="card cursor-pointer text-plain js-design-list-item design-list-item design-list-item-new"
to="[object Object]" to="[object Object]"
> >
<div <div
...@@ -146,7 +146,7 @@ exports[`Design management list item component with no notes renders item with c ...@@ -146,7 +146,7 @@ exports[`Design management list item component with no notes renders item with c
exports[`Design management list item component with no notes renders item with correct status icon for modification event 1`] = ` exports[`Design management list item component with no notes renders item with correct status icon for modification event 1`] = `
<router-link-stub <router-link-stub
class="card cursor-pointer text-plain js-design-list-item design-list-item" class="card cursor-pointer text-plain js-design-list-item design-list-item design-list-item-new"
to="[object Object]" to="[object Object]"
> >
<div <div
...@@ -214,7 +214,7 @@ exports[`Design management list item component with no notes renders item with c ...@@ -214,7 +214,7 @@ exports[`Design management list item component with no notes renders item with c
exports[`Design management list item component with no notes renders item with no status icon for none event 1`] = ` exports[`Design management list item component with no notes renders item with no status icon for none event 1`] = `
<router-link-stub <router-link-stub
class="card cursor-pointer text-plain js-design-list-item design-list-item" class="card cursor-pointer text-plain js-design-list-item design-list-item design-list-item-new"
to="[object Object]" to="[object Object]"
> >
<div <div
...@@ -269,7 +269,7 @@ exports[`Design management list item component with no notes renders item with n ...@@ -269,7 +269,7 @@ exports[`Design management list item component with no notes renders item with n
exports[`Design management list item component with no notes renders loading spinner when isUploading is true 1`] = ` exports[`Design management list item component with no notes renders loading spinner when isUploading is true 1`] = `
<router-link-stub <router-link-stub
class="card cursor-pointer text-plain js-design-list-item design-list-item" class="card cursor-pointer text-plain js-design-list-item design-list-item design-list-item-new"
to="[object Object]" to="[object Object]"
> >
<div <div
...@@ -329,7 +329,7 @@ exports[`Design management list item component with no notes renders loading spi ...@@ -329,7 +329,7 @@ exports[`Design management list item component with no notes renders loading spi
exports[`Design management list item component with notes renders item with multiple comments 1`] = ` exports[`Design management list item component with notes renders item with multiple comments 1`] = `
<router-link-stub <router-link-stub
class="card cursor-pointer text-plain js-design-list-item design-list-item" class="card cursor-pointer text-plain js-design-list-item design-list-item design-list-item-new"
to="[object Object]" to="[object Object]"
> >
<div <div
...@@ -401,7 +401,7 @@ exports[`Design management list item component with notes renders item with mult ...@@ -401,7 +401,7 @@ exports[`Design management list item component with notes renders item with mult
exports[`Design management list item component with notes renders item with single comment 1`] = ` exports[`Design management list item component with notes renders item with single comment 1`] = `
<router-link-stub <router-link-stub
class="card cursor-pointer text-plain js-design-list-item design-list-item" class="card cursor-pointer text-plain js-design-list-item design-list-item design-list-item-new"
to="[object Object]" to="[object Object]"
> >
<div <div
......
...@@ -50,6 +50,7 @@ exports[`Design management toolbar component renders design and updated data 1`] ...@@ -50,6 +50,7 @@ exports[`Design management toolbar component renders design and updated data 1`]
<delete-button-stub <delete-button-stub
buttonclass="" buttonclass=""
buttonsize="medium"
buttonvariant="danger" buttonvariant="danger"
hasselecteddesigns="true" hasselecteddesigns="true"
> >
......
...@@ -4,8 +4,10 @@ exports[`Design management upload button component renders inverted upload desig ...@@ -4,8 +4,10 @@ exports[`Design management upload button component renders inverted upload desig
<div <div
isinverted="true" isinverted="true"
> >
<gl-deprecated-button-stub <gl-button-stub
size="md" category="tertiary"
icon=""
size="small"
title="Adding a design with the same filename replaces the file in a new version." title="Adding a design with the same filename replaces the file in a new version."
variant="success" variant="success"
> >
...@@ -13,7 +15,7 @@ exports[`Design management upload button component renders inverted upload desig ...@@ -13,7 +15,7 @@ exports[`Design management upload button component renders inverted upload desig
Upload designs Upload designs
<!----> <!---->
</gl-deprecated-button-stub> </gl-button-stub>
<input <input
accept="image/*" accept="image/*"
...@@ -27,9 +29,11 @@ exports[`Design management upload button component renders inverted upload desig ...@@ -27,9 +29,11 @@ exports[`Design management upload button component renders inverted upload desig
exports[`Design management upload button component renders loading icon 1`] = ` exports[`Design management upload button component renders loading icon 1`] = `
<div> <div>
<gl-deprecated-button-stub <gl-button-stub
category="tertiary"
disabled="true" disabled="true"
size="md" icon=""
size="small"
title="Adding a design with the same filename replaces the file in a new version." title="Adding a design with the same filename replaces the file in a new version."
variant="success" variant="success"
> >
...@@ -43,7 +47,7 @@ exports[`Design management upload button component renders loading icon 1`] = ` ...@@ -43,7 +47,7 @@ exports[`Design management upload button component renders loading icon 1`] = `
label="Loading" label="Loading"
size="sm" size="sm"
/> />
</gl-deprecated-button-stub> </gl-button-stub>
<input <input
accept="image/*" accept="image/*"
...@@ -57,8 +61,10 @@ exports[`Design management upload button component renders loading icon 1`] = ` ...@@ -57,8 +61,10 @@ exports[`Design management upload button component renders loading icon 1`] = `
exports[`Design management upload button component renders upload design button 1`] = ` exports[`Design management upload button component renders upload design button 1`] = `
<div> <div>
<gl-deprecated-button-stub <gl-button-stub
size="md" category="tertiary"
icon=""
size="small"
title="Adding a design with the same filename replaces the file in a new version." title="Adding a design with the same filename replaces the file in a new version."
variant="success" variant="success"
> >
...@@ -66,7 +72,7 @@ exports[`Design management upload button component renders upload design button ...@@ -66,7 +72,7 @@ exports[`Design management upload button component renders upload design button
Upload designs Upload designs
<!----> <!---->
</gl-deprecated-button-stub> </gl-button-stub>
<input <input
accept="image/*" accept="image/*"
......
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Design management design version dropdown component renders design version dropdown button 1`] = ` exports[`Design management design version dropdown component renders design version dropdown button 1`] = `
<gl-dropdown-stub <gl-new-dropdown-stub
category="tertiary"
class="design-version-dropdown" class="design-version-dropdown"
headertext=""
issueiid="" issueiid=""
projectpath="" projectpath=""
size="small"
text="Showing Latest Version" text="Showing Latest Version"
variant="link" variant="default"
> >
<gl-dropdown-item-stub> <gl-new-dropdown-item-stub
avatarurl=""
iconcolor=""
iconname=""
iconrightname=""
secondarytext=""
>
<router-link-stub <router-link-stub
class="d-flex js-version-link" class="d-flex js-version-link"
to="[object Object]" to="[object Object]"
...@@ -31,8 +40,14 @@ exports[`Design management design version dropdown component renders design vers ...@@ -31,8 +40,14 @@ exports[`Design management design version dropdown component renders design vers
class="fa fa-check pull-right" class="fa fa-check pull-right"
/> />
</router-link-stub> </router-link-stub>
</gl-dropdown-item-stub> </gl-new-dropdown-item-stub>
<gl-dropdown-item-stub> <gl-new-dropdown-item-stub
avatarurl=""
iconcolor=""
iconname=""
iconrightname=""
secondarytext=""
>
<router-link-stub <router-link-stub
class="d-flex js-version-link" class="d-flex js-version-link"
to="[object Object]" to="[object Object]"
...@@ -51,19 +66,28 @@ exports[`Design management design version dropdown component renders design vers ...@@ -51,19 +66,28 @@ exports[`Design management design version dropdown component renders design vers
<!----> <!---->
</router-link-stub> </router-link-stub>
</gl-dropdown-item-stub> </gl-new-dropdown-item-stub>
</gl-dropdown-stub> </gl-new-dropdown-stub>
`; `;
exports[`Design management design version dropdown component renders design version list 1`] = ` exports[`Design management design version dropdown component renders design version list 1`] = `
<gl-dropdown-stub <gl-new-dropdown-stub
category="tertiary"
class="design-version-dropdown" class="design-version-dropdown"
headertext=""
issueiid="" issueiid=""
projectpath="" projectpath=""
size="small"
text="Showing Latest Version" text="Showing Latest Version"
variant="link" variant="default"
> >
<gl-dropdown-item-stub> <gl-new-dropdown-item-stub
avatarurl=""
iconcolor=""
iconname=""
iconrightname=""
secondarytext=""
>
<router-link-stub <router-link-stub
class="d-flex js-version-link" class="d-flex js-version-link"
to="[object Object]" to="[object Object]"
...@@ -86,8 +110,14 @@ exports[`Design management design version dropdown component renders design vers ...@@ -86,8 +110,14 @@ exports[`Design management design version dropdown component renders design vers
class="fa fa-check pull-right" class="fa fa-check pull-right"
/> />
</router-link-stub> </router-link-stub>
</gl-dropdown-item-stub> </gl-new-dropdown-item-stub>
<gl-dropdown-item-stub> <gl-new-dropdown-item-stub
avatarurl=""
iconcolor=""
iconname=""
iconrightname=""
secondarytext=""
>
<router-link-stub <router-link-stub
class="d-flex js-version-link" class="d-flex js-version-link"
to="[object Object]" to="[object Object]"
...@@ -106,6 +136,6 @@ exports[`Design management design version dropdown component renders design vers ...@@ -106,6 +136,6 @@ exports[`Design management design version dropdown component renders design vers
<!----> <!---->
</router-link-stub> </router-link-stub>
</gl-dropdown-item-stub> </gl-new-dropdown-item-stub>
</gl-dropdown-stub> </gl-new-dropdown-stub>
`; `;
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import DesignDropzone from '~/design_management_new/components/upload/design_dropzone.vue'; import DesignDropzone from '~/design_management_new/components/upload/design_dropzone.vue';
import createFlash from '~/flash'; import createFlash from '~/flash';
import { GlIcon } from '@gitlab/ui';
jest.mock('~/flash'); jest.mock('~/flash');
...@@ -12,10 +13,16 @@ describe('Design management dropzone component', () => { ...@@ -12,10 +13,16 @@ describe('Design management dropzone component', () => {
}; };
const findDropzoneCard = () => wrapper.find('.design-dropzone-card'); const findDropzoneCard = () => wrapper.find('.design-dropzone-card');
const findDropzoneArea = () => wrapper.find('[data-testid="dropzone-area"]');
const findIcon = () => wrapper.find(GlIcon);
function createComponent({ slots = {}, data = {} } = {}) { function createComponent({ slots = {}, data = {}, props = {} } = {}) {
wrapper = shallowMount(DesignDropzone, { wrapper = shallowMount(DesignDropzone, {
slots, slots,
propsData: {
hasDesigns: true,
...props,
},
data() { data() {
return data; return data;
}, },
...@@ -129,4 +136,16 @@ describe('Design management dropzone component', () => { ...@@ -129,4 +136,16 @@ describe('Design management dropzone component', () => {
}); });
}); });
}); });
it('applies correct classes when there are no designs or no design saving loader', () => {
createComponent({ props: { hasDesigns: false } });
expect(findDropzoneArea().classes()).not.toContain('gl-flex-direction-column');
expect(findIcon().classes()).toEqual(['gl-mr-4']);
});
it('applies correct classes when there are designs or design saving loader', () => {
createComponent({ props: { hasDesigns: true } });
expect(findDropzoneArea().classes()).toContain('gl-flex-direction-column');
expect(findIcon().classes()).toEqual(['gl-mb-2']);
});
}); });
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import DesignVersionDropdown from '~/design_management_new/components/upload/design_version_dropdown.vue'; import DesignVersionDropdown from '~/design_management_new/components/upload/design_version_dropdown.vue';
import { GlDropdown, GlDropdownItem } from '@gitlab/ui'; import { GlNewDropdown, GlNewDropdownItem } from '@gitlab/ui';
import mockAllVersions from './mock_data/all_versions'; import mockAllVersions from './mock_data/all_versions';
const LATEST_VERSION_ID = 3; const LATEST_VERSION_ID = 3;
...@@ -75,7 +75,7 @@ describe('Design management design version dropdown component', () => { ...@@ -75,7 +75,7 @@ describe('Design management design version dropdown component', () => {
createComponent(); createComponent();
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(wrapper.find(GlDropdown).attributes('text')).toBe('Showing Latest Version'); expect(wrapper.find(GlNewDropdown).attributes('text')).toBe('Showing Latest Version');
}); });
}); });
...@@ -83,7 +83,7 @@ describe('Design management design version dropdown component', () => { ...@@ -83,7 +83,7 @@ describe('Design management design version dropdown component', () => {
createComponent({ maxVersions: 1 }); createComponent({ maxVersions: 1 });
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(wrapper.find(GlDropdown).attributes('text')).toBe('Showing Latest Version'); expect(wrapper.find(GlNewDropdown).attributes('text')).toBe('Showing Latest Version');
}); });
}); });
...@@ -91,7 +91,7 @@ describe('Design management design version dropdown component', () => { ...@@ -91,7 +91,7 @@ describe('Design management design version dropdown component', () => {
createComponent({ $route: designRouteFactory(PREVIOUS_VERSION_ID) }); createComponent({ $route: designRouteFactory(PREVIOUS_VERSION_ID) });
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(wrapper.find(GlDropdown).attributes('text')).toBe(`Showing Version #1`); expect(wrapper.find(GlNewDropdown).attributes('text')).toBe(`Showing Version #1`);
}); });
}); });
...@@ -99,7 +99,7 @@ describe('Design management design version dropdown component', () => { ...@@ -99,7 +99,7 @@ describe('Design management design version dropdown component', () => {
createComponent({ $route: designRouteFactory(LATEST_VERSION_ID) }); createComponent({ $route: designRouteFactory(LATEST_VERSION_ID) });
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(wrapper.find(GlDropdown).attributes('text')).toBe('Showing Latest Version'); expect(wrapper.find(GlNewDropdown).attributes('text')).toBe('Showing Latest Version');
}); });
}); });
...@@ -107,7 +107,7 @@ describe('Design management design version dropdown component', () => { ...@@ -107,7 +107,7 @@ describe('Design management design version dropdown component', () => {
createComponent(); createComponent();
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(wrapper.findAll(GlDropdownItem)).toHaveLength(wrapper.vm.allVersions.length); expect(wrapper.findAll(GlNewDropdownItem)).toHaveLength(wrapper.vm.allVersions.length);
}); });
}); });
}); });
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
exports[`Design management index page designs does not render toolbar when there is no permission 1`] = ` exports[`Design management index page designs does not render toolbar when there is no permission 1`] = `
<div <div
class="gl-mt-2"
data-testid="designs-root" data-testid="designs-root"
> >
<!----> <!---->
...@@ -12,18 +13,24 @@ exports[`Design management index page designs does not render toolbar when there ...@@ -12,18 +13,24 @@ exports[`Design management index page designs does not render toolbar when there
<ol <ol
class="list-unstyled row" class="list-unstyled row"
> >
<!---->
<li <li
class="col-md-6 col-lg-4 mb-3" class="gl-flex-direction-column col-md-6 col-lg-3 gl-mb-3"
data-testid="design-dropzone-wrapper"
> >
<design-dropzone-stub <design-dropzone-stub
class="design-list-item" class="design-list-item design-list-item-new"
hasdesigns="true"
/> />
</li> </li>
<li <li
class="col-md-6 col-lg-4 mb-3" class="col-md-6 col-lg-3 gl-mb-3"
> >
<design-dropzone-stub> <design-dropzone-stub
hasdesigns="true"
>
<design-stub <design-stub
event="NONE" event="NONE"
filename="design-1-name" filename="design-1-name"
...@@ -36,9 +43,11 @@ exports[`Design management index page designs does not render toolbar when there ...@@ -36,9 +43,11 @@ exports[`Design management index page designs does not render toolbar when there
<!----> <!---->
</li> </li>
<li <li
class="col-md-6 col-lg-4 mb-3" class="col-md-6 col-lg-3 gl-mb-3"
> >
<design-dropzone-stub> <design-dropzone-stub
hasdesigns="true"
>
<design-stub <design-stub
event="NONE" event="NONE"
filename="design-2-name" filename="design-2-name"
...@@ -51,9 +60,11 @@ exports[`Design management index page designs does not render toolbar when there ...@@ -51,9 +60,11 @@ exports[`Design management index page designs does not render toolbar when there
<!----> <!---->
</li> </li>
<li <li
class="col-md-6 col-lg-4 mb-3" class="col-md-6 col-lg-3 gl-mb-3"
> >
<design-dropzone-stub> <design-dropzone-stub
hasdesigns="true"
>
<design-stub <design-stub
event="NONE" event="NONE"
filename="design-3-name" filename="design-3-name"
...@@ -76,31 +87,44 @@ exports[`Design management index page designs does not render toolbar when there ...@@ -76,31 +87,44 @@ exports[`Design management index page designs does not render toolbar when there
exports[`Design management index page designs renders designs list and header with upload button 1`] = ` exports[`Design management index page designs renders designs list and header with upload button 1`] = `
<div <div
class="gl-mt-2"
data-testid="designs-root" data-testid="designs-root"
> >
<header <header
class="row-content-block border-top-0 p-2 d-flex" class="row-content-block border-top-0 p-2 d-flex"
> >
<div <div
class="d-flex justify-content-between align-items-center w-100" class="gl-display-flex gl-justify-content-space-between gl-align-items-center gl-w-full"
> >
<design-version-dropdown-stub /> <div>
<span
class="gl-font-weight-bold gl-mr-3"
>
Designs
</span>
<design-version-dropdown-stub />
</div>
<div <div
class="qa-selector-toolbar d-flex" class="qa-selector-toolbar gl-display-flex"
> >
<gl-deprecated-button-stub <gl-button-stub
class="mr-2 js-select-all" category="tertiary"
size="md" class="gl-mr-2 js-select-all"
icon=""
size="small"
variant="link" variant="link"
> >
Select all Select all
</gl-deprecated-button-stub>
</gl-button-stub>
<div> <div>
<delete-button-stub <delete-button-stub
buttonclass="btn-danger btn-inverted mr-2" buttonclass="gl-mr-4"
buttonvariant="" buttonsize="small"
buttonvariant="danger"
> >
Delete selected Delete selected
...@@ -120,18 +144,24 @@ exports[`Design management index page designs renders designs list and header wi ...@@ -120,18 +144,24 @@ exports[`Design management index page designs renders designs list and header wi
<ol <ol
class="list-unstyled row" class="list-unstyled row"
> >
<!---->
<li <li
class="col-md-6 col-lg-4 mb-3" class="gl-flex-direction-column col-md-6 col-lg-3 gl-mb-3"
data-testid="design-dropzone-wrapper"
> >
<design-dropzone-stub <design-dropzone-stub
class="design-list-item" class="design-list-item design-list-item-new"
hasdesigns="true"
/> />
</li> </li>
<li <li
class="col-md-6 col-lg-4 mb-3" class="col-md-6 col-lg-3 gl-mb-3"
> >
<design-dropzone-stub> <design-dropzone-stub
hasdesigns="true"
>
<design-stub <design-stub
event="NONE" event="NONE"
filename="design-1-name" filename="design-1-name"
...@@ -147,9 +177,11 @@ exports[`Design management index page designs renders designs list and header wi ...@@ -147,9 +177,11 @@ exports[`Design management index page designs renders designs list and header wi
/> />
</li> </li>
<li <li
class="col-md-6 col-lg-4 mb-3" class="col-md-6 col-lg-3 gl-mb-3"
> >
<design-dropzone-stub> <design-dropzone-stub
hasdesigns="true"
>
<design-stub <design-stub
event="NONE" event="NONE"
filename="design-2-name" filename="design-2-name"
...@@ -165,9 +197,11 @@ exports[`Design management index page designs renders designs list and header wi ...@@ -165,9 +197,11 @@ exports[`Design management index page designs renders designs list and header wi
/> />
</li> </li>
<li <li
class="col-md-6 col-lg-4 mb-3" class="col-md-6 col-lg-3 gl-mb-3"
> >
<design-dropzone-stub> <design-dropzone-stub
hasdesigns="true"
>
<design-stub <design-stub
event="NONE" event="NONE"
filename="design-3-name" filename="design-3-name"
...@@ -193,6 +227,7 @@ exports[`Design management index page designs renders designs list and header wi ...@@ -193,6 +227,7 @@ exports[`Design management index page designs renders designs list and header wi
exports[`Design management index page designs renders error 1`] = ` exports[`Design management index page designs renders error 1`] = `
<div <div
class="gl-mt-2"
data-testid="designs-root" data-testid="designs-root"
> >
<!----> <!---->
...@@ -223,6 +258,7 @@ exports[`Design management index page designs renders error 1`] = ` ...@@ -223,6 +258,7 @@ exports[`Design management index page designs renders error 1`] = `
exports[`Design management index page designs renders loading icon 1`] = ` exports[`Design management index page designs renders loading icon 1`] = `
<div <div
class="gl-mt-2"
data-testid="designs-root" data-testid="designs-root"
> >
<!----> <!---->
...@@ -243,8 +279,9 @@ exports[`Design management index page designs renders loading icon 1`] = ` ...@@ -243,8 +279,9 @@ exports[`Design management index page designs renders loading icon 1`] = `
</div> </div>
`; `;
exports[`Design management index page when has no designs renders empty text 1`] = ` exports[`Design management index page when has no designs renders design dropzone 1`] = `
<div <div
class="gl-mt-2"
data-testid="designs-root" data-testid="designs-root"
> >
<!----> <!---->
...@@ -255,11 +292,18 @@ exports[`Design management index page when has no designs renders empty text 1`] ...@@ -255,11 +292,18 @@ exports[`Design management index page when has no designs renders empty text 1`]
<ol <ol
class="list-unstyled row" class="list-unstyled row"
> >
<span
class="gl-font-weight-bold gl-font-weight-bold gl-ml-5 gl-mb-4"
>
Designs
</span>
<li <li
class="col-md-6 col-lg-4 mb-3" class="col-12"
data-testid="design-dropzone-wrapper"
> >
<design-dropzone-stub <design-dropzone-stub
class="design-list-item" class=""
/> />
</li> </li>
......
...@@ -68,6 +68,8 @@ describe('Design management index page', () => { ...@@ -68,6 +68,8 @@ describe('Design management index page', () => {
const findToolbar = () => wrapper.find('.qa-selector-toolbar'); const findToolbar = () => wrapper.find('.qa-selector-toolbar');
const findDeleteButton = () => wrapper.find(DeleteButton); const findDeleteButton = () => wrapper.find(DeleteButton);
const findDropzone = () => wrapper.findAll(DesignDropzone).at(0); const findDropzone = () => wrapper.findAll(DesignDropzone).at(0);
const dropzoneClasses = () => findDropzone().classes();
const findDropzoneWrapper = () => wrapper.find('[data-testid="design-dropzone-wrapper"]');
const findFirstDropzoneWithDesign = () => wrapper.findAll(DesignDropzone).at(1); const findFirstDropzoneWithDesign = () => wrapper.findAll(DesignDropzone).at(1);
function createComponent({ function createComponent({
...@@ -151,6 +153,22 @@ describe('Design management index page', () => { ...@@ -151,6 +153,22 @@ describe('Design management index page', () => {
expect(wrapper.element).toMatchSnapshot(); expect(wrapper.element).toMatchSnapshot();
}); });
it('has correct classes applied to design dropzone', () => {
createComponent({ designs: mockDesigns, allVersions: [mockVersion] });
expect(dropzoneClasses()).toContain('design-list-item');
expect(dropzoneClasses()).toContain('design-list-item-new');
});
it('has correct classes applied to dropzone wrapper', () => {
createComponent({ designs: mockDesigns, allVersions: [mockVersion] });
expect(findDropzoneWrapper().classes()).toEqual([
'gl-flex-direction-column',
'col-md-6',
'col-lg-3',
'gl-mb-3',
]);
});
}); });
describe('when has no designs', () => { describe('when has no designs', () => {
...@@ -158,11 +176,20 @@ describe('Design management index page', () => { ...@@ -158,11 +176,20 @@ describe('Design management index page', () => {
createComponent(); createComponent();
}); });
it('renders empty text', () => it('renders design dropzone', () =>
wrapper.vm.$nextTick().then(() => { wrapper.vm.$nextTick().then(() => {
expect(wrapper.element).toMatchSnapshot(); expect(wrapper.element).toMatchSnapshot();
})); }));
it('has correct classes applied to design dropzone', () => {
expect(dropzoneClasses()).not.toContain('design-list-item');
expect(dropzoneClasses()).not.toContain('design-list-item-new');
});
it('has correct classes applied to dropzone wrapper', () => {
expect(findDropzoneWrapper().classes()).toEqual(['col-12']);
});
it('does not render a toolbar with buttons', () => it('does not render a toolbar with buttons', () =>
wrapper.vm.$nextTick().then(() => { wrapper.vm.$nextTick().then(() => {
expect(findToolbar().exists()).toBe(false); expect(findToolbar().exists()).toBe(false);
...@@ -227,12 +254,18 @@ describe('Design management index page', () => { ...@@ -227,12 +254,18 @@ describe('Design management index page', () => {
}, },
}; };
return wrapper.vm.$nextTick().then(() => { return wrapper.vm
findDropzone().vm.$emit('change', [{ name: 'test' }]); .$nextTick()
expect(mutate).toHaveBeenCalledWith(mutationVariables); .then(() => {
expect(wrapper.vm.filesToBeSaved).toEqual([{ name: 'test' }]); findDropzone().vm.$emit('change', [{ name: 'test' }]);
expect(wrapper.vm.isSaving).toBeTruthy(); expect(mutate).toHaveBeenCalledWith(mutationVariables);
}); expect(wrapper.vm.filesToBeSaved).toEqual([{ name: 'test' }]);
expect(wrapper.vm.isSaving).toBeTruthy();
})
.then(() => {
expect(dropzoneClasses()).toContain('design-list-item');
expect(dropzoneClasses()).toContain('design-list-item-new');
});
}); });
it('sets isSaving', () => { it('sets isSaving', () => {
...@@ -380,8 +413,7 @@ describe('Design management index page', () => { ...@@ -380,8 +413,7 @@ describe('Design management index page', () => {
it('renders toolbar buttons', () => { it('renders toolbar buttons', () => {
expect(findToolbar().exists()).toBe(true); expect(findToolbar().exists()).toBe(true);
expect(findToolbar().classes()).toContain('d-flex'); expect(findToolbar().isVisible()).toBe(true);
expect(findToolbar().classes()).not.toContain('d-none');
}); });
it('adds two designs to selected designs when their checkboxes are checked', () => { it('adds two designs to selected designs when their checkboxes are checked', () => {
...@@ -440,7 +472,7 @@ describe('Design management index page', () => { ...@@ -440,7 +472,7 @@ describe('Design management index page', () => {
it('on latest version when has no designs toolbar buttons are invisible', () => { it('on latest version when has no designs toolbar buttons are invisible', () => {
createComponent({ designs: [], allVersions: [mockVersion] }); createComponent({ designs: [], allVersions: [mockVersion] });
expect(findToolbar().classes()).toContain('d-none'); expect(findToolbar().isVisible()).toBe(false);
}); });
describe('on non-latest version', () => { describe('on non-latest version', () => {
......
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