@vcita/design-system 0.0.12-prod.beta.27 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -21
- package/dist/@vcita/design-system.esm.js +519 -676
- package/dist/@vcita/design-system.min.js +1 -1
- package/dist/@vcita/design-system.ssr.js +449 -608
- package/init/DesignSystem.js +77 -0
- package/init/VcSvg/VcSvg.stories.js +25 -0
- package/{src/components → init}/VcSvg/VcSvg.vue +0 -0
- package/init/vuetify.config.js +132 -0
- package/package.json +6 -5
- package/src/assets/logo.png +0 -0
- package/src/assets/logo.svg +1 -0
- package/src/components/VcActionList/VcActionList.spec.js +57 -0
- package/src/components/VcActionList/VcActionList.stories.js +56 -0
- package/src/components/VcActionList/VcActionList.vue +1 -1
- package/src/components/VcActions/VcActions.spec.js +153 -0
- package/src/components/VcActions/VcActions.stories.js +103 -0
- package/src/components/VcActions/VcActions.vue +14 -6
- package/src/components/VcAlert/VcAlert.spec.js +162 -0
- package/src/components/VcAlert/VcAlert.stories.js +105 -0
- package/src/components/VcAlert/VcAlert.vue +7 -8
- package/src/components/VcAutoComplete/VcAutoComplete.spec.js +67 -0
- package/src/components/VcAutoComplete/VcAutoComplete.stories.js +99 -0
- package/src/components/VcAvatar/VcAvatar.spec.js +110 -0
- package/src/components/VcAvatar/VcAvatar.stories.js +101 -0
- package/src/components/VcBottomActions/VcBottomActions.spec.js +64 -0
- package/src/components/VcBottomActions/VcBottomActions.stories.js +103 -0
- package/src/components/VcBottomActions/VcBottomActions.vue +4 -4
- package/src/components/VcButton/VcButton.spec.js +181 -0
- package/src/components/VcButton/VcButton.stories.js +123 -0
- package/src/components/VcButton/VcButton.stories.mdx.old +40 -0
- package/src/components/VcButtonGroup/VcButtonGroup.spec.js +209 -0
- package/src/components/VcButtonGroup/VcButtonGroup.stories.js +109 -0
- package/src/components/VcButtonGroup/VcButtonGroup.vue +5 -1
- package/src/components/VcCard/VcCard.spec.js +38 -0
- package/src/components/VcCard/VcCard.stories.js +28 -0
- package/src/components/VcCard/VcCard.vue +46 -0
- package/src/components/VcExpansionPanels/VcExpansionPanels.stories.js +36 -0
- package/src/components/VcForm/VcForm.spec.js +38 -0
- package/src/components/VcForm/VcForm.stories.js +44 -0
- package/src/components/VcHourInput/VcHourInput.stories.js +36 -0
- package/src/components/VcIcon/VcIcon.spec.js +38 -0
- package/src/components/VcIcon/VcIcon.stories.js +53 -0
- package/src/components/VcIconWithTooltip/VcIconWithTooltip.spec.js +156 -0
- package/src/components/VcIconWithTooltip/VcIconWithTooltip.stories.js +77 -0
- package/src/components/VcIconWithTooltip/VcIconWithTooltip.vue +7 -6
- package/src/components/VcLayout/VcLayout.spec.js +38 -0
- package/src/components/VcLayout/VcLayout.stories.js +26 -0
- package/src/components/VcLoader/VcLoader.spec.js +38 -0
- package/src/components/VcLoader/VcLoader.stories.js +30 -0
- package/src/components/VcLoader/VcLoader.vue +1 -1
- package/src/components/VcMenu/VcMenu.spec.js +38 -0
- package/src/components/VcMenu/VcMenu.stories.js +45 -0
- package/src/components/VcSwitch/VcSwitch.spec.js +38 -0
- package/src/components/VcSwitch/VcSwitch.stories.js +87 -0
- package/src/components/VcSwitch/VcSwitch.vue +14 -1
- package/src/components/VcTextArea/VcTextArea.spec.js +41 -0
- package/src/components/VcTextArea/VcTextArea.stories.js +144 -0
- package/src/components/VcTextArea/VcTextArea.vue +21 -10
- package/src/components/VcTextField/VcTextField.spec.js +170 -0
- package/src/components/VcTextField/VcTextField.stories.js +65 -0
- package/src/components/VcTextField/VcTextField.vue +4 -3
- package/src/components/VcToast/VcToast.spec.js +75 -0
- package/src/components/VcToast/VcToast.stories.js +80 -0
- package/src/components/VcToast/VcToast.vue +11 -15
- package/src/components/VcTooltip/VcTooltip.spec.js +58 -0
- package/src/components/VcTooltip/VcTooltip.stories.js +163 -0
- package/src/components/VcTooltip/VcTooltip.vue +4 -4
- package/src/components/index.js +26 -0
- package/src/components/modal/VcConfirmModal/VcConfirmModal.spec.js +48 -0
- package/src/components/modal/VcConfirmModal/VcConfirmModal.stories.js +142 -0
- package/src/components/modal/VcConfirmProminentModal/VcConfirmProminentModal.spec.js +49 -0
- package/src/components/modal/VcConfirmProminentModal/VcConfirmProminentModal.stories.js +53 -0
- package/src/components/modal/VcInputModal/VcInputModal.spec.js +79 -0
- package/src/components/modal/VcInputModal/VcInputModal.stories.js +188 -0
- package/src/components/modal/VcNoticeModal/VcNoticeModal.spec.js +54 -0
- package/src/components/modal/VcNoticeModal/VcNoticeModal.stories.js +136 -0
- package/src/components/modal/elements/VcModalContainer.spec.js +38 -0
- package/src/components/modal/elements/VcModalContainer.stories.js +49 -0
- package/src/components/modal/elements/VcModalFooter.spec.js +82 -0
- package/src/components/modal/elements/VcModalFooter.stories.js +47 -0
- package/src/components/modal/elements/VcModalHeader.spec.js +103 -0
- package/src/components/modal/elements/VcModalHeader.stories.js +91 -0
- package/src/components/modal/elements/VcModalWrapper.spec.js +38 -0
- package/src/components/modal/elements/VcModalWrapper.stories.js +34 -0
- package/src/entry.esm.js +16 -0
- package/src/entry.js +13 -0
- package/src/scss/_i18n-mixins.scss +174 -0
- package/src/scss/mixins.scss +7 -0
- package/src/stories/assets/HeaderImage.svg +9 -0
- package/src/stories/assets/code-brackets.svg +1 -0
- package/src/stories/assets/colors.svg +1 -0
- package/src/stories/assets/comments.svg +1 -0
- package/src/stories/assets/direction.svg +1 -0
- package/src/stories/assets/flow.svg +1 -0
- package/src/stories/assets/plugin.svg +1 -0
- package/src/stories/assets/rabbit.svg +17 -0
- package/src/stories/assets/repo.svg +1 -0
- package/src/stories/assets/stackalt.svg +1 -0
- package/src/stories/colors.stories.mdx +78 -0
- package/src/stories/welcome.stories.mdx +210 -0
- package/styles/variables.scss +65 -7
- package/utils/colorUtil.js +41 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import '@testing-library/jest-dom'
|
|
2
|
+
import VcAvatar from "./VcAvatar.vue";
|
|
3
|
+
import init from "../../../testing-library.config"
|
|
4
|
+
import Vuetify from 'vuetify'
|
|
5
|
+
import {render} from "@testing-library/vue";
|
|
6
|
+
|
|
7
|
+
init();
|
|
8
|
+
|
|
9
|
+
const propWithImage = {imagePath: "https://www.w3schools.com/howto/img_avatar.png", text: "John"}
|
|
10
|
+
const propWithText = {text: "John"}
|
|
11
|
+
const propWithOneLetter = {name: "T"}
|
|
12
|
+
const propWithNoLastName = {name: "Thomas"}
|
|
13
|
+
const propWithNameSpace = {name: " "}
|
|
14
|
+
const propWithInitials = {name: "John Snow"}
|
|
15
|
+
const propWithBadgeIcon = {badgeIcon: "flag", name: "JohnSnow"}
|
|
16
|
+
|
|
17
|
+
describe("VcAvatar.vue", () => {
|
|
18
|
+
|
|
19
|
+
const renderWithVuetify = (component, options, callback) => {
|
|
20
|
+
const root = document.createElement('div')
|
|
21
|
+
root.setAttribute('data-app', 'true')
|
|
22
|
+
|
|
23
|
+
return render(
|
|
24
|
+
component,
|
|
25
|
+
{
|
|
26
|
+
container: document.body.appendChild(root),
|
|
27
|
+
// for Vuetify components that use the vuetify instance property
|
|
28
|
+
vuetify: new Vuetify(),
|
|
29
|
+
...options,
|
|
30
|
+
mocks: {
|
|
31
|
+
$t: value => value,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
callback,
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
it("mounts", () => {
|
|
39
|
+
// Queries: https://testing-library.com/docs/queries/about#types-of-queries
|
|
40
|
+
const {container} = renderWithVuetify(VcAvatar, {
|
|
41
|
+
props: {}
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
// Expect options: https://github.com/testing-library/jest-dom
|
|
45
|
+
expect(container).toHaveAttribute('data-app', 'true')
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it("avatar has image", () => {
|
|
49
|
+
const {getByTestId} = renderWithVuetify(VcAvatar, {
|
|
50
|
+
props: propWithImage
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
const image = getByTestId('avatarImage')
|
|
54
|
+
expect(image).toBeInTheDocument()
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("avatar has text", () => {
|
|
58
|
+
const {getByText} = renderWithVuetify(VcAvatar, {
|
|
59
|
+
props: propWithText
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
const text = getByText('John')
|
|
63
|
+
expect(text).toBeInTheDocument()
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("avatar has name of one letter", () => {
|
|
67
|
+
const {getByText} = renderWithVuetify(VcAvatar, {
|
|
68
|
+
props: propWithOneLetter
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
const text = getByText('T')
|
|
72
|
+
expect(text).toBeInTheDocument()
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("avatar has name of two letters", () => {
|
|
76
|
+
const {getByText} = renderWithVuetify(VcAvatar, {
|
|
77
|
+
props: propWithNoLastName
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
const text = getByText('TH')
|
|
81
|
+
expect(text).toBeInTheDocument()
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it("avatar has name of space", () => {
|
|
85
|
+
const {getByTestId} = renderWithVuetify(VcAvatar, {
|
|
86
|
+
props: propWithNameSpace
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
const text = getByTestId('avatar-initials');
|
|
90
|
+
expect(text).toHaveTextContent('');
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it("avatar has initials", () => {
|
|
94
|
+
const {getByText} = renderWithVuetify(VcAvatar, {
|
|
95
|
+
props: propWithInitials
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
const initials = getByText('JS')
|
|
99
|
+
expect(initials).toBeInTheDocument()
|
|
100
|
+
});
|
|
101
|
+
it("avatar has badge icon", () => {
|
|
102
|
+
const {getByTestId} = renderWithVuetify(VcAvatar, {
|
|
103
|
+
props: propWithBadgeIcon
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
const icon = getByTestId('avatarBadgeIcon')
|
|
107
|
+
expect(icon).toBeInTheDocument()
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
});
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import VcAvatarCmp from './VcAvatar';
|
|
2
|
+
|
|
3
|
+
const Template = (args, {argTypes}) => ({
|
|
4
|
+
components: {VcAvatar: VcAvatarCmp},
|
|
5
|
+
props: Object.keys(argTypes),
|
|
6
|
+
template: `<div>
|
|
7
|
+
<VcAvatar
|
|
8
|
+
:color-id="colorId"
|
|
9
|
+
:name="name"
|
|
10
|
+
:text="text"
|
|
11
|
+
:size="size"
|
|
12
|
+
:badgeIcon="badgeIcon"
|
|
13
|
+
:lightMode="lightMode"
|
|
14
|
+
:lightModeTooltip="lightModeTooltip"
|
|
15
|
+
:badgePosition="badgePosition"
|
|
16
|
+
:image-path="imagePath"/>
|
|
17
|
+
</div>`,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const Playground = Template.bind({});
|
|
21
|
+
|
|
22
|
+
Playground.args = {
|
|
23
|
+
size: 'lg',
|
|
24
|
+
colorId: 1,
|
|
25
|
+
name: 'John Smith'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const WithImage = Template.bind({});
|
|
29
|
+
|
|
30
|
+
WithImage.args = {
|
|
31
|
+
imagePath: "https://www.w3schools.com/howto/img_avatar.png",
|
|
32
|
+
size: 'md'
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const WithText = Template.bind({});
|
|
36
|
+
|
|
37
|
+
WithText.args = {
|
|
38
|
+
colorId: 3,
|
|
39
|
+
text: "Text",
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const WithName = Template.bind({});
|
|
43
|
+
|
|
44
|
+
WithName.args = {
|
|
45
|
+
colorId: 1,
|
|
46
|
+
name: "John Smith",
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const WithBadge = Template.bind({});
|
|
50
|
+
|
|
51
|
+
WithBadge.args = {
|
|
52
|
+
colorId: 1,
|
|
53
|
+
imagePath: "https://www.w3schools.com/howto/img_avatar.png",
|
|
54
|
+
badgeIcon: 'flag',
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const WithBadgeLeft = Template.bind({});
|
|
58
|
+
|
|
59
|
+
WithBadgeLeft.args = {
|
|
60
|
+
colorId: 1,
|
|
61
|
+
imagePath: "https://www.w3schools.com/howto/img_avatar.png",
|
|
62
|
+
badgeIcon: 'confirmed',
|
|
63
|
+
badgePosition: 'left'
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const WithLightMode = Template.bind({});
|
|
67
|
+
|
|
68
|
+
WithLightMode.args = {
|
|
69
|
+
lightMode: true,
|
|
70
|
+
lightModeTooltip: 'tooltip',
|
|
71
|
+
text: '+2'
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export default {
|
|
75
|
+
title: 'Content Display / VcAvatar',
|
|
76
|
+
component: VcAvatarCmp,
|
|
77
|
+
id: 'VcAvatarCmp',
|
|
78
|
+
argTypes: {
|
|
79
|
+
size: {
|
|
80
|
+
options: ['x-sm', 'sm','md','lg'],
|
|
81
|
+
control: {type: 'radio'}
|
|
82
|
+
},
|
|
83
|
+
badgePosition: {
|
|
84
|
+
options: ['right', 'left'],
|
|
85
|
+
control: {type: 'radio'}
|
|
86
|
+
},
|
|
87
|
+
badgeIcon: {
|
|
88
|
+
options: ['flag', 'customer','inactive','vip','confirmed'],
|
|
89
|
+
control: {type: 'select'}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
parameters: {
|
|
93
|
+
design: {
|
|
94
|
+
type: 'figma',
|
|
95
|
+
url: 'https://www.figma.com/file/xIOY6fBoA1wpy1tHv3i5js/vcita-ui-library?node-id=95%3A149',
|
|
96
|
+
},
|
|
97
|
+
status: {
|
|
98
|
+
type: 'stable', // 'beta' | 'stable' | 'deprecated' | 'releaseCandidate'
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import '@testing-library/jest-dom'
|
|
2
|
+
import VcBottomActions from "./VcBottomActions.vue";
|
|
3
|
+
import Vuetify from 'vuetify'
|
|
4
|
+
import {render} from "@testing-library/vue";
|
|
5
|
+
import init from "../../../testing-library.config";
|
|
6
|
+
|
|
7
|
+
init();
|
|
8
|
+
|
|
9
|
+
describe("VcBottomActions.vue", () => {
|
|
10
|
+
|
|
11
|
+
const renderWithVuetify = (component, options, callback) => {
|
|
12
|
+
const root = document.createElement('div')
|
|
13
|
+
root.setAttribute('data-app', 'true')
|
|
14
|
+
|
|
15
|
+
return render(
|
|
16
|
+
component,
|
|
17
|
+
{
|
|
18
|
+
container: document.body.appendChild(root),
|
|
19
|
+
// for Vuetify components that use the vuetify instance property
|
|
20
|
+
vuetify: new Vuetify(),
|
|
21
|
+
...options,
|
|
22
|
+
mocks: {},
|
|
23
|
+
},
|
|
24
|
+
callback,
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
const defaultProps = {
|
|
28
|
+
items: [
|
|
29
|
+
{
|
|
30
|
+
title: 'Move to guest list',
|
|
31
|
+
event: 'moveToGustList',
|
|
32
|
+
icon: 'information'
|
|
33
|
+
}, {
|
|
34
|
+
title: 'Remove from wait list',
|
|
35
|
+
event: 'remove',
|
|
36
|
+
icon: 'example'
|
|
37
|
+
}, {
|
|
38
|
+
title: 'Go to client page',
|
|
39
|
+
event: 'goToClientPage',
|
|
40
|
+
icon: 'vip'
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
header: true,
|
|
44
|
+
title: `Ronald's actions`,
|
|
45
|
+
client: {
|
|
46
|
+
imagePath: 'https://i.picsum.photos/id/1025/4951/3301.jpg?hmac=_aGh5AtoOChip_iaMo8ZvvytfEojcgqbCH7dzaz-H8Y',
|
|
47
|
+
name: 'Victor Chohen',
|
|
48
|
+
firstName: 'Ronald',
|
|
49
|
+
colorId: 1
|
|
50
|
+
},
|
|
51
|
+
dataQa: 'bottom-action-test'
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
it("mounts", () => {
|
|
55
|
+
// Queries: https://testing-library.com/docs/queries/about#types-of-queries
|
|
56
|
+
const {container} = renderWithVuetify(VcBottomActions, {
|
|
57
|
+
props: defaultProps
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
// Expect options: https://github.com/testing-library/jest-dom
|
|
61
|
+
expect(container).toHaveAttribute('data-app', 'true')
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
});
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import VcBottomActionsCmp from './VcBottomActions';
|
|
2
|
+
|
|
3
|
+
const GeneralTemplate = (args, {argTypes}) => ({
|
|
4
|
+
components: {VcBottomActions: VcBottomActionsCmp},
|
|
5
|
+
props: Object.keys(argTypes),
|
|
6
|
+
template: `
|
|
7
|
+
<div>
|
|
8
|
+
<VcBottomActions :items="items"
|
|
9
|
+
:header="header"
|
|
10
|
+
:title="title"
|
|
11
|
+
:client="client"
|
|
12
|
+
:data-qa="dataQa"
|
|
13
|
+
@close="onClose"
|
|
14
|
+
@action="onAction">
|
|
15
|
+
<template v-slot="{attrs, on}">
|
|
16
|
+
<v-icon v-bind="attrs" v-on="on">$three_dots</v-icon>
|
|
17
|
+
</template>
|
|
18
|
+
</VcBottomActions>
|
|
19
|
+
</div>`,
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
export const Playground = GeneralTemplate.bind({});
|
|
23
|
+
|
|
24
|
+
// Set default values
|
|
25
|
+
Playground.args = {
|
|
26
|
+
items: [
|
|
27
|
+
{
|
|
28
|
+
title: 'Move to guest list',
|
|
29
|
+
event: 'moveToGustList',
|
|
30
|
+
icon: 'information'
|
|
31
|
+
}, {
|
|
32
|
+
title: 'Remove from waitlist',
|
|
33
|
+
event: 'remove',
|
|
34
|
+
icon: 'example'
|
|
35
|
+
}, {
|
|
36
|
+
title: 'Go to client page',
|
|
37
|
+
event: 'goToClientPage',
|
|
38
|
+
icon: 'vip'
|
|
39
|
+
}],
|
|
40
|
+
header: true,
|
|
41
|
+
title: `Ronald's actions`,
|
|
42
|
+
client: {
|
|
43
|
+
imagePath: 'https://i.picsum.photos/id/1025/4951/3301.jpg?hmac=_aGh5AtoOChip_iaMo8ZvvytfEojcgqbCH7dzaz-H8Y',
|
|
44
|
+
name: 'Victor Chohen',
|
|
45
|
+
firstName: 'Ronald',
|
|
46
|
+
colorId: 1
|
|
47
|
+
},
|
|
48
|
+
dataQa: 'playground-qa'
|
|
49
|
+
}
|
|
50
|
+
const noHeaderTemplate = (args, {argTypes}) => ({
|
|
51
|
+
components: {VcBottomActions: VcBottomActionsCmp},
|
|
52
|
+
props: Object.keys(argTypes),
|
|
53
|
+
template: `
|
|
54
|
+
<div>
|
|
55
|
+
<VcBottomActions :items="items"
|
|
56
|
+
:data-qa="dataQa"
|
|
57
|
+
@close="onClose"
|
|
58
|
+
@action="onAction">
|
|
59
|
+
<template>
|
|
60
|
+
<v-icon>$information</v-icon>
|
|
61
|
+
</template>
|
|
62
|
+
</VcBottomActions>
|
|
63
|
+
</div>`,
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
export const No_Header_Template = noHeaderTemplate.bind({});
|
|
67
|
+
|
|
68
|
+
// Set default values
|
|
69
|
+
No_Header_Template.args = {
|
|
70
|
+
items: [
|
|
71
|
+
{
|
|
72
|
+
title: 'Move to guest list',
|
|
73
|
+
event: 'moveToGustList'
|
|
74
|
+
}, {
|
|
75
|
+
title: 'Remove from wait list',
|
|
76
|
+
event: 'remove'
|
|
77
|
+
}, {
|
|
78
|
+
title: 'Go to client page',
|
|
79
|
+
event: 'goToClientPage'
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
dataQa: 'bottom-sheet-qa'
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export default {
|
|
86
|
+
title: 'Controls / VcBottomActions',
|
|
87
|
+
id: 'VcBottomActions',
|
|
88
|
+
component: VcBottomActionsCmp,
|
|
89
|
+
argTypes: {
|
|
90
|
+
onAction: {action: 'onAction'},
|
|
91
|
+
onClose: {action: 'onClose'},
|
|
92
|
+
},
|
|
93
|
+
parameters: {
|
|
94
|
+
design: {
|
|
95
|
+
type: 'figma',
|
|
96
|
+
url: 'https://www.figma.com/file/lF4Iiyl1UcTQqWpszonNsx/Event\'s-Waitlist?node-id=617%3A83022',
|
|
97
|
+
},
|
|
98
|
+
status: {
|
|
99
|
+
type: 'beta', // 'beta' | 'stable' | 'deprecated' | 'releaseCandidate'
|
|
100
|
+
url: 'https://vuetifyjs.com/en/components/bottom-sheets/',
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-bottom-sheet :persistent="header"
|
|
3
3
|
:value="value"
|
|
4
|
-
@input="(newVal) => $emit('input', {isOpen: newVal})"
|
|
5
4
|
content-class="vc-bottom-sheet">
|
|
6
5
|
|
|
7
6
|
<template v-slot:activator="{attrs, on}">
|
|
@@ -18,8 +17,9 @@
|
|
|
18
17
|
<span v-if="title" class="vc-title" v-html="title"></span>
|
|
19
18
|
<vc-layout class="button-close-wrapper">
|
|
20
19
|
<vc-button class="close-button"
|
|
21
|
-
@click="$emit('
|
|
20
|
+
@click="$emit('close')"
|
|
22
21
|
:ripple="false"
|
|
22
|
+
data-qa="close-sheet-button"
|
|
23
23
|
plain>
|
|
24
24
|
<template #append>
|
|
25
25
|
<vc-icon>$close_button</vc-icon>
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
<v-list-item class="sheet-item"
|
|
32
32
|
v-for="item in items"
|
|
33
33
|
:key="item.title"
|
|
34
|
-
@click="$emit('
|
|
34
|
+
@click="$emit('action', item.event)"
|
|
35
35
|
>
|
|
36
36
|
<vc-layout align-center class="option-title">
|
|
37
37
|
<vc-icon v-if="item.icon && !isNotAllItemsWithIcons" class="icon-item">{{ `$${item.icon}` }}</vc-icon>
|
|
@@ -103,7 +103,7 @@ export default {
|
|
|
103
103
|
.subheader {
|
|
104
104
|
border-bottom: 1px solid rgba(0, 0, 0, 0.12);
|
|
105
105
|
padding: var(--size-value3) var(--size-value4);
|
|
106
|
-
color:
|
|
106
|
+
color: var(--gray-darken-5);
|
|
107
107
|
|
|
108
108
|
.avatar {
|
|
109
109
|
margin-inline-end: var(--size-value3);
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import '@testing-library/jest-dom'
|
|
2
|
+
import VcButton from "./VcButton.vue";
|
|
3
|
+
import init from "../../../testing-library.config"
|
|
4
|
+
import Vuetify from 'vuetify'
|
|
5
|
+
import {render} from "@testing-library/vue";
|
|
6
|
+
|
|
7
|
+
init();
|
|
8
|
+
|
|
9
|
+
const props = {
|
|
10
|
+
basic: {
|
|
11
|
+
lable: 'button 1'
|
|
12
|
+
},
|
|
13
|
+
icon: {
|
|
14
|
+
lable: 'button 1',
|
|
15
|
+
icon: true
|
|
16
|
+
},
|
|
17
|
+
customIcon: {
|
|
18
|
+
lable: 'button 1',
|
|
19
|
+
customIcon: 'arrow_right'
|
|
20
|
+
},
|
|
21
|
+
fab: {
|
|
22
|
+
lable: 'button 1',
|
|
23
|
+
fab: true
|
|
24
|
+
},
|
|
25
|
+
plain: {
|
|
26
|
+
lable: 'button 1',
|
|
27
|
+
plain: true
|
|
28
|
+
},
|
|
29
|
+
xSmall: {
|
|
30
|
+
lable: 'button 1',
|
|
31
|
+
xSmall: true
|
|
32
|
+
},
|
|
33
|
+
small: {
|
|
34
|
+
lable: 'button 1',
|
|
35
|
+
small: true
|
|
36
|
+
},
|
|
37
|
+
large: {
|
|
38
|
+
lable: 'button 1',
|
|
39
|
+
large: true
|
|
40
|
+
},
|
|
41
|
+
xlarge: {
|
|
42
|
+
lable: 'button 1',
|
|
43
|
+
xLarge: true
|
|
44
|
+
},
|
|
45
|
+
loading: {
|
|
46
|
+
lable: 'button 1',
|
|
47
|
+
loading: true
|
|
48
|
+
},
|
|
49
|
+
width: {
|
|
50
|
+
lable: 'button 1',
|
|
51
|
+
width: 20
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
describe("VcButton.vue", () => {
|
|
56
|
+
|
|
57
|
+
const renderWithVuetify = (component, options, callback) => {
|
|
58
|
+
const root = document.createElement('div')
|
|
59
|
+
root.setAttribute('data-app', 'true')
|
|
60
|
+
|
|
61
|
+
return render(
|
|
62
|
+
component,
|
|
63
|
+
{
|
|
64
|
+
container: document.body.appendChild(root),
|
|
65
|
+
// for Vuetify components that use the vuetify instance property
|
|
66
|
+
vuetify: new Vuetify(),
|
|
67
|
+
...options,
|
|
68
|
+
},
|
|
69
|
+
callback,
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
it("render VcButton", () => {
|
|
74
|
+
// Queries: https://testing-library.com/docs/queries/about#types-of-queries
|
|
75
|
+
const {container} = renderWithVuetify(VcButton,{props: props.basic})
|
|
76
|
+
// Expect options: https://github.com/testing-library/jest-dom
|
|
77
|
+
expect(container).toHaveAttribute('data-app', 'true');
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it("button get rounded class", () => {
|
|
81
|
+
const {container} = renderWithVuetify(VcButton,{props: props.icon})
|
|
82
|
+
const roundBtn = container.querySelector('.v-btn--round');
|
|
83
|
+
|
|
84
|
+
expect(roundBtn).toBeInTheDocument();
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it("Button get icon", () => {
|
|
88
|
+
//Todo need to import vuetify config with icons
|
|
89
|
+
// const {container} = renderWithVuetify(VcButton,{props: props.customIcon})
|
|
90
|
+
// const xxx = container.querySelector('.arrow-right')
|
|
91
|
+
// debugger
|
|
92
|
+
//
|
|
93
|
+
// expect(xxx).toBeInTheDocument();
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it("button get class fab (button is round)", () => {
|
|
97
|
+
const {container} = renderWithVuetify(VcButton,{props: props.fab})
|
|
98
|
+
const fabBtn = container.querySelector('.v-btn--fab');
|
|
99
|
+
|
|
100
|
+
expect(fabBtn).toBeInTheDocument();
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// it("button get class plain (background not change on hover)", () => {
|
|
104
|
+
// const {container, debug} = renderWithVuetify(VcButton,{props: props.plain})
|
|
105
|
+
// const plainBtn = container.querySelector('.v-btn--plain');
|
|
106
|
+
//
|
|
107
|
+
// debug();
|
|
108
|
+
//
|
|
109
|
+
// expect(plainBtn).toBeInTheDocument();
|
|
110
|
+
// });
|
|
111
|
+
|
|
112
|
+
it("button get default size class", () => {
|
|
113
|
+
const {container} = renderWithVuetify(VcButton,{props: props.basic})
|
|
114
|
+
const smallBtn = container.querySelector('.v-size--default');
|
|
115
|
+
|
|
116
|
+
expect(smallBtn).toBeInTheDocument();
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it("button get extra small class", () => {
|
|
120
|
+
const {container} = renderWithVuetify(VcButton,{props: props.xSmall})
|
|
121
|
+
const xSmallBtn = container.querySelector('.v-size--x-small');
|
|
122
|
+
|
|
123
|
+
expect(xSmallBtn).toBeInTheDocument();
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it("button get small class", () => {
|
|
127
|
+
const {container} = renderWithVuetify(VcButton,{props: props.small})
|
|
128
|
+
const smallBtn = container.querySelector('.v-size--small');
|
|
129
|
+
|
|
130
|
+
expect(smallBtn).toBeInTheDocument();
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it("button get large class", () => {
|
|
134
|
+
const {container} = renderWithVuetify(VcButton,{props: props.large})
|
|
135
|
+
|
|
136
|
+
const largeBtn = container.querySelector('.v-size--large');
|
|
137
|
+
|
|
138
|
+
expect(largeBtn).toBeInTheDocument();
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it("button get extra-large class", () => {
|
|
142
|
+
const {container} = renderWithVuetify(VcButton,{props: props.xlarge})
|
|
143
|
+
const largeBtn = container.querySelector('.v-size--x-large');
|
|
144
|
+
|
|
145
|
+
expect(largeBtn).toBeInTheDocument();
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it("button show spinner icon", () => {
|
|
149
|
+
const {container} = renderWithVuetify(VcButton,{props: props.loading})
|
|
150
|
+
const loaderBtn = container.querySelector('.v-btn--loading');
|
|
151
|
+
const loaderElem = container.querySelector('.v-btn__loader');
|
|
152
|
+
|
|
153
|
+
expect(loaderBtn).toBeInTheDocument();
|
|
154
|
+
expect(loaderElem).toBeInTheDocument();
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it("button have 20 px width", () => {
|
|
158
|
+
const {container} = renderWithVuetify(VcButton,{props: props.width})
|
|
159
|
+
const btn = container.querySelector('.v-btn');
|
|
160
|
+
|
|
161
|
+
expect(btn).toHaveStyle('width: 20px');
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
it("button get only specific color names", () => {
|
|
165
|
+
const {container} = renderWithVuetify(VcButton,{props: {
|
|
166
|
+
...props.basic,
|
|
167
|
+
color: 'secondary'
|
|
168
|
+
}})
|
|
169
|
+
const btnWithColor = container.querySelector('.secondary');
|
|
170
|
+
|
|
171
|
+
expect(btnWithColor).toBeInTheDocument();
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
it("component failed for having wrong color", () => {
|
|
175
|
+
const validator = VcButton.props.color.validator;
|
|
176
|
+
|
|
177
|
+
expect(validator('#fff')).toBeFalsy();
|
|
178
|
+
expect(validator('spring')).toBeFalsy();
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
});
|