@laerdal/life-react-components 1.3.1-dev.3 → 1.3.2-dev.1.full
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/dist/esm/AuthPage/AuthPage.js +1 -1
- package/dist/esm/AuthPage/AuthPage.js.map +1 -1
- package/dist/esm/AuthPage/Information.js +1 -1
- package/dist/esm/AuthPage/Information.js.map +1 -1
- package/dist/esm/Banners/Banner.js +16 -16
- package/dist/esm/Banners/Banner.js.map +1 -1
- package/dist/esm/Modals/__tests__/Modal.test.js +154 -0
- package/dist/esm/Modals/__tests__/Modal.test.js.map +1 -0
- package/dist/esm/styles/typography.js +66 -66
- package/dist/esm/styles/typography.js.map +1 -1
- package/dist/js/AuthPage/AuthPage.js +1 -1
- package/dist/js/AuthPage/AuthPage.js.map +1 -1
- package/dist/js/AuthPage/Information.d.ts +1 -1
- package/dist/js/AuthPage/Information.js +1 -1
- package/dist/js/AuthPage/Information.js.map +1 -1
- package/dist/js/Banners/Banner.js +19 -16
- package/dist/js/Banners/Banner.js.map +1 -1
- package/dist/js/Modals/__tests__/Modal.test.js +231 -0
- package/dist/js/Modals/__tests__/Modal.test.js.map +1 -0
- package/dist/js/styles/typography.d.ts +6 -6
- package/dist/js/styles/typography.js +66 -66
- package/dist/js/styles/typography.js.map +1 -1
- package/dist/umd/AuthPage/AuthPage.js +1 -1
- package/dist/umd/AuthPage/AuthPage.js.map +1 -1
- package/dist/umd/AuthPage/Information.js +1 -1
- package/dist/umd/AuthPage/Information.js.map +1 -1
- package/dist/umd/Banners/Banner.js +16 -16
- package/dist/umd/Banners/Banner.js.map +1 -1
- package/dist/umd/Modals/__tests__/Modal.test.js +173 -0
- package/dist/umd/Modals/__tests__/Modal.test.js.map +1 -0
- package/dist/umd/styles/typography.js +66 -66
- package/dist/umd/styles/typography.js.map +1 -1
- package/package.json +1 -1
|
@@ -23,7 +23,7 @@ const AuthPage = ({
|
|
|
23
23
|
screenSetsContainerId
|
|
24
24
|
}) => {
|
|
25
25
|
return /*#__PURE__*/React.createElement(React.Fragment, null, showInformationSection && /*#__PURE__*/React.createElement(InformationContainer, {
|
|
26
|
-
|
|
26
|
+
color: signUp ? COLORS.accent1_20 : COLORS.primary_20
|
|
27
27
|
}, /*#__PURE__*/React.createElement(InformationContent, null, (signUpPlaceholderImage || signInPlaceholderImage) && /*#__PURE__*/React.createElement(InformationImage, {
|
|
28
28
|
src: signUp ? signUpPlaceholderImage : signInPlaceholderImage,
|
|
29
29
|
alt: signUp ? signUpPlaceholderImageAlt : signInPlaceholderImageAlt
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/AuthPage/AuthPage.tsx"],"names":["React","COLORS","ScreenSetsContainer","InformationContainer","InformationContent","InformationHeader","InformationText","InformationImage","AuthPage","showInformationSection","signUp","signUpPlaceholderImage","signInPlaceholderImage","signUpPlaceholderImageAlt","signInPlaceholderImageAlt","signUpInformationHeader","signInInformationHeader","signUpInformationText","signInInformationText","screenSetsContainerId","accent1_20","primary_20"],"mappings":";AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,MAAT,QAAuB,WAAvB;AACA,OAAOC,mBAAP,MAAgC,uBAAhC;AACA,SAASC,oBAAT,EAA+BC,kBAA/B,EAAmDC,iBAAnD,EAAsEC,eAAtE,EAAuFC,gBAAvF,QAA+G,eAA/G;;AA4BA;AACA;AACA;AACA;AACA;AACA,MAAMC,QAAQ,GAAG,CAAC;AAChBC,EAAAA,sBADgB;AAEhBC,EAAAA,MAFgB;AAGhBC,EAAAA,sBAHgB;AAIhBC,EAAAA,sBAJgB;AAKhBC,EAAAA,yBALgB;AAMhBC,EAAAA,yBANgB;AAOhBC,EAAAA,uBAPgB;AAQhBC,EAAAA,uBARgB;AAShBC,EAAAA,qBATgB;AAUhBC,EAAAA,qBAVgB;AAWhBC,EAAAA;AAXgB,CAAD,KAYI;AACnB,sBACE,0CACGV,sBAAsB,iBACrB,oBAAC,oBAAD;AAAsB,IAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/AuthPage/AuthPage.tsx"],"names":["React","COLORS","ScreenSetsContainer","InformationContainer","InformationContent","InformationHeader","InformationText","InformationImage","AuthPage","showInformationSection","signUp","signUpPlaceholderImage","signInPlaceholderImage","signUpPlaceholderImageAlt","signInPlaceholderImageAlt","signUpInformationHeader","signInInformationHeader","signUpInformationText","signInInformationText","screenSetsContainerId","accent1_20","primary_20"],"mappings":";AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,MAAT,QAAuB,WAAvB;AACA,OAAOC,mBAAP,MAAgC,uBAAhC;AACA,SAASC,oBAAT,EAA+BC,kBAA/B,EAAmDC,iBAAnD,EAAsEC,eAAtE,EAAuFC,gBAAvF,QAA+G,eAA/G;;AA4BA;AACA;AACA;AACA;AACA;AACA,MAAMC,QAAQ,GAAG,CAAC;AAChBC,EAAAA,sBADgB;AAEhBC,EAAAA,MAFgB;AAGhBC,EAAAA,sBAHgB;AAIhBC,EAAAA,sBAJgB;AAKhBC,EAAAA,yBALgB;AAMhBC,EAAAA,yBANgB;AAOhBC,EAAAA,uBAPgB;AAQhBC,EAAAA,uBARgB;AAShBC,EAAAA,qBATgB;AAUhBC,EAAAA,qBAVgB;AAWhBC,EAAAA;AAXgB,CAAD,KAYI;AACnB,sBACE,0CACGV,sBAAsB,iBACrB,oBAAC,oBAAD;AAAsB,IAAA,KAAK,EAAEC,MAAM,GAAGT,MAAM,CAACmB,UAAV,GAAuBnB,MAAM,CAACoB;AAAjE,kBACE,oBAAC,kBAAD,QACG,CAACV,sBAAsB,IAAIC,sBAA3B,kBACC,oBAAC,gBAAD;AAAkB,IAAA,GAAG,EAAEF,MAAM,GAAGC,sBAAH,GAA4BC,sBAAzD;AAAiF,IAAA,GAAG,EAAEF,MAAM,GAAGG,yBAAH,GAA+BC;AAA3H,IAFJ,EAIG,CAACC,uBAAuB,IAAIC,uBAA5B,kBAAwD,oBAAC,iBAAD,QAAoBN,MAAM,GAAGK,uBAAH,GAA6BC,uBAAvD,CAJ3D,EAKG,CAACC,qBAAqB,IAAIC,qBAA1B,kBAAoD,oBAAC,eAAD,QAAkBR,MAAM,GAAGO,qBAAH,GAA2BC,qBAAnD,CALvD,CADF,CAFJ,eAYE,oBAAC,mBAAD;AAAqB,IAAA,EAAE,EAAEC,qBAAzB;AAAgD,IAAA,cAAc,EAAE,CAACV;AAAjE,IAZF,CADF;AAgBD,CA7BD;;;AA7BEA,EAAAA,sB;AAGAC,EAAAA,M;AAEAC,EAAAA,sB;AAEAC,EAAAA,sB;AAEAC,EAAAA,yB;AAEAC,EAAAA,yB;AAEAC,EAAAA,uB;AAEAC,EAAAA,uB;AAEAC,EAAAA,qB;AAEAC,EAAAA,qB;AAEAC,EAAAA,qB;;AAuCF,eAAeX,QAAf","sourcesContent":["import * as React from 'react';\nimport { COLORS } from '../styles';\nimport ScreenSetsContainer from './ScreenSetsContainer';\nimport { InformationContainer, InformationContent, InformationHeader, InformationText, InformationImage } from './Information';\n\ntype AuthPageProps = {\n /** set this to 'false' to hide the left side illustration/information section */\n showInformationSection: boolean;\n /** true if 'sign-up' screen-set is showing, otherwise false.\n * The value can be set using 'onBeforeScreenLoad' in 'gigya.accounts.showScreenSet(...)' and checking the loaded screen-set */\n signUp: boolean;\n /** img src string for 'sign-up' placeholder image */\n signUpPlaceholderImage?: string;\n /** img src string for 'sign-in' placeholder image */\n signInPlaceholderImage?: string;\n /** img alt text string for 'sign-up' placeholder image */\n signUpPlaceholderImageAlt?: string;\n /** img alt text string for 'sign-in' placeholder image */\n signInPlaceholderImageAlt?: string;\n /** information header text string below 'sign-up' placeholder image */\n signUpInformationHeader?: string;\n /** information header text string below 'sign-in' placeholder image */\n signInInformationHeader?: string;\n /** information text string below 'sign-up' header text */\n signUpInformationText?: string;\n /** information text string below 'sign-in' header text */\n signInInformationText?: string;\n /** ID that will be given to the SAP CDC screen-sets container (must match 'containerID' in 'gigya.accounts.showScreenSet(...)'!) */\n screenSetsContainerId: string;\n};\n\n/**\n * The 'AuthPage' component consist of two containers: an 'Information' container on the left, and a 'ScreenSetsContainer' on the right.\n * The 'Information' container is optional and its contents depend on the context (sign-up or sign-in).\n * The 'ScreenSetsContainer' will contain the SAP CDC screen-sets.\n */\nconst AuthPage = ({\n showInformationSection,\n signUp,\n signUpPlaceholderImage,\n signInPlaceholderImage,\n signUpPlaceholderImageAlt,\n signInPlaceholderImageAlt,\n signUpInformationHeader,\n signInInformationHeader,\n signUpInformationText,\n signInInformationText,\n screenSetsContainerId,\n}: AuthPageProps) => {\n return (\n <>\n {showInformationSection && (\n <InformationContainer color={signUp ? COLORS.accent1_20 : COLORS.primary_20}>\n <InformationContent>\n {(signUpPlaceholderImage || signInPlaceholderImage) && (\n <InformationImage src={signUp ? signUpPlaceholderImage : signInPlaceholderImage} alt={signUp ? signUpPlaceholderImageAlt : signInPlaceholderImageAlt} />\n )}\n {(signUpInformationHeader || signInInformationHeader) && <InformationHeader>{signUp ? signUpInformationHeader : signInInformationHeader}</InformationHeader>}\n {(signUpInformationText || signInInformationText) && <InformationText>{signUp ? signUpInformationText : signInInformationText}</InformationText>}\n </InformationContent>\n </InformationContainer>\n )}\n <ScreenSetsContainer id={screenSetsContainerId} centerContents={!showInformationSection} />\n </>\n );\n};\n\nexport default AuthPage;\n"],"file":"AuthPage.js"}
|
|
@@ -4,7 +4,7 @@ import { BREAKPOINTS, COLORS, ParagraphTextStyle } from '../styles';
|
|
|
4
4
|
import { HeadlineXLStyling, ParagraphLStyling } from '../styles/typography';
|
|
5
5
|
export const InformationContainer = styled(AuthPageSection)`
|
|
6
6
|
display: none;
|
|
7
|
-
background: ${props => props
|
|
7
|
+
background: ${props => props.color};
|
|
8
8
|
|
|
9
9
|
${BREAKPOINTS.MEDIUM} {
|
|
10
10
|
display: flex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/AuthPage/Information.tsx"],"names":["styled","AuthPageSection","BREAKPOINTS","COLORS","ParagraphTextStyle","HeadlineXLStyling","ParagraphLStyling","InformationContainer","props","
|
|
1
|
+
{"version":3,"sources":["../../../src/AuthPage/Information.tsx"],"names":["styled","AuthPageSection","BREAKPOINTS","COLORS","ParagraphTextStyle","HeadlineXLStyling","ParagraphLStyling","InformationContainer","props","color","MEDIUM","InformationContent","div","LARGE","InformationHeader","h2","black","InformationText","p","Regular","neutral_600","InformationImage","img"],"mappings":"AACA,OAAOA,MAAP,MAAmB,mBAAnB;AACA,OAAOC,eAAP,MAA4B,oBAA5B;AACA,SAAQC,WAAR,EAAqBC,MAArB,EAA6DC,kBAA7D,QAAsF,WAAtF;AACA,SAA2BC,iBAA3B,EAA8CC,iBAA9C,QAAsE,sBAAtE;AAEA,OAAO,MAAMC,oBAAoB,GAAGP,MAAM,CAACC,eAAD,CAAqC;AAC/E;AACA,gBAAgBO,KAAK,IAAIA,KAAK,CAACC,KAAM;AACrC;AACA,IAAIP,WAAW,CAACQ,MAAO;AACvB;AACA;AACA;AACA,CARO;AAUP,OAAO,MAAMC,kBAAkB,GAAGX,MAAM,CAACY,GAAI;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIV,WAAW,CAACW,KAAM;AACtB;AACA;AACA;AACA,CAZO;AAcP,OAAO,MAAMC,iBAAiB,GAAGd,MAAM,CAACe,EAAG;AAC3C,IAAIV,iBAAiB,CAACF,MAAM,CAACa,KAAR,CAAe;AACpC;AACA;AACA,CAJO;AAMP,OAAO,MAAMC,eAAe,GAAGjB,MAAM,CAACkB,CAAE;AACxC,IAAIZ,iBAAiB,CAACF,kBAAkB,CAACe,OAApB,EAA6BhB,MAAM,CAACiB,WAApC,CAAiD;AACtE;AACA,CAHO;AAKP,OAAO,MAAMC,gBAAgB,GAAGrB,MAAM,CAACsB,GAAI;AAC3C;AACA;AACA,CAHO","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport AuthPageSection from './_AuthPageSection';\nimport {BREAKPOINTS, COLORS, ComponentTextStyle, HeadlineXL, ParagraphTextStyle} from '../styles';\nimport {ComponentLStyling, HeadlineXLStyling, ParagraphLStyling} from '../styles/typography';\n\nexport const InformationContainer = styled(AuthPageSection)<{ color: string }>`\n display: none;\n background: ${props => props.color};\n\n ${BREAKPOINTS.MEDIUM} {\n display: flex;\n padding-top: 56px;\n }\n`;\n\nexport const InformationContent = styled.div`\n display: flex;\n flex-direction: column;\n align-self: center;\n align-items: center;\n text-align: center;\n max-width: 100%;\n\n ${BREAKPOINTS.LARGE} {\n align-self: flex-end;\n margin-right: 48px;\n }\n`;\n\nexport const InformationHeader = styled.h2`\n ${HeadlineXLStyling(COLORS.black)}\n font-weight: 300;\n margin-bottom: 0;\n`;\n\nexport const InformationText = styled.p`\n ${ParagraphLStyling(ParagraphTextStyle.Regular, COLORS.neutral_600)}\n margin: 8px 0;\n`;\n\nexport const InformationImage = styled.img`\n height: 275px;\n max-width: 100%;\n`;\n"],"file":"Information.js"}
|
|
@@ -12,7 +12,7 @@ import { HyperLink } from '../HyperLink';
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
const BannerContainer = styled.div`
|
|
15
|
-
background: ${props => props
|
|
15
|
+
background: ${props => props.type ? props.type : COLORS.correct_100};
|
|
16
16
|
min-height: 48px;
|
|
17
17
|
display: flex;
|
|
18
18
|
color: ${COLORS.black};
|
|
@@ -43,8 +43,8 @@ const BannerContainer = styled.div`
|
|
|
43
43
|
}
|
|
44
44
|
`;
|
|
45
45
|
const BannerCenter = styled.div`
|
|
46
|
-
${props => ComponentMStyling(ComponentTextStyle.Regular, props
|
|
47
|
-
|
|
46
|
+
${props => ComponentMStyling(ComponentTextStyle.Regular, props.color)}
|
|
47
|
+
|
|
48
48
|
display: flex;
|
|
49
49
|
width: 100%;
|
|
50
50
|
margin: 0 0 0 16px;
|
|
@@ -74,7 +74,7 @@ const ButtonWrapper = styled.div`
|
|
|
74
74
|
`;
|
|
75
75
|
const ButtonContainer = styled.div`
|
|
76
76
|
display: contents;
|
|
77
|
-
${props => props
|
|
77
|
+
${props => props.type ? getButtonStyle(props.type) : null};
|
|
78
78
|
`;
|
|
79
79
|
const BannerContentWrapper = styled.div`
|
|
80
80
|
display: flex;
|
|
@@ -111,12 +111,12 @@ const Banner = ({
|
|
|
111
111
|
case 'warning':
|
|
112
112
|
return /*#__PURE__*/React.createElement(BannerContainer, {
|
|
113
113
|
"data-testid": testId,
|
|
114
|
-
|
|
114
|
+
type: COLORS.warning_100,
|
|
115
115
|
link: COLORS.warning_700,
|
|
116
116
|
hover: COLORS.warning_20,
|
|
117
117
|
bottom: bottom
|
|
118
118
|
}, /*#__PURE__*/React.createElement(BannerCenter, {
|
|
119
|
-
|
|
119
|
+
color: COLORS.warning_700,
|
|
120
120
|
className: size
|
|
121
121
|
}, icon ? icon : noIcon ? null : /*#__PURE__*/React.createElement(Help, {
|
|
122
122
|
color: COLORS.warning_700,
|
|
@@ -130,7 +130,7 @@ const Banner = ({
|
|
|
130
130
|
href: link,
|
|
131
131
|
variant: "default"
|
|
132
132
|
}, linkText))), onClose && /*#__PURE__*/React.createElement(ButtonWrapper, null, /*#__PURE__*/React.createElement(ButtonContainer, {
|
|
133
|
-
|
|
133
|
+
type: formatTypeToLowerCase
|
|
134
134
|
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
135
135
|
variant: "secondary",
|
|
136
136
|
shape: "circular",
|
|
@@ -145,13 +145,13 @@ const Banner = ({
|
|
|
145
145
|
case 'critical':
|
|
146
146
|
return /*#__PURE__*/React.createElement(BannerContainer, {
|
|
147
147
|
"data-testid": testId,
|
|
148
|
-
|
|
148
|
+
type: COLORS.critical_100,
|
|
149
149
|
link: COLORS.critical_700,
|
|
150
150
|
hover: COLORS.critical_20,
|
|
151
151
|
bottom: bottom,
|
|
152
152
|
className: size
|
|
153
153
|
}, /*#__PURE__*/React.createElement(BannerCenter, {
|
|
154
|
-
|
|
154
|
+
color: COLORS.critical_700,
|
|
155
155
|
className: size
|
|
156
156
|
}, icon ? icon : noIcon ? null : /*#__PURE__*/React.createElement(TechnicalWarning, {
|
|
157
157
|
color: COLORS.critical_700,
|
|
@@ -165,7 +165,7 @@ const Banner = ({
|
|
|
165
165
|
href: link,
|
|
166
166
|
variant: "default"
|
|
167
167
|
}, linkText))), onClose && /*#__PURE__*/React.createElement(ButtonWrapper, null, /*#__PURE__*/React.createElement(ButtonContainer, {
|
|
168
|
-
|
|
168
|
+
type: formatTypeToLowerCase
|
|
169
169
|
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
170
170
|
variant: "secondary",
|
|
171
171
|
shape: "circular",
|
|
@@ -180,13 +180,13 @@ const Banner = ({
|
|
|
180
180
|
case 'positive':
|
|
181
181
|
return /*#__PURE__*/React.createElement(BannerContainer, {
|
|
182
182
|
"data-testid": testId,
|
|
183
|
-
|
|
183
|
+
type: COLORS.correct_100,
|
|
184
184
|
link: COLORS.correct_700,
|
|
185
185
|
hover: COLORS.correct_20,
|
|
186
186
|
bottom: bottom,
|
|
187
187
|
className: size
|
|
188
188
|
}, /*#__PURE__*/React.createElement(BannerCenter, {
|
|
189
|
-
|
|
189
|
+
color: COLORS.correct_700,
|
|
190
190
|
className: size
|
|
191
191
|
}, icon ? icon : noIcon ? null : /*#__PURE__*/React.createElement(ThumbsUp, {
|
|
192
192
|
color: COLORS.correct_700,
|
|
@@ -200,7 +200,7 @@ const Banner = ({
|
|
|
200
200
|
href: link,
|
|
201
201
|
variant: "default"
|
|
202
202
|
}, linkText))), onClose && /*#__PURE__*/React.createElement(ButtonWrapper, null, /*#__PURE__*/React.createElement(ButtonContainer, {
|
|
203
|
-
|
|
203
|
+
type: formatTypeToLowerCase
|
|
204
204
|
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
205
205
|
variant: "secondary",
|
|
206
206
|
shape: "circular",
|
|
@@ -215,13 +215,13 @@ const Banner = ({
|
|
|
215
215
|
default:
|
|
216
216
|
return /*#__PURE__*/React.createElement(BannerContainer, {
|
|
217
217
|
"data-testid": testId,
|
|
218
|
-
|
|
218
|
+
type: COLORS.primary_100,
|
|
219
219
|
link: COLORS.primary_700,
|
|
220
220
|
hover: COLORS.primary_20,
|
|
221
221
|
bottom: bottom,
|
|
222
222
|
className: size
|
|
223
223
|
}, /*#__PURE__*/React.createElement(BannerCenter, {
|
|
224
|
-
|
|
224
|
+
color: COLORS.primary_700,
|
|
225
225
|
className: size
|
|
226
226
|
}, icon ? icon : noIcon ? null : /*#__PURE__*/React.createElement(Tip, {
|
|
227
227
|
color: COLORS.primary_700,
|
|
@@ -235,7 +235,7 @@ const Banner = ({
|
|
|
235
235
|
href: link,
|
|
236
236
|
variant: "default"
|
|
237
237
|
}, linkText))), onClose && /*#__PURE__*/React.createElement(ButtonWrapper, null, /*#__PURE__*/React.createElement(ButtonContainer, {
|
|
238
|
-
|
|
238
|
+
type: "neutral"
|
|
239
239
|
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
240
240
|
variant: "secondary",
|
|
241
241
|
shape: "circular",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/Banners/Banner.tsx"],"names":["React","styled","BREAKPOINTS","COLORS","ComponentTextStyle","Close","Help","TechnicalWarning","ThumbsUp","Tip","IconButton","getButtonStyle","ComponentMStyling","ComponentResponsive","HyperLink","BannerContainer","div","props","$type","correct_100","black","bottom","MEDIUM","LARGE","link","BannerCenter","Regular","$color","ButtonWrapper","ButtonContainer","BannerContentWrapper","Banner","size","type","children","testId","linkText","onClose","icon","noIcon","width","setWidth","useState","window","innerWidth","useEffect","handleResize","addEventListener","formatTypeToLowerCase","toLowerCase","warning_100","warning_700","warning_20","Math","floor","random","white","warning_500","critical_100","critical_700","critical_20","critical_500","correct_700","correct_20","correct_500","primary_100","primary_700","primary_20","primary_500","hover"],"mappings":";AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AAEA,SAASC,WAAT,EAAsBC,MAAtB,EAA8BC,kBAA9B,QAAwD,WAAxD;AACA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AC,KAAD;AAAO,QAAA,KAAK,EAAElC,MAAM,CAACiE,WAArB;AAAkC,QAAA,IAAI,EAAC;AAAvC,QADF,CADF,CADF,CAbJ,CADF,CADF;AAnFJ;AA8GD,CAxHD;;;AAXEnC,EAAAA,I;AACAT,EAAAA,I;AACAY,EAAAA,Q;AACAiC,EAAAA,K;AACAhD,EAAAA,M;AACAc,EAAAA,M;AACAG,EAAAA,I;AACAD,EAAAA,O;AACAE,EAAAA,M;;AA6HF,eAAeR,MAAf","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\n\nimport { BREAKPOINTS, COLORS, ComponentTextStyle } from '../styles';\nimport { Close, Help, TechnicalWarning, ThumbsUp, Tip } from '../icons/systemicons/SystemIcons';\nimport { IconButton } from '../Button';\nimport { getButtonStyle } from './styles';\nimport { Size } from '../types';\nimport { ComponentMStyling, ComponentResponsive } from '../styles/typography';\nimport { HyperLink } from '../HyperLink';\n\n/**\n * Styles for <Banner />\n */\ntype StyleBannerProps = BannerProps & { $type: string };\n\nconst BannerContainer = styled.div<StyleBannerProps>`\n background: ${(props: StyleBannerProps) => (props.$type ? props.$type : COLORS.correct_100)};\n min-height: 48px;\n display: flex;\n color: ${COLORS.black};\n margin-top: ${(props: StyleBannerProps) => (props.bottom ? 'auto' : '0')};\n\n button:last-child {\n line-height: 0;\n margin: 0 0 0 8px;\n ${BREAKPOINTS.MEDIUM} {\n margin: 0 0 0 16px;\n }\n ${BREAKPOINTS.LARGE} {\n margin: 0 0 0 32px;\n }\n &.small {\n margin: 0 0 0 8px;\n }\n &.medium {\n margin: 0 0 0 16px;\n }\n &.large {\n margin: 0 0 0 32px;\n }\n }\n\n a {\n color: ${(props: BannerProps) => props.link} !important;\n }\n`;\n\nconst BannerCenter = styled.div<{ $color: string }>`\n ${(props) => ComponentMStyling(ComponentTextStyle.Regular, props.$color)}\n\n display: flex;\n width: 100%;\n margin: 0 0 0 16px;\n ${BREAKPOINTS.MEDIUM} {\n margin: 0 16px 0 32px;\n }\n ${BREAKPOINTS.LARGE} {\n margin: 0 40px 0 56px;\n }\n &.small {\n margin: 0 0 0 16px;\n }\n &.medium {\n margin: 0 16px 0 32px;\n }\n &.large {\n margin: 0 40px 0 56px;\n }\n\n > svg {\n flex-shrink: 0;\n margin: 12px 0;\n }\n`;\n\nconst ButtonWrapper = styled.div`\n margin: 0 0 0 auto;\n`;\n\nconst ButtonContainer = styled.div<{ $type?: string }>`\n display: contents;\n ${(props) => (props.$type ? getButtonStyle(props.$type) : null)};\n`;\n\nconst BannerContentWrapper = styled.div`\n display: flex;\n align-items: center;\n margin: 12px 0;\n &:not(:first-child) {\n margin-left: 8px;\n }\n`;\n\ntype BannerProps = {\n size?: Size.Small | Size.Medium | Size.Large;\n type?: string;\n link?: string;\n linkText?: string;\n hover?: string;\n bottom?: boolean;\n testId?: string;\n icon?: React.ReactNode;\n onClose?: () => void;\n noIcon?: boolean;\n};\n\nconst Banner: React.FunctionComponent<BannerProps> = ({ size, type, children, bottom, testId, linkText, link, onClose, icon, noIcon }) => {\n const [width, setWidth] = React.useState<number>(window.innerWidth);\n React.useEffect(() => {\n function handleResize() {\n setWidth(window.innerWidth);\n }\n window.addEventListener('resize', handleResize);\n });\n\n const formatTypeToLowerCase = type?.toLowerCase();\n switch (formatTypeToLowerCase) {\n case 'warning':\n return (\n <BannerContainer data-testid={testId} $type={COLORS.warning_100} link={COLORS.warning_700} hover={COLORS.warning_20} bottom={bottom}>\n <BannerCenter $color={COLORS.warning_700} className={size}>\n {icon ? icon : noIcon ? null : <Help color={COLORS.warning_700} size=\"24px\" />}\n <BannerContentWrapper>\n <ComponentResponsive size={size} width={width} color={COLORS.warning_700}>\n {children} \n {link && linkText && (\n <HyperLink id={`${Math.floor(Math.random() * 999999999999)}_BannerLink`} href={link} variant=\"default\">\n {linkText}\n </HyperLink>\n )}\n </ComponentResponsive>\n </BannerContentWrapper>\n {onClose && (\n <ButtonWrapper>\n <ButtonContainer $type={formatTypeToLowerCase}>\n <IconButton variant=\"secondary\" shape=\"circular\" useTransparentBackground tabbedHereBackgroundColor={COLORS.white} action={() => onClose()}>\n <Close color={COLORS.warning_500} size=\"24px\" />\n </IconButton>\n </ButtonContainer>\n </ButtonWrapper>\n )}\n </BannerCenter>\n </BannerContainer>\n );\n case 'critical':\n return (\n <BannerContainer data-testid={testId} $type={COLORS.critical_100} link={COLORS.critical_700} hover={COLORS.critical_20} bottom={bottom} className={size}>\n <BannerCenter $color={COLORS.critical_700} className={size}>\n {icon ? icon : noIcon ? null : <TechnicalWarning color={COLORS.critical_700} size=\"24px\" />}\n <BannerContentWrapper>\n <ComponentResponsive size={size} width={width} color={COLORS.critical_700}>\n {children} \n {link && linkText && (\n <HyperLink id={`${Math.floor(Math.random() * 999999999999)}_BannerLink`} href={link} variant=\"default\">\n {linkText}\n </HyperLink>\n )}\n </ComponentResponsive>\n </BannerContentWrapper>\n {onClose && (\n <ButtonWrapper>\n <ButtonContainer $type={formatTypeToLowerCase}>\n <IconButton variant=\"secondary\" shape=\"circular\" useTransparentBackground tabbedHereBackgroundColor={COLORS.white} action={() => onClose()}>\n <Close color={COLORS.critical_500} size=\"24px\" />\n </IconButton>\n </ButtonContainer>\n </ButtonWrapper>\n )}\n </BannerCenter>\n </BannerContainer>\n );\n case 'positive':\n return (\n <BannerContainer data-testid={testId} $type={COLORS.correct_100} link={COLORS.correct_700} hover={COLORS.correct_20} bottom={bottom} className={size}>\n <BannerCenter $color={COLORS.correct_700} className={size}>\n {icon ? icon : noIcon ? null : <ThumbsUp color={COLORS.correct_700} size=\"24px\" />}\n <BannerContentWrapper>\n <ComponentResponsive size={size} width={width} color={COLORS.correct_700}>\n {children} \n {link && linkText && (\n <HyperLink id={`${Math.floor(Math.random() * 999999999999)}_BannerLink`} href={link} variant=\"default\">\n {linkText}\n </HyperLink>\n )}\n </ComponentResponsive>\n </BannerContentWrapper>\n {onClose && (\n <ButtonWrapper>\n <ButtonContainer $type={formatTypeToLowerCase}>\n <IconButton variant=\"secondary\" shape=\"circular\" useTransparentBackground tabbedHereBackgroundColor={COLORS.white} action={() => onClose()}>\n <Close color={COLORS.correct_500} size=\"24px\" />\n </IconButton>\n </ButtonContainer>\n </ButtonWrapper>\n )}\n </BannerCenter>\n </BannerContainer>\n );\n default:\n return (\n <BannerContainer data-testid={testId} $type={COLORS.primary_100} link={COLORS.primary_700} hover={COLORS.primary_20} bottom={bottom} className={size}>\n <BannerCenter $color={COLORS.primary_700} className={size}>\n {icon ? icon : noIcon ? null : <Tip color={COLORS.primary_700} size=\"24px\" />}\n <BannerContentWrapper>\n <ComponentResponsive size={size} width={width} color={COLORS.primary_700}>\n {children} \n {link && linkText && (\n <HyperLink id={`${Math.floor(Math.random() * 999999999999)}_BannerLink`} href={link} variant=\"default\">\n {linkText}\n </HyperLink>\n )}\n </ComponentResponsive>\n </BannerContentWrapper>\n {onClose && (\n <ButtonWrapper>\n <ButtonContainer $type=\"neutral\">\n <IconButton variant=\"secondary\" shape=\"circular\" useTransparentBackground tabbedHereBackgroundColor={COLORS.white} action={() => onClose()}>\n <Close color={COLORS.primary_500} size=\"24px\" />\n </IconButton>\n </ButtonContainer>\n </ButtonWrapper>\n )}\n </BannerCenter>\n </BannerContainer>\n );\n }\n};\n\nexport default Banner;\n"],"file":"Banner.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/Banners/Banner.tsx"],"names":["React","styled","BREAKPOINTS","COLORS","ComponentTextStyle","Close","Help","TechnicalWarning","ThumbsUp","Tip","IconButton","getButtonStyle","ComponentMStyling","ComponentResponsive","HyperLink","BannerContainer","div","props","type","correct_100","black","bottom","MEDIUM","LARGE","link","BannerCenter","Regular","color","ButtonWrapper","ButtonContainer","BannerContentWrapper","Banner","size","children","testId","linkText","onClose","icon","noIcon","width","setWidth","useState","window","innerWidth","useEffect","handleResize","addEventListener","formatTypeToLowerCase","toLowerCase","warning_100","warning_700","warning_20","Math","floor","random","white","warning_500","critical_100","critical_700","critical_20","critical_500","correct_700","correct_20","correct_500","primary_100","primary_700","primary_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ApB;AAAgC,QAAA,KAAK,EAAC,UAAtC;AAAiD,QAAA,wBAAwB,MAAzE;AAA0E,QAAA,yBAAyB,EAAEjC,MAAM,CAACoD,KAA5G;AAAmH,QAAA,MAAM,EAAE,MAAMnB,OAAO;AAAxI,sBACE,oBAAC,KAAD;AAAO,QAAA,KAAK,EAAEjC,MAAM,CAACgE,WAArB;AAAkC,QAAA,IAAI,EAAC;AAAvC,QADF,CADF,CADF,CAbJ,CADF,CADF;AAnFJ;AA8GD,CAxHD;;;AAXEjD,EAAAA,I;AACAM,EAAAA,I;AACAW,EAAAA,Q;AACAiC,EAAAA,K;AACA/C,EAAAA,M;AACAa,EAAAA,M;AACAG,EAAAA,I;AACAD,EAAAA,O;AACAE,EAAAA,M;;AA6HF,eAAeP,MAAf","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\n\nimport {BREAKPOINTS, COLORS, ComponentTextStyle} from '../styles';\nimport {Close, Help, TechnicalWarning, ThumbsUp, Tip} from '../icons/systemicons/SystemIcons';\nimport {IconButton} from '../Button';\nimport {getButtonStyle} from './styles';\nimport {Size} from '../types';\nimport {ComponentMStyling, ComponentResponsive} from '../styles/typography';\nimport {HyperLink} from '../HyperLink';\n\n/**\n * Styles for <Banner />\n */\nconst BannerContainer = styled.div<BannerProps>`\n background: ${(props: BannerProps) => (props.type ? props.type : COLORS.correct_100)};\n min-height: 48px;\n display: flex;\n color: ${COLORS.black};\n margin-top: ${(props: BannerProps) => (props.bottom ? 'auto' : '0')};\n\n button:last-child {\n line-height: 0;\n margin: 0 0 0 8px;\n ${BREAKPOINTS.MEDIUM} {\n margin: 0 0 0 16px;\n }\n ${BREAKPOINTS.LARGE} {\n margin: 0 0 0 32px;\n }\n &.small {\n margin: 0 0 0 8px;\n }\n &.medium {\n margin: 0 0 0 16px;\n }\n &.large {\n margin: 0 0 0 32px;\n }\n }\n\n a {\n color: ${(props: BannerProps) => props.link} !important;\n }\n`;\n\nconst BannerCenter = styled.div`\n ${(props) => ComponentMStyling(ComponentTextStyle.Regular, props.color)}\n \n display: flex;\n width: 100%;\n margin: 0 0 0 16px;\n ${BREAKPOINTS.MEDIUM} {\n margin: 0 16px 0 32px;\n }\n ${BREAKPOINTS.LARGE} {\n margin: 0 40px 0 56px;\n }\n &.small {\n margin: 0 0 0 16px;\n }\n &.medium {\n margin: 0 16px 0 32px;\n }\n &.large {\n margin: 0 40px 0 56px;\n }\n\n > svg {\n flex-shrink: 0;\n margin: 12px 0;\n }\n`;\n\nconst ButtonWrapper = styled.div`\n margin: 0 0 0 auto;\n`;\n\nconst ButtonContainer = styled.div<{ type?: string }>`\n display: contents;\n ${(props) => (props.type ? getButtonStyle(props.type) : null)};\n`;\n\nconst BannerContentWrapper = styled.div`\n display: flex;\n align-items: center;\n margin: 12px 0;\n &:not(:first-child) {\n margin-left: 8px;\n }\n`;\n\ntype BannerProps = {\n size?: Size.Small | Size.Medium | Size.Large;\n type?: string;\n link?: string;\n linkText?: string;\n hover?: string;\n bottom?: boolean;\n testId?: string;\n icon?: React.ReactNode;\n onClose?: () => void;\n noIcon?: boolean;\n};\n\nconst Banner: React.FunctionComponent<BannerProps> = ({ size, type, children, bottom, testId, linkText, link, onClose, icon, noIcon }) => {\n const [width, setWidth] = React.useState<number>(window.innerWidth);\n React.useEffect(() => {\n function handleResize() {\n setWidth(window.innerWidth);\n }\n window.addEventListener('resize', handleResize);\n });\n\n const formatTypeToLowerCase = type?.toLowerCase();\n switch (formatTypeToLowerCase) {\n case 'warning':\n return (\n <BannerContainer data-testid={testId} type={COLORS.warning_100} link={COLORS.warning_700} hover={COLORS.warning_20} bottom={bottom}>\n <BannerCenter color={COLORS.warning_700} className={size}>\n {icon ? icon : noIcon ? null : <Help color={COLORS.warning_700} size=\"24px\" />}\n <BannerContentWrapper>\n <ComponentResponsive size={size} width={width} color={COLORS.warning_700}>\n {children} \n {link && linkText && (\n <HyperLink id={`${Math.floor(Math.random() * 999999999999)}_BannerLink`} href={link} variant=\"default\">\n {linkText}\n </HyperLink>\n )}\n </ComponentResponsive>\n </BannerContentWrapper>\n {onClose && (\n <ButtonWrapper>\n <ButtonContainer type={formatTypeToLowerCase}>\n <IconButton variant=\"secondary\" shape=\"circular\" useTransparentBackground tabbedHereBackgroundColor={COLORS.white} action={() => onClose()}>\n <Close color={COLORS.warning_500} size=\"24px\" />\n </IconButton>\n </ButtonContainer>\n </ButtonWrapper>\n )}\n </BannerCenter>\n </BannerContainer>\n );\n case 'critical':\n return (\n <BannerContainer data-testid={testId} type={COLORS.critical_100} link={COLORS.critical_700} hover={COLORS.critical_20} bottom={bottom} className={size}>\n <BannerCenter color={COLORS.critical_700} className={size}>\n {icon ? icon : noIcon ? null : <TechnicalWarning color={COLORS.critical_700} size=\"24px\" />}\n <BannerContentWrapper>\n <ComponentResponsive size={size} width={width} color={COLORS.critical_700}>\n {children} \n {link && linkText && (\n <HyperLink id={`${Math.floor(Math.random() * 999999999999)}_BannerLink`} href={link} variant=\"default\">\n {linkText}\n </HyperLink>\n )}\n </ComponentResponsive>\n </BannerContentWrapper>\n {onClose && (\n <ButtonWrapper>\n <ButtonContainer type={formatTypeToLowerCase}>\n <IconButton variant=\"secondary\" shape=\"circular\" useTransparentBackground tabbedHereBackgroundColor={COLORS.white} action={() => onClose()}>\n <Close color={COLORS.critical_500} size=\"24px\" />\n </IconButton>\n </ButtonContainer>\n </ButtonWrapper>\n )}\n </BannerCenter>\n </BannerContainer>\n );\n case 'positive':\n return (\n <BannerContainer data-testid={testId} type={COLORS.correct_100} link={COLORS.correct_700} hover={COLORS.correct_20} bottom={bottom} className={size}>\n <BannerCenter color={COLORS.correct_700} className={size}>\n {icon ? icon : noIcon ? null : <ThumbsUp color={COLORS.correct_700} size=\"24px\" />}\n <BannerContentWrapper>\n <ComponentResponsive size={size} width={width} color={COLORS.correct_700}>\n {children} \n {link && linkText && (\n <HyperLink id={`${Math.floor(Math.random() * 999999999999)}_BannerLink`} href={link} variant=\"default\">\n {linkText}\n </HyperLink>\n )}\n </ComponentResponsive>\n </BannerContentWrapper>\n {onClose && (\n <ButtonWrapper>\n <ButtonContainer type={formatTypeToLowerCase}>\n <IconButton variant=\"secondary\" shape=\"circular\" useTransparentBackground tabbedHereBackgroundColor={COLORS.white} action={() => onClose()}>\n <Close color={COLORS.correct_500} size=\"24px\" />\n </IconButton>\n </ButtonContainer>\n </ButtonWrapper>\n )}\n </BannerCenter>\n </BannerContainer>\n );\n default:\n return (\n <BannerContainer data-testid={testId} type={COLORS.primary_100} link={COLORS.primary_700} hover={COLORS.primary_20} bottom={bottom} className={size}>\n <BannerCenter color={COLORS.primary_700} className={size}>\n {icon ? icon : noIcon ? null : <Tip color={COLORS.primary_700} size=\"24px\" />}\n <BannerContentWrapper>\n <ComponentResponsive size={size} width={width} color={COLORS.primary_700}>\n {children} \n {link && linkText && (\n <HyperLink id={`${Math.floor(Math.random() * 999999999999)}_BannerLink`} href={link} variant=\"default\">\n {linkText}\n </HyperLink>\n )}\n </ComponentResponsive>\n </BannerContentWrapper>\n {onClose && (\n <ButtonWrapper>\n <ButtonContainer type=\"neutral\">\n <IconButton variant=\"secondary\" shape=\"circular\" useTransparentBackground tabbedHereBackgroundColor={COLORS.white} action={() => onClose()}>\n <Close color={COLORS.primary_500} size=\"24px\" />\n </IconButton>\n </ButtonContainer>\n </ButtonWrapper>\n )}\n </BannerCenter>\n </BannerContainer>\n );\n }\n};\n\nexport default Banner;\n"],"file":"Banner.js"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import 'jest-styled-components';
|
|
4
|
+
import { ModalDialog } from '..';
|
|
5
|
+
import { Size, SystemIcons } from '../..';
|
|
6
|
+
describe('<ModalDialog />', () => {
|
|
7
|
+
let mountingDiv;
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
//being rendered as a React.Portal we need to have the 'root' div defined
|
|
10
|
+
mountingDiv = document.createElement('div');
|
|
11
|
+
mountingDiv.id = 'root';
|
|
12
|
+
document.body.appendChild(mountingDiv);
|
|
13
|
+
});
|
|
14
|
+
afterEach(() => {
|
|
15
|
+
document.body.removeChild(mountingDiv);
|
|
16
|
+
});
|
|
17
|
+
it('Check modal not rendered when isModalOpen is false', async () => {
|
|
18
|
+
const {
|
|
19
|
+
container,
|
|
20
|
+
getByText
|
|
21
|
+
} = render( /*#__PURE__*/React.createElement(ModalDialog, {
|
|
22
|
+
key: "smallModalWithoutImage",
|
|
23
|
+
closeModalAndClearInput: () => {},
|
|
24
|
+
title: 'Header',
|
|
25
|
+
size: Size.Small,
|
|
26
|
+
isModalOpen: false,
|
|
27
|
+
closeAction: () => {},
|
|
28
|
+
submitAction: () => {}
|
|
29
|
+
})); //check modal portal not exists when modal not opened
|
|
30
|
+
|
|
31
|
+
expect(container.querySelector('.ReactModalPortal')).toBeNull();
|
|
32
|
+
});
|
|
33
|
+
it('Check modal visible, title and footer buttons displayed correctly', async () => {
|
|
34
|
+
const {
|
|
35
|
+
container,
|
|
36
|
+
getByText
|
|
37
|
+
} = render( /*#__PURE__*/React.createElement(ModalDialog, {
|
|
38
|
+
key: "smallModalWithoutImage",
|
|
39
|
+
closeModalAndClearInput: () => {},
|
|
40
|
+
title: 'Header',
|
|
41
|
+
size: Size.Small,
|
|
42
|
+
isModalOpen: true,
|
|
43
|
+
closeAction: () => {},
|
|
44
|
+
submitAction: () => {},
|
|
45
|
+
buttons: [{
|
|
46
|
+
action: () => {},
|
|
47
|
+
text: 'Close',
|
|
48
|
+
variant: 'tertiary'
|
|
49
|
+
}, {
|
|
50
|
+
action: () => {},
|
|
51
|
+
text: 'Save'
|
|
52
|
+
}]
|
|
53
|
+
})); //check modal portal defined
|
|
54
|
+
|
|
55
|
+
expect(container.querySelector('.ReactModalPortal')).toBeDefined(); //Check header and footer buttons
|
|
56
|
+
|
|
57
|
+
expect(getByText('Header')).toBeDefined();
|
|
58
|
+
expect(getByText('Close')).toBeDefined();
|
|
59
|
+
expect(getByText('Save')).toBeDefined();
|
|
60
|
+
});
|
|
61
|
+
it('Check tooltip, and link displayed without right footer buttons', async () => {
|
|
62
|
+
const {
|
|
63
|
+
baseElement,
|
|
64
|
+
getByText
|
|
65
|
+
} = render( /*#__PURE__*/React.createElement(ModalDialog, {
|
|
66
|
+
key: "smallModalWithoutImage",
|
|
67
|
+
closeModalAndClearInput: () => {},
|
|
68
|
+
title: 'Header',
|
|
69
|
+
size: Size.Small,
|
|
70
|
+
isModalOpen: true,
|
|
71
|
+
closeAction: () => {},
|
|
72
|
+
submitAction: () => {},
|
|
73
|
+
tooltip: 'some test tooltip',
|
|
74
|
+
leftFooterAction: {
|
|
75
|
+
id: 'test-link',
|
|
76
|
+
actionType: 'hyperlink',
|
|
77
|
+
text: 'Link',
|
|
78
|
+
href: 'http://test.com',
|
|
79
|
+
icon: /*#__PURE__*/React.createElement(React.Fragment, null),
|
|
80
|
+
variant: 'default'
|
|
81
|
+
}
|
|
82
|
+
})); //check tooltip displayed
|
|
83
|
+
|
|
84
|
+
expect(getByText('some test tooltip').textContent).toBeDefined(); //check footer link displayed
|
|
85
|
+
|
|
86
|
+
expect(getByText('Link').children).toBeDefined();
|
|
87
|
+
});
|
|
88
|
+
it('Check note and footer note displayed', async () => {
|
|
89
|
+
const {
|
|
90
|
+
baseElement,
|
|
91
|
+
getByText
|
|
92
|
+
} = render( /*#__PURE__*/React.createElement(ModalDialog, {
|
|
93
|
+
key: "smallModalWithoutImage",
|
|
94
|
+
closeModalAndClearInput: () => {},
|
|
95
|
+
title: 'Header',
|
|
96
|
+
size: Size.Small,
|
|
97
|
+
isModalOpen: true,
|
|
98
|
+
closeAction: () => {},
|
|
99
|
+
submitAction: () => {},
|
|
100
|
+
leftFooterAction: {
|
|
101
|
+
id: 'test-note',
|
|
102
|
+
actionType: 'note',
|
|
103
|
+
text: 'Test note',
|
|
104
|
+
icon: /*#__PURE__*/React.createElement(SystemIcons.Information, null)
|
|
105
|
+
},
|
|
106
|
+
note: 'Message text',
|
|
107
|
+
state: 'critical'
|
|
108
|
+
})); //check footer note text displayed
|
|
109
|
+
|
|
110
|
+
expect(getByText('Test note').textContent).toBeDefined(); //check note section added
|
|
111
|
+
|
|
112
|
+
expect(baseElement.querySelectorAll('section')?.length).toEqual(4); //check note message displayed
|
|
113
|
+
|
|
114
|
+
expect(getByText('Message text').children).toBeDefined();
|
|
115
|
+
});
|
|
116
|
+
it('Check back button and close icon displayed', async () => {
|
|
117
|
+
const {
|
|
118
|
+
baseElement,
|
|
119
|
+
getByText,
|
|
120
|
+
container
|
|
121
|
+
} = render( /*#__PURE__*/React.createElement(ModalDialog, {
|
|
122
|
+
key: "smallModalWithoutImage",
|
|
123
|
+
closeModalAndClearInput: () => {},
|
|
124
|
+
title: 'Header',
|
|
125
|
+
size: Size.Small,
|
|
126
|
+
backButton: () => {},
|
|
127
|
+
isModalOpen: true,
|
|
128
|
+
closeAction: () => {},
|
|
129
|
+
submitAction: () => {}
|
|
130
|
+
})); //only 2 svg elements should be found in the header of the modal
|
|
131
|
+
|
|
132
|
+
expect(baseElement.querySelectorAll('svg')?.length).toEqual(2);
|
|
133
|
+
});
|
|
134
|
+
it('Check modal body displayed', async () => {
|
|
135
|
+
const {
|
|
136
|
+
baseElement,
|
|
137
|
+
getByText,
|
|
138
|
+
container
|
|
139
|
+
} = render( /*#__PURE__*/React.createElement(ModalDialog, {
|
|
140
|
+
key: "smallModalWithoutImage",
|
|
141
|
+
closeModalAndClearInput: () => {},
|
|
142
|
+
title: 'Header',
|
|
143
|
+
size: Size.Small,
|
|
144
|
+
isModalOpen: true,
|
|
145
|
+
closeAction: () => {},
|
|
146
|
+
submitAction: () => {}
|
|
147
|
+
}, /*#__PURE__*/React.createElement("span", null, "Inner modal text"))); //Check all dialog sections are displayed
|
|
148
|
+
|
|
149
|
+
expect(baseElement.querySelectorAll('section')?.length).toEqual(3); //Check that the second section (modal body) has the correct text
|
|
150
|
+
|
|
151
|
+
expect(baseElement.querySelectorAll('section')?.[1].textContent).toEqual('Inner modal text');
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
//# sourceMappingURL=Modal.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/Modals/__tests__/Modal.test.tsx"],"names":["React","render","ModalDialog","Size","SystemIcons","describe","mountingDiv","beforeEach","document","createElement","id","body","appendChild","afterEach","removeChild","it","container","getByText","Small","expect","querySelector","toBeNull","action","text","variant","toBeDefined","baseElement","actionType","href","icon","textContent","children","querySelectorAll","length","toEqual"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,MAAT,QAAuB,wBAAvB;AACA,OAAO,wBAAP;AACA,SAASC,WAAT,QAA4B,IAA5B;AACA,SAAiBC,IAAjB,EAAuBC,WAAvB,QAA0C,OAA1C;AAEAC,QAAQ,CAAC,iBAAD,EAAoB,MAAM;AAChC,MAAIC,WAAJ;AAEAC,EAAAA,UAAU,CAAC,MAAM;AACf;AACAD,IAAAA,WAAW,GAAGE,QAAQ,CAACC,aAAT,CAAuB,KAAvB,CAAd;AACAH,IAAAA,WAAW,CAACI,EAAZ,GAAiB,MAAjB;AACAF,IAAAA,QAAQ,CAACG,IAAT,CAAcC,WAAd,CAA0BN,WAA1B;AACD,GALS,CAAV;AAOAO,EAAAA,SAAS,CAAC,MAAM;AACdL,IAAAA,QAAQ,CAACG,IAAT,CAAcG,WAAd,CAA0BR,WAA1B;AACD,GAFQ,CAAT;AAIAS,EAAAA,EAAE,CAAC,oDAAD,EAAuD,YAAY;AACnE,UAAM;AAAEC,MAAAA,SAAF;AAAaC,MAAAA;AAAb,QAA2BhB,MAAM,eACrC,oBAAC,WAAD;AACE,MAAA,GAAG,EAAC,wBADN;AAEE,MAAA,uBAAuB,EAAE,MAAM,CAAE,CAFnC;AAGE,MAAA,KAAK,EAAE,QAHT;AAIE,MAAA,IAAI,EAAEE,IAAI,CAACe,KAJb;AAKE,MAAA,WAAW,EAAE,KALf;AAME,MAAA,WAAW,EAAE,MAAM,CAA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4D,CAA5D;AACD,GAfC,CAAF;AAiBAnB,EAAAA,EAAE,CAAC,4BAAD,EAA+B,YAAY;AAC3C,UAAM;AAAEW,MAAAA,WAAF;AAAeT,MAAAA,SAAf;AAA0BD,MAAAA;AAA1B,QAAwCf,MAAM,eAClD,oBAAC,WAAD;AACE,MAAA,GAAG,EAAC,wBADN;AAEE,MAAA,uBAAuB,EAAE,MAAM,CAAE,CAFnC;AAGE,MAAA,KAAK,EAAE,QAHT;AAIE,MAAA,IAAI,EAAEE,IAAI,CAACe,KAJb;AAKE,MAAA,WAAW,EAAE,IALf;AAME,MAAA,WAAW,EAAE,MAAM,CAAE,CANvB;AAOE,MAAA,YAAY,EAAE,MAAM,CAAE;AAPxB,oBAQE,qDARF,CADkD,CAApD,CAD2C,CAa3C;;AACAC,IAAAA,MAAM,CAACO,WAAW,CAACM,gBAAZ,CAA6B,SAA7B,GAAyCC,MAA1C,CAAN,CAAwDC,OAAxD,CAAgE,CAAhE,EAd2C,CAe3C;;AACAf,IAAAA,MAAM,CAACO,WAAW,CAACM,gBAAZ,CAA6B,SAA7B,IAA0C,CAA1C,EAA6CF,WAA9C,CAAN,CAAiEI,OAAjE,CAAyE,kBAAzE;AACD,GAjBC,CAAF;AAkBD,CA3IO,CAAR","sourcesContent":["import React from 'react';\nimport { render } from '@testing-library/react';\nimport 'jest-styled-components';\nimport { ModalDialog } from '..';\nimport { COLORS, Size, SystemIcons } from '../..';\n\ndescribe('<ModalDialog />', () => {\n let mountingDiv: HTMLElement;\n\n beforeEach(() => {\n //being rendered as a React.Portal we need to have the 'root' div defined\n mountingDiv = document.createElement('div');\n mountingDiv.id = 'root';\n document.body.appendChild(mountingDiv);\n });\n\n afterEach(() => {\n document.body.removeChild(mountingDiv);\n });\n\n it('Check modal not rendered when isModalOpen is false', async () => {\n const { container, getByText } = render(\n <ModalDialog\n key=\"smallModalWithoutImage\"\n closeModalAndClearInput={() => {}}\n title={'Header'}\n size={Size.Small}\n isModalOpen={false}\n closeAction={() => {}}\n submitAction={() => {}}\n />,\n );\n //check modal portal not exists when modal not opened\n expect(container.querySelector('.ReactModalPortal')).toBeNull();\n });\n\n it('Check modal visible, title and footer buttons displayed correctly', async () => {\n const { container, getByText } = render(\n <ModalDialog\n key=\"smallModalWithoutImage\"\n closeModalAndClearInput={() => {}}\n title={'Header'}\n size={Size.Small}\n isModalOpen={true}\n closeAction={() => {}}\n submitAction={() => {}}\n buttons={[\n {\n action: () => {},\n text: 'Close',\n variant: 'tertiary',\n },\n {\n action: () => {},\n text: 'Save',\n },\n ]}\n />,\n );\n //check modal portal defined\n expect(container.querySelector('.ReactModalPortal')).toBeDefined();\n //Check header and footer buttons\n expect(getByText('Header')).toBeDefined();\n expect(getByText('Close')).toBeDefined();\n expect(getByText('Save')).toBeDefined();\n });\n\n it('Check tooltip, and link displayed without right footer buttons', async () => {\n const { baseElement, getByText } = render(\n <ModalDialog\n key=\"smallModalWithoutImage\"\n closeModalAndClearInput={() => {}}\n title={'Header'}\n size={Size.Small}\n isModalOpen={true}\n closeAction={() => {}}\n submitAction={() => {}}\n tooltip={'some test tooltip'}\n leftFooterAction={{ id: 'test-link', actionType: 'hyperlink', text: 'Link', href: 'http://test.com', icon: <></>, variant: 'default' }}\n />,\n );\n //check tooltip displayed\n expect(getByText('some test tooltip').textContent).toBeDefined();\n //check footer link displayed\n expect(getByText('Link').children).toBeDefined();\n });\n\n it('Check note and footer note displayed', async () => {\n const { baseElement, getByText } = render(\n <ModalDialog\n key=\"smallModalWithoutImage\"\n closeModalAndClearInput={() => {}}\n title={'Header'}\n size={Size.Small}\n isModalOpen={true}\n closeAction={() => {}}\n submitAction={() => {}}\n leftFooterAction={{ id: 'test-note', actionType: 'note', text: 'Test note', icon: <SystemIcons.Information /> }}\n note={'Message text'}\n state={'critical'}\n />,\n );\n //check footer note text displayed\n expect(getByText('Test note').textContent).toBeDefined();\n //check note section added\n expect(baseElement.querySelectorAll('section')?.length).toEqual(4);\n //check note message displayed\n expect(getByText('Message text').children).toBeDefined();\n });\n\n it('Check back button and close icon displayed', async () => {\n const { baseElement, getByText, container } = render(\n <ModalDialog\n key=\"smallModalWithoutImage\"\n closeModalAndClearInput={() => {}}\n title={'Header'}\n size={Size.Small}\n backButton={() => {}}\n isModalOpen={true}\n closeAction={() => {}}\n submitAction={() => {}}\n />,\n );\n //only 2 svg elements should be found in the header of the modal\n expect(baseElement.querySelectorAll('svg')?.length).toEqual(2);\n });\n\n it('Check modal body displayed', async () => {\n const { baseElement, getByText, container } = render(\n <ModalDialog\n key=\"smallModalWithoutImage\"\n closeModalAndClearInput={() => {}}\n title={'Header'}\n size={Size.Small}\n isModalOpen={true}\n closeAction={() => {}}\n submitAction={() => {}}>\n <span>Inner modal text</span>\n </ModalDialog>,\n );\n //Check all dialog sections are displayed\n expect(baseElement.querySelectorAll('section')?.length).toEqual(3);\n //Check that the second section (modal body) has the correct text\n expect(baseElement.querySelectorAll('section')?.[1].textContent).toEqual('Inner modal text');\n });\n});\n"],"file":"Modal.test.js"}
|