@madie/madie-design-system 1.0.2 → 1.0.3
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/.storybook/main.js +3 -0
- package/components/Accordion/Accordion.stories.js +11 -11
- package/components/Accordion/index.jsx +78 -76
- package/components/Alert/Alert.stories.js +60 -51
- package/components/Alert/index.js +46 -37
- package/components/Breadcrumb/Breadcrumb.stories.js +62 -62
- package/components/Breadcrumb/index.js +80 -71
- package/components/Button/Button.stories.js +92 -86
- package/components/Button/index.js +65 -65
- package/components/CalloutBox/CalloutBox.stories.js +75 -75
- package/components/CalloutBox/index.js +92 -92
- package/components/Card/Card.stories.js +135 -135
- package/components/Card/index.js +128 -121
- package/components/Dropdown/Dropdown.stories.js +73 -73
- package/components/Dropdown/index.js +72 -72
- package/components/Error/Collapsible.jsx +75 -70
- package/components/Error/ErrorUI.jsx +22 -22
- package/components/Error/error.js +20 -20
- package/components/FlashNotification/FlashNotificationUI.jsx +77 -77
- package/components/FlashNotification/index.js +23 -23
- package/components/Footer/Footer.stories.js +13 -13
- package/components/Footer/FooterUI.jsx +264 -252
- package/components/Footer/LegacyFooterUI.jsx +190 -180
- package/components/Footer/SocialLinks.jsx +58 -55
- package/components/Footer/Subscribe.jsx +29 -29
- package/components/Footer/footer.js +21 -21
- package/components/FormControlLabel/index.jsx +23 -0
- package/components/Header/Header.stories.js +29 -26
- package/components/Header/HeaderAccountMenu.jsx +163 -149
- package/components/Header/HeaderCancel.jsx +8 -8
- package/components/Header/HeaderContainer.jsx +48 -43
- package/components/Header/HeaderLogo.jsx +34 -34
- package/components/Header/HeaderMenuButton.js +39 -39
- package/components/Header/HeaderMenuItem.jsx +252 -205
- package/components/Header/HeaderMenuLink.js +37 -37
- package/components/Header/HeaderMenuSignOutButton.js +50 -50
- package/components/Header/HeaderMobileButton.js +29 -29
- package/components/Header/HeaderUI.jsx +164 -147
- package/components/Header/HelpIcon.jsx +15 -15
- package/components/Header/ImpersonatorBanner.jsx +50 -47
- package/components/Header/NavigationButtonIcon.jsx +21 -21
- package/components/Header/header.js +36 -34
- package/components/Header/hooks.js +42 -35
- package/components/Header/utag-helpers.js +8 -8
- package/components/Infotip/Infotip.jsx +48 -48
- package/components/Infotip/Infotip.stories.js +32 -30
- package/components/Infotip/InfotipIcon.jsx +30 -30
- package/components/Infotip/index.js +1 -1
- package/components/InputLabel/index.jsx +58 -0
- package/components/Link/Link.stories.js +65 -64
- package/components/Link/index.js +46 -46
- package/components/Modal/LegacyModal.jsx +56 -54
- package/components/Modal/Modal.jsx +121 -121
- package/components/Modal/Modal.stories.js +152 -144
- package/components/Modal/index.jsx +11 -11
- package/components/NotificationBanner/NotificationBanner.stories.js +16 -16
- package/components/NotificationBanner/index.js +239 -225
- package/components/Pagination/index.jsx +171 -160
- package/components/SanitizedContent/index.jsx +183 -183
- package/components/Search/Search.stories.js +14 -14
- package/components/Search/index.js +72 -72
- package/components/Select/Select.stories.js +168 -0
- package/components/Select/index.jsx +103 -0
- package/components/SessionDialog/sessionDialog.js +20 -20
- package/components/SessionDialogUI.jsx +231 -219
- package/components/SideNav/AnimationGroup/AnimationGroup.jsx +19 -17
- package/components/SideNav/Chart/ScoreChart.jsx +238 -229
- package/components/SideNav/Chart/__tests__/ScoreChart.test.js +15 -15
- package/components/SideNav/Chart/index.js +1 -1
- package/components/SideNav/Content/LevelOneContent.jsx +194 -190
- package/components/SideNav/Content/LevelTwoContent.jsx +208 -195
- package/components/SideNav/Content/index.js +2 -2
- package/components/SideNav/Details/IndividualDetails.jsx +10 -10
- package/components/SideNav/Details/PracticeDetails.jsx +36 -34
- package/components/SideNav/Details/index.js +2 -2
- package/components/SideNav/Links/CmsSwitchLink.jsx +32 -32
- package/components/SideNav/Links/NavItemInline.jsx +44 -44
- package/components/SideNav/Links/NavLinkContainer.jsx +27 -25
- package/components/SideNav/Links/NavLinkDrawer.jsx +267 -231
- package/components/SideNav/Links/NavLinkInline.jsx +94 -92
- package/components/SideNav/Links/NavLinkToggle.jsx +25 -25
- package/components/SideNav/Links/index.js +10 -10
- package/components/SideNav/SideNav.stories.js +320 -288
- package/components/SideNav/UI/SideNavUI.jsx +321 -301
- package/components/SideNav/UI/index.js +1 -1
- package/components/SideNav/helpers.js +33 -33
- package/components/SideNav/index.js +46 -46
- package/components/Spinner/index.js +6 -6
- package/components/Tabs/Tab.js +19 -19
- package/components/Tabs/TabPanel.js +31 -24
- package/components/Tabs/Tabs.stories.js +118 -108
- package/components/Tabs/index.js +81 -76
- package/components/TextField/TextField.stories.js +103 -0
- package/components/TextField/index.jsx +80 -0
- package/components/TextInput/TextInput.stories.js +84 -84
- package/components/TextInput/index.js +123 -123
- package/components/Tooltip/Tooltip.jsx +57 -57
- package/components/Tooltip/Tooltip.stories.js +50 -50
- package/components/Tooltip/index.js +1 -1
- package/components/Tooltip/position.js +42 -34
- package/components/UnwrappedSpinner/index.js +5 -5
- package/components/hooks/useGetConfig.js +64 -55
- package/components/index.js +129 -121
- package/coverage/clover.xml +368 -331
- package/coverage/coverage-final.json +57 -54
- package/coverage/lcov-report/InputLabel/index.html +116 -0
- package/coverage/lcov-report/InputLabel/index.jsx.html +214 -0
- package/coverage/lcov-report/Select/index.html +116 -0
- package/coverage/lcov-report/Select/index.jsx.html +391 -0
- package/coverage/lcov-report/Textfield/index.html +116 -0
- package/coverage/lcov-report/Textfield/index.jsx.html +322 -0
- package/coverage/lcov-report/index.html +54 -9
- package/coverage/lcov-report/react/components/Accordion/index.html +1 -1
- package/coverage/lcov-report/react/components/Accordion/index.jsx.html +84 -78
- package/coverage/lcov-report/react/components/Button/index.html +1 -1
- package/coverage/lcov-report/react/components/Button/index.js.html +66 -66
- package/coverage/lcov-report/react/components/Error/Collapsible.jsx.html +87 -72
- package/coverage/lcov-report/react/components/Error/ErrorUI.jsx.html +23 -23
- package/coverage/lcov-report/react/components/Error/error.js.html +21 -21
- package/coverage/lcov-report/react/components/Error/index.html +1 -1
- package/coverage/lcov-report/react/components/Footer/FooterUI.jsx.html +290 -254
- package/coverage/lcov-report/react/components/Footer/LegacyFooterUI.jsx.html +212 -182
- package/coverage/lcov-report/react/components/Footer/SocialLinks.jsx.html +66 -57
- package/coverage/lcov-report/react/components/Footer/Subscribe.jsx.html +30 -30
- package/coverage/lcov-report/react/components/Footer/footer.js.html +22 -22
- package/coverage/lcov-report/react/components/Footer/index.html +1 -1
- package/coverage/lcov-report/react/components/Header/HeaderAccountMenu.jsx.html +193 -151
- package/coverage/lcov-report/react/components/Header/HeaderCancel.jsx.html +9 -9
- package/coverage/lcov-report/react/components/Header/HeaderContainer.jsx.html +60 -45
- package/coverage/lcov-report/react/components/Header/HeaderLogo.jsx.html +36 -36
- package/coverage/lcov-report/react/components/Header/HeaderMenuButton.js.html +40 -40
- package/coverage/lcov-report/react/components/Header/HeaderMenuItem.jsx.html +348 -207
- package/coverage/lcov-report/react/components/Header/HeaderMenuLink.js.html +38 -38
- package/coverage/lcov-report/react/components/Header/HeaderMenuSignOutButton.js.html +51 -51
- package/coverage/lcov-report/react/components/Header/HeaderMobileButton.js.html +30 -30
- package/coverage/lcov-report/react/components/Header/HeaderUI.jsx.html +201 -150
- package/coverage/lcov-report/react/components/Header/HelpIcon.jsx.html +16 -16
- package/coverage/lcov-report/react/components/Header/ImpersonatorBanner.jsx.html +58 -49
- package/coverage/lcov-report/react/components/Header/NavigationButtonIcon.jsx.html +22 -22
- package/coverage/lcov-report/react/components/Header/header.js.html +42 -36
- package/coverage/lcov-report/react/components/Header/hooks.js.html +58 -37
- package/coverage/lcov-report/react/components/Header/index.html +1 -1
- package/coverage/lcov-report/react/components/Header/utag-helpers.js.html +9 -9
- package/coverage/lcov-report/react/components/Infotip/Infotip.jsx.html +49 -49
- package/coverage/lcov-report/react/components/Infotip/InfotipIcon.jsx.html +31 -31
- package/coverage/lcov-report/react/components/Infotip/index.html +1 -1
- package/coverage/lcov-report/react/components/Infotip/index.js.html +2 -2
- package/coverage/lcov-report/react/components/InputLabel/index.html +116 -0
- package/coverage/lcov-report/react/components/InputLabel/index.jsx.html +214 -0
- package/coverage/lcov-report/react/components/Modal/LegacyModal.jsx.html +62 -56
- package/coverage/lcov-report/react/components/Modal/Modal.jsx.html +122 -122
- package/coverage/lcov-report/react/components/Modal/index.html +1 -1
- package/coverage/lcov-report/react/components/Modal/index.jsx.html +12 -12
- package/coverage/lcov-report/react/components/NotificationBanner/index.html +1 -1
- package/coverage/lcov-report/react/components/NotificationBanner/index.js.html +269 -227
- package/coverage/lcov-report/react/components/Pagination/index.html +1 -1
- package/coverage/lcov-report/react/components/Pagination/index.jsx.html +195 -162
- package/coverage/lcov-report/react/components/SanitizedContent/index.html +1 -1
- package/coverage/lcov-report/react/components/SanitizedContent/index.jsx.html +184 -184
- package/coverage/lcov-report/react/components/Select/index.html +116 -0
- package/coverage/lcov-report/react/components/Select/index.jsx.html +391 -0
- package/coverage/lcov-report/react/components/SessionDialog/index.html +1 -1
- package/coverage/lcov-report/react/components/SessionDialog/sessionDialog.js.html +21 -21
- package/coverage/lcov-report/react/components/SessionDialogUI.jsx.html +257 -221
- package/coverage/lcov-report/react/components/SideNav/AnimationGroup/AnimationGroup.jsx.html +25 -19
- package/coverage/lcov-report/react/components/SideNav/AnimationGroup/index.html +1 -1
- package/coverage/lcov-report/react/components/SideNav/Chart/ScoreChart.jsx.html +261 -234
- package/coverage/lcov-report/react/components/SideNav/Chart/index.html +1 -1
- package/coverage/lcov-report/react/components/SideNav/Chart/index.js.html +2 -2
- package/coverage/lcov-report/react/components/SideNav/Content/LevelOneContent.jsx.html +197 -185
- package/coverage/lcov-report/react/components/SideNav/Content/LevelTwoContent.jsx.html +236 -197
- package/coverage/lcov-report/react/components/SideNav/Content/index.html +1 -1
- package/coverage/lcov-report/react/components/SideNav/Content/index.js.html +3 -3
- package/coverage/lcov-report/react/components/SideNav/Details/IndividualDetails.jsx.html +11 -11
- package/coverage/lcov-report/react/components/SideNav/Details/PracticeDetails.jsx.html +42 -36
- package/coverage/lcov-report/react/components/SideNav/Details/index.html +1 -1
- package/coverage/lcov-report/react/components/SideNav/Details/index.js.html +3 -3
- package/coverage/lcov-report/react/components/SideNav/Links/CmsSwitchLink.jsx.html +33 -33
- package/coverage/lcov-report/react/components/SideNav/Links/NavItemInline.jsx.html +45 -45
- package/coverage/lcov-report/react/components/SideNav/Links/NavLinkContainer.jsx.html +33 -27
- package/coverage/lcov-report/react/components/SideNav/Links/NavLinkDrawer.jsx.html +323 -215
- package/coverage/lcov-report/react/components/SideNav/Links/NavLinkInline.jsx.html +100 -94
- package/coverage/lcov-report/react/components/SideNav/Links/NavLinkToggle.jsx.html +26 -26
- package/coverage/lcov-report/react/components/SideNav/Links/index.html +1 -1
- package/coverage/lcov-report/react/components/SideNav/Links/index.js.html +11 -11
- package/coverage/lcov-report/react/components/SideNav/UI/SideNavUI.jsx.html +363 -303
- package/coverage/lcov-report/react/components/SideNav/UI/index.html +1 -1
- package/coverage/lcov-report/react/components/SideNav/UI/index.js.html +2 -2
- package/coverage/lcov-report/react/components/SideNav/helpers.js.html +34 -34
- package/coverage/lcov-report/react/components/SideNav/index.html +1 -1
- package/coverage/lcov-report/react/components/SideNav/index.js.html +47 -47
- package/coverage/lcov-report/react/components/Textfield/index.html +116 -0
- package/coverage/lcov-report/react/components/Textfield/index.jsx.html +322 -0
- package/coverage/lcov-report/react/components/Tooltip/Tooltip.jsx.html +58 -58
- package/coverage/lcov-report/react/components/Tooltip/index.html +1 -1
- package/coverage/lcov-report/react/components/Tooltip/index.js.html +2 -2
- package/coverage/lcov-report/react/components/Tooltip/position.js.html +60 -36
- package/coverage/lcov-report/react/components/hooks/index.html +1 -1
- package/coverage/lcov-report/react/components/hooks/useGetConfig.js.html +84 -57
- package/coverage/lcov-report/react/components/index.html +1 -1
- package/coverage/lcov-report/react/index.html +1 -1
- package/coverage/lcov-report/react/index.js.html +1 -1
- package/coverage/lcov-report/react/lib/Chevron.jsx.html +1 -1
- package/coverage/lcov-report/react/lib/SvgComponents.jsx.html +1 -1
- package/coverage/lcov-report/react/lib/index.html +1 -1
- package/coverage/lcov-report/react/lib/svg-definitions.svg.html +1 -1
- package/coverage/lcov-report/react/session/index.html +1 -1
- package/coverage/lcov-report/react/session/index.js.html +1 -1
- package/coverage/lcov-report/react/session/logout.js.html +1 -1
- package/coverage/lcov-report/react/session/refresh.js.html +1 -1
- package/coverage/lcov-report/react/session/ttl.js.html +1 -1
- package/coverage/lcov.info +855 -779
- package/dist/browser.js +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.js +16 -16
- package/dist/react/index.js.LICENSE.txt +1 -1
- package/dist/react/index.js.map +1 -1
- package/package.json +16 -9
- package/styles/qppds/components/_button.scss +29 -1
- package/test/components/Accordion.test.js +10 -10
- package/test/components/ErrorUI.test.js +29 -30
- package/test/components/FooterUI.test.js +82 -80
- package/test/components/HeaderUI.test.js +42 -38
- package/test/components/Infotip.test.js +64 -61
- package/test/components/Pagination.test.js +50 -50
- package/test/components/Select.test.js +113 -0
- package/test/components/SessionDialogUI.test.js +302 -294
- package/test/components/SideNavUI.test.js +19 -19
- package/test/components/TextField.test.js +50 -0
- package/test/components/Tooltip.test.js +133 -133
- package/test/index.test.js +6 -6
- package/test/session/session.test.js +200 -200
- package/storybook-static/0.5651be4a8d0b1984a772.manager.bundle.js +0 -2
- package/storybook-static/0.5651be4a8d0b1984a772.manager.bundle.js.LICENSE.txt +0 -8
- package/storybook-static/0.ce0ed568.iframe.bundle.js +0 -1
- package/storybook-static/1.1b179d27.iframe.bundle.js +0 -3
- package/storybook-static/1.1b179d27.iframe.bundle.js.LICENSE.txt +0 -8
- package/storybook-static/1.1b179d27.iframe.bundle.js.map +0 -1
- package/storybook-static/1.c46d7d065aa0aa5a87ca.manager.bundle.js +0 -1
- package/storybook-static/10.99011d85.iframe.bundle.js +0 -3
- package/storybook-static/10.99011d85.iframe.bundle.js.LICENSE.txt +0 -11
- package/storybook-static/10.99011d85.iframe.bundle.js.map +0 -1
- package/storybook-static/2.35ddc55d.iframe.bundle.js +0 -1
- package/storybook-static/3.ed97833d.iframe.bundle.js +0 -1
- package/storybook-static/5.333e450fad8648669908.manager.bundle.js +0 -1
- package/storybook-static/6.505ea3c696ed314e90c8.manager.bundle.js +0 -2
- package/storybook-static/6.505ea3c696ed314e90c8.manager.bundle.js.LICENSE.txt +0 -12
- package/storybook-static/7.94be8178.iframe.bundle.js +0 -1
- package/storybook-static/7.d26483fcb6f4087398a8.manager.bundle.js +0 -1
- package/storybook-static/8.68cd1217.iframe.bundle.js +0 -3
- package/storybook-static/8.68cd1217.iframe.bundle.js.LICENSE.txt +0 -12
- package/storybook-static/8.68cd1217.iframe.bundle.js.map +0 -1
- package/storybook-static/8.7adf0ef161215cd35a66.manager.bundle.js +0 -1
- package/storybook-static/9.488e3969.iframe.bundle.js +0 -1
- package/storybook-static/fonts/FontAwesome.otf +0 -0
- package/storybook-static/fonts/OFL.txt +0 -92
- package/storybook-static/fonts/Rubik-Black.ttf +0 -0
- package/storybook-static/fonts/Rubik-BlackItalic.ttf +0 -0
- package/storybook-static/fonts/Rubik-Bold.ttf +0 -0
- package/storybook-static/fonts/Rubik-BoldItalic.ttf +0 -0
- package/storybook-static/fonts/Rubik-Italic.ttf +0 -0
- package/storybook-static/fonts/Rubik-Light.ttf +0 -0
- package/storybook-static/fonts/Rubik-LightItalic.ttf +0 -0
- package/storybook-static/fonts/Rubik-Medium.ttf +0 -0
- package/storybook-static/fonts/Rubik-MediumItalic.ttf +0 -0
- package/storybook-static/fonts/Rubik-Regular.ttf +0 -0
- package/storybook-static/fonts/fontawesome-webfont.eot +0 -0
- package/storybook-static/fonts/fontawesome-webfont.svg +0 -2671
- package/storybook-static/fonts/fontawesome-webfont.ttf +0 -0
- package/storybook-static/fonts/fontawesome-webfont.woff +0 -0
- package/storybook-static/fonts/fontawesome-webfont.woff2 +0 -0
- package/storybook-static/iframe.html +0 -348
- package/storybook-static/images/favicon/android-chrome-192x192.png +0 -0
- package/storybook-static/images/favicon/android-chrome-256x256.png +0 -0
- package/storybook-static/images/favicon/apple-touch-icon.png +0 -0
- package/storybook-static/images/favicon/browserconfig.xml +0 -9
- package/storybook-static/images/favicon/favicon-16x16.png +0 -0
- package/storybook-static/images/favicon/favicon-32x32.png +0 -0
- package/storybook-static/images/favicon/favicon.ico +0 -0
- package/storybook-static/images/favicon/manifest.json +0 -18
- package/storybook-static/images/favicon/mstile-150x150.png +0 -0
- package/storybook-static/images/favicon/safari-pinned-tab.svg +0 -32
- package/storybook-static/images/hhs-logo-black.svg +0 -10
- package/storybook-static/images/hhs-logo-white.svg +0 -10
- package/storybook-static/images/icons/close-x.svg +0 -6
- package/storybook-static/images/icons/help-headset.svg +0 -21
- package/storybook-static/images/icons/svg/arrow-down.svg +0 -1
- package/storybook-static/images/icons/svg/arrow-download.svg +0 -1
- package/storybook-static/images/icons/svg/arrow-right.svg +0 -1
- package/storybook-static/images/icons/svg/calendar.svg +0 -1
- package/storybook-static/images/icons/svg/close.svg +0 -1
- package/storybook-static/images/icons/svg/download.svg +0 -1
- package/storybook-static/images/icons/svg/external.svg +0 -1
- package/storybook-static/images/icons/svg/file-upload.svg +0 -1
- package/storybook-static/images/icons/svg/print.svg +0 -1
- package/storybook-static/images/icons/svg/search.svg +0 -7
- package/storybook-static/images/icons/svg/tooltip-question.svg +0 -6
- package/storybook-static/images/icons/svg/trash.svg +0 -1
- package/storybook-static/images/icons/svg/upload.svg +0 -1
- package/storybook-static/images/qpp_logo_reversed.png +0 -0
- package/storybook-static/images/qpp_logo_rgb_color.png +0 -0
- package/storybook-static/index.html +0 -59
- package/storybook-static/main.5ae8041695a4f0c06f75.manager.bundle.js +0 -1
- package/storybook-static/main.ee2cae16.iframe.bundle.js +0 -1
- package/storybook-static/runtime~main.7eeb017b9a4ce6a70a00.manager.bundle.js +0 -1
- package/storybook-static/runtime~main.e2794f2d.iframe.bundle.js +0 -1
- package/storybook-static/static/media/Bitter-Bold.091bd4b7.woff +0 -0
- package/storybook-static/static/media/Bitter-Bold.24bf01e4.woff2 +0 -0
- package/storybook-static/static/media/Bitter-Bold.46bc29e4.ttf +0 -0
- package/storybook-static/static/media/Bitter-Bold.790f4f2f.eot +0 -0
- package/storybook-static/static/media/Bitter-Italic.1fa5390c.eot +0 -0
- package/storybook-static/static/media/Bitter-Italic.25e5675f.woff +0 -0
- package/storybook-static/static/media/Bitter-Italic.2eb18f5a.ttf +0 -0
- package/storybook-static/static/media/Bitter-Italic.34644574.woff2 +0 -0
- package/storybook-static/static/media/Bitter-Regular.4b22b6e8.woff +0 -0
- package/storybook-static/static/media/Bitter-Regular.559e7075.eot +0 -0
- package/storybook-static/static/media/Bitter-Regular.8db0301b.ttf +0 -0
- package/storybook-static/static/media/Bitter-Regular.f4e2f1f1.woff2 +0 -0
- package/storybook-static/static/media/FontAwesome.91f80bba.otf +0 -0
- package/storybook-static/static/media/OpenSans-Bold-webfont.202d819d.eot +0 -0
- package/storybook-static/static/media/OpenSans-Bold-webfont.92e570c6.woff2 +0 -0
- package/storybook-static/static/media/OpenSans-Bold-webfont.da71e99a.ttf +0 -0
- package/storybook-static/static/media/OpenSans-Bold-webfont.e75949bb.woff +0 -0
- package/storybook-static/static/media/OpenSans-Italic-webfont.72daa33a.woff2 +0 -0
- package/storybook-static/static/media/OpenSans-Italic-webfont.74ead3a8.woff +0 -0
- package/storybook-static/static/media/OpenSans-Italic-webfont.ae19388f.eot +0 -0
- package/storybook-static/static/media/OpenSans-Italic-webfont.ec7a2746.ttf +0 -0
- package/storybook-static/static/media/OpenSans-Regular-webfont.63a5fa7d.woff +0 -0
- package/storybook-static/static/media/OpenSans-Regular-webfont.66451be4.ttf +0 -0
- package/storybook-static/static/media/OpenSans-Regular-webfont.7882d20f.eot +0 -0
- package/storybook-static/static/media/OpenSans-Regular-webfont.ca4dd835.woff2 +0 -0
- package/storybook-static/static/media/OpenSans-Semibold-webfont.17ded75f.woff2 +0 -0
- package/storybook-static/static/media/OpenSans-Semibold-webfont.2a5adf6c.woff +0 -0
- package/storybook-static/static/media/OpenSans-Semibold-webfont.6059fecb.ttf +0 -0
- package/storybook-static/static/media/OpenSans-Semibold-webfont.c9808185.eot +0 -0
- package/storybook-static/static/media/Rubik-Bold.31bbd4d2.ttf +0 -0
- package/storybook-static/static/media/Rubik-Light.c90e2014.ttf +0 -0
- package/storybook-static/static/media/Rubik-Medium.5daa89aa.ttf +0 -0
- package/storybook-static/static/media/Rubik-Regular.cdf97d58.ttf +0 -0
- package/storybook-static/static/media/fontawesome-webfont.1e59d233.ttf +0 -0
- package/storybook-static/static/media/fontawesome-webfont.20fd1704.woff2 +0 -0
- package/storybook-static/static/media/fontawesome-webfont.8b43027f.eot +0 -0
- package/storybook-static/static/media/fontawesome-webfont.f691f37e.woff +0 -0
- package/storybook-static/vendors~main.c7e1bdf2e91d9cdba380.manager.bundle.js +0 -2
- package/storybook-static/vendors~main.c7e1bdf2e91d9cdba380.manager.bundle.js.LICENSE.txt +0 -104
- package/storybook-static/vendors~main.f299a23f.iframe.bundle.js +0 -76
- package/storybook-static/vendors~main.f299a23f.iframe.bundle.js.LICENSE.txt +0 -145
- package/storybook-static/vendors~main.f299a23f.iframe.bundle.js.map +0 -1
|
@@ -1,339 +1,347 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import ReactDOM from
|
|
3
|
-
import ReactTestUtils from
|
|
4
|
-
import { expect } from
|
|
5
|
-
import sinon from
|
|
6
|
-
import SessionDialogUI from
|
|
7
|
-
import * as Modal from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import ReactDOM from "react-dom";
|
|
3
|
+
import ReactTestUtils from "react-dom/test-utils";
|
|
4
|
+
import { expect } from "chai";
|
|
5
|
+
import sinon from "sinon";
|
|
6
|
+
import SessionDialogUI from "../../components/SessionDialogUI";
|
|
7
|
+
import * as Modal from "react-modal";
|
|
8
8
|
|
|
9
9
|
// Dependencies to stub out
|
|
10
|
-
import * as refreshModule from
|
|
11
|
-
import * as logoutModule from
|
|
12
|
-
|
|
13
|
-
describe(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
afterEach(() => {
|
|
37
|
-
clock.restore();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('closes the dialog when Refresh button is clicked', () => {
|
|
41
|
-
const refreshSpy = sinon.spy(SessionDialogUI.prototype, 'refreshSession');
|
|
42
|
-
const dialog = ReactTestUtils.renderIntoDocument(
|
|
43
|
-
<SessionDialogUI
|
|
44
|
-
showImmediate={true}
|
|
45
|
-
startTimer={sinon.spy()}
|
|
46
|
-
appElement="body"
|
|
47
|
-
/>
|
|
48
|
-
);
|
|
49
|
-
const refresh = sinon.stub(refreshModule, 'default').yieldsTo('onSuccess');
|
|
50
|
-
|
|
51
|
-
sinon.spy(dialog, 'startTimer');
|
|
52
|
-
sinon.spy(dialog, 'handleCloseModal');
|
|
53
|
-
|
|
54
|
-
const button = document.querySelector("[data-testid='modal-primary-btn']");
|
|
55
|
-
ReactTestUtils.Simulate.click(button);
|
|
56
|
-
|
|
57
|
-
expect(refreshSpy.calledOnce).to.be.true;
|
|
58
|
-
expect(refresh.calledOnce).to.be.true;
|
|
59
|
-
expect(dialog.handleCloseModal.calledOnce).to.be.true;
|
|
60
|
-
expect(dialog.startTimer.calledOnce).to.be.true;
|
|
61
|
-
|
|
62
|
-
refreshSpy.restore();
|
|
63
|
-
dialog.startTimer.restore();
|
|
64
|
-
dialog.handleCloseModal.restore();
|
|
65
|
-
refresh.restore();
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it('closes the dialog when Sign Out button is clicked', () => {
|
|
69
|
-
const signOutSpy = sinon.spy(SessionDialogUI.prototype, 'signOut');
|
|
70
|
-
const dialog = ReactTestUtils.renderIntoDocument(
|
|
71
|
-
<SessionDialogUI
|
|
72
|
-
showImmediate={true}
|
|
73
|
-
startTimer={sinon.spy()}
|
|
74
|
-
appElement="body"
|
|
75
|
-
/>
|
|
76
|
-
);
|
|
77
|
-
const logout = sinon.stub(logoutModule, 'default');
|
|
78
|
-
|
|
79
|
-
sinon.spy(dialog, 'handleCloseModal');
|
|
80
|
-
|
|
81
|
-
const button = document.querySelector(
|
|
82
|
-
"[data-testid='modal-secondary-btn']"
|
|
83
|
-
);
|
|
84
|
-
ReactTestUtils.Simulate.click(button);
|
|
85
|
-
|
|
86
|
-
expect(signOutSpy.calledOnce).to.be.true;
|
|
87
|
-
expect(dialog.handleCloseModal.calledOnce).to.be.true;
|
|
88
|
-
expect(logout.calledOnce).to.be.true;
|
|
89
|
-
|
|
90
|
-
signOutSpy.restore();
|
|
91
|
-
dialog.handleCloseModal.restore();
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it('renders the dialog HTML', () => {
|
|
95
|
-
const dialog = ReactTestUtils.renderIntoDocument(
|
|
96
|
-
<SessionDialogUI
|
|
97
|
-
showImmediate={true}
|
|
98
|
-
startTimer={sinon.spy()}
|
|
99
|
-
appElement="body"
|
|
100
|
-
/>
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
dialog.handleOpenModal();
|
|
104
|
-
|
|
105
|
-
// The dialog gets rendered as a sibling of the composite
|
|
106
|
-
// component, so check for it in the document instead
|
|
107
|
-
const node = document.querySelector('.ReactModal__Overlay');
|
|
108
|
-
|
|
109
|
-
expect(node).to.exist;
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it('has a default warningTimeout of 2 minutes', () => {
|
|
113
|
-
const dialog = ReactTestUtils.renderIntoDocument(
|
|
114
|
-
<SessionDialogUI appElement="body" />
|
|
115
|
-
);
|
|
116
|
-
expect(dialog.props).to.have.property('warningTimeout', 2);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
it('warningTimeout can be set to a different number', () => {
|
|
120
|
-
const dialog = ReactTestUtils.renderIntoDocument(
|
|
121
|
-
<SessionDialogUI warningTimeout={666} appElement="body" />
|
|
122
|
-
);
|
|
123
|
-
expect(dialog.props).to.have.property('warningTimeout', 666);
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
it('calls #startTimer by default', () => {
|
|
127
|
-
const spy = sinon.spy(SessionDialogUI.prototype, 'startTimer');
|
|
128
|
-
const dialog = ReactTestUtils.renderIntoDocument(
|
|
129
|
-
<SessionDialogUI appElement="body" />
|
|
130
|
-
);
|
|
131
|
-
|
|
132
|
-
expect(spy.calledOnce).to.be.true;
|
|
133
|
-
expect(dialog.state.showModal).to.be.false;
|
|
134
|
-
spy.restore();
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
it('bypasses #startTimer if showImmediate is true', () => {
|
|
138
|
-
const spy = sinon.spy(SessionDialogUI.prototype, 'startTimer');
|
|
139
|
-
const dialog = ReactTestUtils.renderIntoDocument(
|
|
140
|
-
<SessionDialogUI showImmediate={true} appElement="body" />
|
|
141
|
-
);
|
|
142
|
-
expect(spy.called).to.be.false;
|
|
143
|
-
expect(dialog.state.showModal).to.be.true;
|
|
144
|
-
spy.restore();
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
describe('#shouldShowDialog', () => {
|
|
148
|
-
it('time_remaining returns true within warning timeout', () => {
|
|
149
|
-
let expiry = 1800; // 30 minutes reminaing
|
|
150
|
-
const dialog = ReactTestUtils.renderIntoDocument(
|
|
151
|
-
<SessionDialogUI appElement="body" />
|
|
152
|
-
);
|
|
153
|
-
|
|
154
|
-
expect(dialog.shouldShowDialog(expiry)).to.be.false;
|
|
155
|
-
|
|
156
|
-
// 2 minutes remaining
|
|
157
|
-
expiry = 120;
|
|
158
|
-
|
|
159
|
-
expect(dialog.shouldShowDialog(expiry)).to.be.true;
|
|
10
|
+
import * as refreshModule from "../../session/refresh";
|
|
11
|
+
import * as logoutModule from "../../session/logout";
|
|
12
|
+
|
|
13
|
+
describe("SessionDialogUI", () => {
|
|
14
|
+
// Sample token via: https://github.com/auth0/jwt-decode/blob/master/test/tests.js
|
|
15
|
+
var token =
|
|
16
|
+
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmb28iOiJiYXIiLCJleHAiOjEzOTMyODY4OTMsImlhdCI6MTM5MzI2ODg5M30.4-iaDojEVl0pJQMjrbM1EzUIfAZgsbK_kgnVyVxFSVo";
|
|
17
|
+
var clock = null;
|
|
18
|
+
|
|
19
|
+
beforeEach(() => {
|
|
20
|
+
let container = document.querySelector(
|
|
21
|
+
"#qpp-style-session-dialog-container"
|
|
22
|
+
);
|
|
23
|
+
let modal = document.querySelector(".ReactModalPortal");
|
|
24
|
+
clock = sinon.useFakeTimers();
|
|
25
|
+
document.cookie = `qpp_auth_token=${token}`;
|
|
26
|
+
|
|
27
|
+
if (container) {
|
|
28
|
+
container.remove();
|
|
29
|
+
}
|
|
30
|
+
if (modal) {
|
|
31
|
+
modal.remove();
|
|
32
|
+
}
|
|
33
|
+
Modal.setAppElement = jest.fn(() => null);
|
|
160
34
|
});
|
|
161
35
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
const expiry = new Date(now + 30 * 60000);
|
|
166
|
-
const dialog = ReactTestUtils.renderIntoDocument(
|
|
167
|
-
<SessionDialogUI appElement="body" />
|
|
168
|
-
);
|
|
169
|
-
|
|
170
|
-
expect(dialog.shouldShowDialog(expiry)).to.be.false;
|
|
36
|
+
afterEach(() => {
|
|
37
|
+
clock.restore();
|
|
38
|
+
});
|
|
171
39
|
|
|
172
|
-
|
|
173
|
-
|
|
40
|
+
it("closes the dialog when Refresh button is clicked", () => {
|
|
41
|
+
const refreshSpy = sinon.spy(
|
|
42
|
+
SessionDialogUI.prototype,
|
|
43
|
+
"refreshSession"
|
|
44
|
+
);
|
|
45
|
+
const dialog = ReactTestUtils.renderIntoDocument(
|
|
46
|
+
<SessionDialogUI
|
|
47
|
+
showImmediate={true}
|
|
48
|
+
startTimer={sinon.spy()}
|
|
49
|
+
appElement="body"
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
const refresh = sinon
|
|
53
|
+
.stub(refreshModule, "default")
|
|
54
|
+
.yieldsTo("onSuccess");
|
|
55
|
+
|
|
56
|
+
sinon.spy(dialog, "startTimer");
|
|
57
|
+
sinon.spy(dialog, "handleCloseModal");
|
|
58
|
+
|
|
59
|
+
const button = document.querySelector(
|
|
60
|
+
"[data-testid='modal-primary-btn']"
|
|
61
|
+
);
|
|
62
|
+
ReactTestUtils.Simulate.click(button);
|
|
63
|
+
|
|
64
|
+
expect(refreshSpy.calledOnce).to.be.true;
|
|
65
|
+
expect(refresh.calledOnce).to.be.true;
|
|
66
|
+
expect(dialog.handleCloseModal.calledOnce).to.be.true;
|
|
67
|
+
expect(dialog.startTimer.calledOnce).to.be.true;
|
|
68
|
+
|
|
69
|
+
refreshSpy.restore();
|
|
70
|
+
dialog.startTimer.restore();
|
|
71
|
+
dialog.handleCloseModal.restore();
|
|
72
|
+
refresh.restore();
|
|
73
|
+
});
|
|
174
74
|
|
|
175
|
-
|
|
75
|
+
it("closes the dialog when Sign Out button is clicked", () => {
|
|
76
|
+
const signOutSpy = sinon.spy(SessionDialogUI.prototype, "signOut");
|
|
77
|
+
const dialog = ReactTestUtils.renderIntoDocument(
|
|
78
|
+
<SessionDialogUI
|
|
79
|
+
showImmediate={true}
|
|
80
|
+
startTimer={sinon.spy()}
|
|
81
|
+
appElement="body"
|
|
82
|
+
/>
|
|
83
|
+
);
|
|
84
|
+
const logout = sinon.stub(logoutModule, "default");
|
|
85
|
+
|
|
86
|
+
sinon.spy(dialog, "handleCloseModal");
|
|
87
|
+
|
|
88
|
+
const button = document.querySelector(
|
|
89
|
+
"[data-testid='modal-secondary-btn']"
|
|
90
|
+
);
|
|
91
|
+
ReactTestUtils.Simulate.click(button);
|
|
92
|
+
|
|
93
|
+
expect(signOutSpy.calledOnce).to.be.true;
|
|
94
|
+
expect(dialog.handleCloseModal.calledOnce).to.be.true;
|
|
95
|
+
expect(logout.calledOnce).to.be.true;
|
|
96
|
+
|
|
97
|
+
signOutSpy.restore();
|
|
98
|
+
dialog.handleCloseModal.restore();
|
|
176
99
|
});
|
|
177
100
|
|
|
178
|
-
it(
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
101
|
+
it("renders the dialog HTML", () => {
|
|
102
|
+
const dialog = ReactTestUtils.renderIntoDocument(
|
|
103
|
+
<SessionDialogUI
|
|
104
|
+
showImmediate={true}
|
|
105
|
+
startTimer={sinon.spy()}
|
|
106
|
+
appElement="body"
|
|
107
|
+
/>
|
|
108
|
+
);
|
|
183
109
|
|
|
184
|
-
|
|
110
|
+
dialog.handleOpenModal();
|
|
185
111
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
112
|
+
// The dialog gets rendered as a sibling of the composite
|
|
113
|
+
// component, so check for it in the document instead
|
|
114
|
+
const node = document.querySelector(".ReactModal__Overlay");
|
|
189
115
|
|
|
190
|
-
|
|
191
|
-
expiry = 15;
|
|
192
|
-
expect(dialog.shouldShowDialog(expiry)).to.be.true;
|
|
116
|
+
expect(node).to.exist;
|
|
193
117
|
});
|
|
194
118
|
|
|
195
|
-
it(
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
);
|
|
119
|
+
it("has a default warningTimeout of 2 minutes", () => {
|
|
120
|
+
const dialog = ReactTestUtils.renderIntoDocument(
|
|
121
|
+
<SessionDialogUI appElement="body" />
|
|
122
|
+
);
|
|
123
|
+
expect(dialog.props).to.have.property("warningTimeout", 2);
|
|
124
|
+
});
|
|
202
125
|
|
|
203
|
-
|
|
126
|
+
it("warningTimeout can be set to a different number", () => {
|
|
127
|
+
const dialog = ReactTestUtils.renderIntoDocument(
|
|
128
|
+
<SessionDialogUI warningTimeout={666} appElement="body" />
|
|
129
|
+
);
|
|
130
|
+
expect(dialog.props).to.have.property("warningTimeout", 666);
|
|
131
|
+
});
|
|
204
132
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
133
|
+
it("calls #startTimer by default", () => {
|
|
134
|
+
const spy = sinon.spy(SessionDialogUI.prototype, "startTimer");
|
|
135
|
+
const dialog = ReactTestUtils.renderIntoDocument(
|
|
136
|
+
<SessionDialogUI appElement="body" />
|
|
137
|
+
);
|
|
208
138
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
139
|
+
expect(spy.calledOnce).to.be.true;
|
|
140
|
+
expect(dialog.state.showModal).to.be.false;
|
|
141
|
+
spy.restore();
|
|
212
142
|
});
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
// 1 minute remaining
|
|
223
|
-
expiry = 60;
|
|
224
|
-
expect(dialog.shouldSignOut(expiry)).to.be.false;
|
|
225
|
-
|
|
226
|
-
// 0 minutes remaining
|
|
227
|
-
expiry = 0;
|
|
228
|
-
expect(dialog.shouldSignOut(expiry)).to.be.true;
|
|
143
|
+
|
|
144
|
+
it("bypasses #startTimer if showImmediate is true", () => {
|
|
145
|
+
const spy = sinon.spy(SessionDialogUI.prototype, "startTimer");
|
|
146
|
+
const dialog = ReactTestUtils.renderIntoDocument(
|
|
147
|
+
<SessionDialogUI showImmediate={true} appElement="body" />
|
|
148
|
+
);
|
|
149
|
+
expect(spy.called).to.be.false;
|
|
150
|
+
expect(dialog.state.showModal).to.be.true;
|
|
151
|
+
spy.restore();
|
|
229
152
|
});
|
|
230
153
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
154
|
+
describe("#shouldShowDialog", () => {
|
|
155
|
+
it("time_remaining returns true within warning timeout", () => {
|
|
156
|
+
let expiry = 1800; // 30 minutes reminaing
|
|
157
|
+
const dialog = ReactTestUtils.renderIntoDocument(
|
|
158
|
+
<SessionDialogUI appElement="body" />
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
expect(dialog.shouldShowDialog(expiry)).to.be.false;
|
|
162
|
+
|
|
163
|
+
// 2 minutes remaining
|
|
164
|
+
expiry = 120;
|
|
165
|
+
|
|
166
|
+
expect(dialog.shouldShowDialog(expiry)).to.be.true;
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
it("ttl returns true within warning timeout", () => {
|
|
170
|
+
const now = new Date().getTime();
|
|
171
|
+
// Set session expiration 30 minutes from now
|
|
172
|
+
const expiry = new Date(now + 30 * 60000);
|
|
173
|
+
const dialog = ReactTestUtils.renderIntoDocument(
|
|
174
|
+
<SessionDialogUI appElement="body" />
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
expect(dialog.shouldShowDialog(expiry)).to.be.false;
|
|
236
178
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
expect(dialog.shouldSignOut(expiry)).to.be.false;
|
|
179
|
+
// Advance clock 28 minutes
|
|
180
|
+
clock.tick(28 * 60000);
|
|
240
181
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
182
|
+
expect(dialog.shouldShowDialog(expiry)).to.be.true;
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
it("time_remaining works with custom warningTimeout", () => {
|
|
186
|
+
let expiry = 1800; // 30 minutes remaining
|
|
187
|
+
const dialog = ReactTestUtils.renderIntoDocument(
|
|
188
|
+
<SessionDialogUI warningTimeout={0.25} appElement="body" /> // 15 seconds warning
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
expect(dialog.shouldShowDialog(expiry)).to.be.false;
|
|
192
|
+
|
|
193
|
+
// At 2 minutes remaining, should still be false
|
|
194
|
+
expiry = 120;
|
|
195
|
+
expect(dialog.shouldShowDialog(expiry)).to.be.false;
|
|
196
|
+
|
|
197
|
+
// At 15 seconds left
|
|
198
|
+
expiry = 15;
|
|
199
|
+
expect(dialog.shouldShowDialog(expiry)).to.be.true;
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
it("ttl works with custom warningTimeout", () => {
|
|
203
|
+
const now = new Date().getTime();
|
|
204
|
+
// Set session expiration 4 minutes from now
|
|
205
|
+
const expiry = new Date(now + 4 * 60000);
|
|
206
|
+
const dialog = ReactTestUtils.renderIntoDocument(
|
|
207
|
+
<SessionDialogUI warningTimeout={0.25} appElement="body" />
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
expect(dialog.shouldShowDialog(expiry)).to.be.false;
|
|
211
|
+
|
|
212
|
+
// Advance clock 2 minutes, should still be false
|
|
213
|
+
clock.tick(120000);
|
|
214
|
+
expect(dialog.shouldShowDialog(expiry)).to.be.false;
|
|
215
|
+
|
|
216
|
+
// Advance clock another 00:01:45, to have 15 seconds left
|
|
217
|
+
clock.tick(105000);
|
|
218
|
+
expect(dialog.shouldShowDialog(expiry)).to.be.true;
|
|
219
|
+
});
|
|
244
220
|
});
|
|
245
221
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
222
|
+
describe("#shouldSignOut", () => {
|
|
223
|
+
it("returns true when time_remaining expiration is up", () => {
|
|
224
|
+
let expiry = 1800; // 30 minutes remaining
|
|
225
|
+
const dialog = ReactTestUtils.renderIntoDocument(
|
|
226
|
+
<SessionDialogUI appElement="body" />
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
// 1 minute remaining
|
|
230
|
+
expiry = 60;
|
|
231
|
+
expect(dialog.shouldSignOut(expiry)).to.be.false;
|
|
232
|
+
|
|
233
|
+
// 0 minutes remaining
|
|
234
|
+
expiry = 0;
|
|
235
|
+
expect(dialog.shouldSignOut(expiry)).to.be.true;
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
it("returns true when time_remaining within threshold", () => {
|
|
239
|
+
let expiry = 1800; // 30 minutes remaining
|
|
240
|
+
const dialog = ReactTestUtils.renderIntoDocument(
|
|
241
|
+
<SessionDialogUI appElement="body" />
|
|
242
|
+
);
|
|
243
|
+
|
|
244
|
+
// 1 minute remaining
|
|
245
|
+
expiry = 60;
|
|
246
|
+
expect(dialog.shouldSignOut(expiry)).to.be.false;
|
|
247
|
+
|
|
248
|
+
// 1 second remaining
|
|
249
|
+
expiry = 1;
|
|
250
|
+
expect(dialog.shouldSignOut(expiry)).to.be.true;
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
it("returns true when ttl expiration is up", () => {
|
|
254
|
+
const now = new Date().getTime();
|
|
255
|
+
// Set session expiration 30 minutes from now
|
|
256
|
+
const expiry = new Date(now + 30 * 60000);
|
|
257
|
+
const dialog = ReactTestUtils.renderIntoDocument(
|
|
258
|
+
<SessionDialogUI appElement="body" />
|
|
259
|
+
);
|
|
260
|
+
|
|
261
|
+
// Advance clock 29 minutes
|
|
262
|
+
clock.tick(29 * 60000);
|
|
263
|
+
expect(dialog.shouldSignOut(expiry)).to.be.false;
|
|
264
|
+
|
|
265
|
+
// Advance clock 1 more minute
|
|
266
|
+
clock.tick(60000);
|
|
267
|
+
expect(dialog.shouldSignOut(expiry)).to.be.true;
|
|
268
|
+
});
|
|
261
269
|
});
|
|
262
|
-
});
|
|
263
270
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
271
|
+
describe("#minutesUntil", () => {
|
|
272
|
+
it("#minutesUntil returns minutes until the time provided", () => {
|
|
273
|
+
const now = new Date().getTime();
|
|
274
|
+
// Set session expiration 30 minutes from now
|
|
275
|
+
const expiry = new Date(now + 30 * 60000);
|
|
276
|
+
const dialog = ReactTestUtils.renderIntoDocument(
|
|
277
|
+
<SessionDialogUI appElement="body" />
|
|
278
|
+
);
|
|
272
279
|
|
|
273
|
-
|
|
274
|
-
|
|
280
|
+
// Advance clock 15 minutes
|
|
281
|
+
clock.tick(15 * 60000);
|
|
275
282
|
|
|
276
|
-
|
|
283
|
+
expect(dialog.minutesUntil(expiry)).to.equal(15);
|
|
284
|
+
});
|
|
277
285
|
});
|
|
278
|
-
});
|
|
279
286
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
287
|
+
describe("#getTokenExpiry", () => {
|
|
288
|
+
it("extracts exp from token cookie and returns a date", () => {
|
|
289
|
+
const dialog = ReactTestUtils.renderIntoDocument(
|
|
290
|
+
<SessionDialogUI showImmediate={true} appElement="body" />
|
|
291
|
+
);
|
|
292
|
+
const cookies = {
|
|
293
|
+
qpp_auth_token: token,
|
|
294
|
+
};
|
|
288
295
|
|
|
289
|
-
|
|
290
|
-
|
|
296
|
+
const expected = 1393286893 * 1000;
|
|
297
|
+
const actual = dialog.getTokenExpiry(cookies);
|
|
291
298
|
|
|
292
|
-
|
|
293
|
-
|
|
299
|
+
expect(actual.getTime()).to.equal(expected);
|
|
300
|
+
});
|
|
294
301
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
302
|
+
it("returns null when the cookie is nonexistent", () => {
|
|
303
|
+
const dialog = ReactTestUtils.renderIntoDocument(
|
|
304
|
+
<SessionDialogUI showImmediate={true} appElement="body" />
|
|
305
|
+
);
|
|
306
|
+
const cookies = {};
|
|
300
307
|
|
|
301
|
-
|
|
308
|
+
const actual = dialog.getTokenExpiry(cookies);
|
|
302
309
|
|
|
303
|
-
|
|
310
|
+
expect(actual).to.be.null;
|
|
311
|
+
});
|
|
304
312
|
});
|
|
305
|
-
});
|
|
306
313
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
314
|
+
describe("#startTimer", () => {
|
|
315
|
+
it("interval will be cleared if expiry is falsy", () => {
|
|
316
|
+
const spy = sinon.spy(SessionDialogUI.prototype, "startTimer");
|
|
317
|
+
const dialog = ReactTestUtils.renderIntoDocument(
|
|
318
|
+
<SessionDialogUI showImmediate={true} appElement="body" />
|
|
319
|
+
);
|
|
313
320
|
|
|
314
|
-
|
|
321
|
+
document.cookie =
|
|
322
|
+
"qpp_auth_token=; expires=Thu, 1 Jan 1970 00:00:01 GMT";
|
|
315
323
|
|
|
316
|
-
|
|
324
|
+
dialog.startTimer();
|
|
317
325
|
|
|
318
|
-
|
|
326
|
+
clock.tick(120000);
|
|
319
327
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
328
|
+
expect(spy.calledOnce).to.be.true;
|
|
329
|
+
expect(spy.calledTwice).to.be.false;
|
|
330
|
+
spy.restore();
|
|
331
|
+
});
|
|
324
332
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
333
|
+
it("sets a warningInterval if given an expiration date", () => {
|
|
334
|
+
const dialog = ReactTestUtils.renderIntoDocument(
|
|
335
|
+
<SessionDialogUI showImmediate={true} appElement="body" />
|
|
336
|
+
);
|
|
337
|
+
const expiry = new Date(1393286893 * 1000);
|
|
330
338
|
|
|
331
|
-
|
|
339
|
+
dialog.startTimer(expiry);
|
|
332
340
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
341
|
+
// Sinon's fake timer seems to return an object from setInterval
|
|
342
|
+
// instead of a number. This may break if that bug gets fixed.
|
|
343
|
+
// expect(dialog.warningInterval).to.be.a('number');
|
|
344
|
+
expect(dialog.warningInterval).to.be.a("number");
|
|
345
|
+
});
|
|
337
346
|
});
|
|
338
|
-
});
|
|
339
347
|
});
|