-
Notifications
You must be signed in to change notification settings - Fork 200
/
Copy pathdialog.test.js
97 lines (92 loc) · 2.45 KB
/
dialog.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import { Variants } from "@spectrum-css/preview/decorators";
import { Template } from "./template.js";
export const DialogGroup = Variants({
Template: (args, context) => {
const { parameters: { showTestingGrid = false } = {} } = context;
/*
* This template forces each test case to showModal: false, and give a background
* color to the dialog grid container when isChromatic() is true.
* This should ensure that the Sizes within the Variants() template to display correctly.
*/
return Template({
...args,
showModal: showTestingGrid ? false : args.showModal,
// TODO: The dialog's heading arg is getting passed as the "Sizing" heading arg (instead of the
// TODO: word "Sizing"). We should be able to remove this arg once that no longers happens.
heading: showTestingGrid ? "Lorem ipsum dolor sit amet, consectetur adipiscing elit" : args.heading,
customStyles: {
...(args.customStyles ?? {}),
"background-color": showTestingGrid ? "var(--spectrum-gray-100)" : undefined,
},
}, context);
},
sizeDirection: "column",
containerStyles: {
"background-color": "transparent",
},
wrapperStyles: {
"border": "none",
"background-color": "transparent",
"padding": "0",
},
testData: [
{
testHeading: "Standard",
},
{
testHeading: "Dismissible",
isDismissible: true,
hasFooter: false,
},
{
testHeading: "With hero/cover image",
hasHeroImage: true,
heroImageUrl: "example-card-portrait.png",
},
{
testHeading: "With hero/cover image, dismissible",
hasHeroImage: true,
heroImageUrl: "example-card-portrait.png",
isDismissible: true,
hasFooter: false,
},
],
});
export const DialogFullscreen = Variants({
Template: (args, context) => {
const { parameters: { showTestingGrid = false } = {} } = context;
return Template({
...args,
/*
* Custom styles were added to make sure the VRTs catch the rounded corners
*/
customStyles: {
margin: showTestingGrid ? "16px" : undefined,
"background-color": showTestingGrid ? "var(--spectrum-gray-100)" : undefined,
},
}, context);
},
withSizes: false,
wrapperStyles: {
"background-color": "var(--spectrum-gray-50)"
},
testData: [
{
showModal: false,
layout: "fullscreen",
},
],
});
export const DialogFullscreenTakeover = Variants({
Template,
withSizes: false,
wrapperStyles: {
"background-color": "var(--spectrum-gray-50)"
},
testData: [
{
showModal: false,
layout: "fullscreenTakeover",
},
],
});