@digigov/ui 0.8.0 → 0.9.1
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/CHANGELOG.md +41 -1
- package/api/index.spec.js +112 -212
- package/app/App.js +6 -8
- package/app/Header/HeaderLogo.js +19 -39
- package/app/Header/HeaderSection.js +6 -43
- package/app/Header/HeaderTitle.js +14 -91
- package/app/Header/index.js +20 -67
- package/app/Header/index.spec.js +0 -1
- package/app/PageTitle.js +45 -81
- package/core/Accordion/index.js +103 -57
- package/core/Blockquote/index.js +17 -47
- package/core/Button/BackButton.js +20 -42
- package/core/Button/ButtonLink.js +28 -0
- package/core/Button/CallToAction.js +21 -12
- package/core/Button/Icon.js +5 -47
- package/core/Button/index.js +49 -99
- package/core/Details/index.js +22 -70
- package/core/Divider/index.js +9 -9
- package/core/ErrorSummary/index.js +8 -28
- package/core/List/List.js +8 -34
- package/core/List/ListItem.js +8 -38
- package/core/List/ListItemTitle.js +1 -3
- package/core/NavList/NavListItem.js +2 -2
- package/core/NotificationBanner/index.js +49 -48
- package/core/NotificationBanner/index.spec.js +3 -1
- package/core/ServiceBadge/index.js +17 -28
- package/core/SummaryList/index.js +57 -124
- package/core/Tabs/index.js +65 -98
- package/core/WarningText/index.js +8 -41
- package/es/api/index.spec.js +112 -209
- package/es/app/App.js +6 -8
- package/es/app/Header/HeaderLogo.js +15 -30
- package/es/app/Header/HeaderSection.js +5 -36
- package/es/app/Header/HeaderTitle.js +13 -78
- package/es/app/Header/index.js +6 -56
- package/es/app/Header/index.spec.js +0 -1
- package/es/app/PageTitle.js +46 -74
- package/es/core/Accordion/index.js +64 -52
- package/es/core/Blockquote/index.js +13 -39
- package/es/core/Button/BackButton.js +18 -36
- package/es/core/Button/ButtonLink.js +16 -0
- package/es/core/Button/CallToAction.js +19 -9
- package/es/core/Button/Icon.js +5 -35
- package/es/core/Button/index.js +26 -87
- package/es/core/Details/index.js +5 -62
- package/es/core/Divider/index.js +7 -6
- package/es/core/ErrorSummary/index.js +2 -21
- package/es/core/List/List.js +2 -26
- package/es/core/List/ListItem.js +2 -30
- package/es/core/List/ListItemTitle.js +1 -3
- package/es/core/NavList/NavListItem.js +1 -1
- package/es/core/NotificationBanner/index.js +27 -45
- package/es/core/NotificationBanner/index.spec.js +3 -1
- package/es/core/ServiceBadge/index.js +15 -25
- package/es/core/SummaryList/index.js +7 -119
- package/es/core/Tabs/index.js +33 -93
- package/es/core/WarningText/index.js +2 -33
- package/es/govgr/Footer/Copyright.js +14 -36
- package/es/govgr/Footer/HellenicRepublicLogo.js +2 -30
- package/es/govgr/Footer/LicenseCCSA.js +2 -17
- package/es/govgr/Footer/index.js +23 -69
- package/es/govgr/Logo/index.js +2 -14
- package/es/hooks/useTogglableSections.js +96 -0
- package/es/layouts/Basic/Bottom/index.js +3 -13
- package/es/layouts/Basic/Content/index.js +14 -51
- package/es/layouts/Basic/Content/index.mdx +1 -1
- package/es/layouts/Basic/Main/index.js +3 -21
- package/es/layouts/Basic/Masthead/index.js +4 -47
- package/es/layouts/Basic/Masthead/index.mdx +1 -1
- package/es/layouts/Basic/Side/index.js +6 -28
- package/es/layouts/Basic/Top/index.js +7 -36
- package/es/layouts/Basic/index.js +3 -49
- package/es/themes/grnet.js +1 -1
- package/es/typography/Caption.js +5 -21
- package/es/typography/NormalText.js +2 -10
- package/es/typography/Paragraph.js +1 -29
- package/es/typography/Title.js +40 -87
- package/es/utils/withDeprecation.js +93 -0
- package/esm/api/index.spec.js +112 -209
- package/esm/app/App.js +6 -8
- package/esm/app/Header/HeaderLogo.js +15 -30
- package/esm/app/Header/HeaderSection.js +5 -36
- package/esm/app/Header/HeaderTitle.js +13 -78
- package/esm/app/Header/index.js +6 -56
- package/esm/app/Header/index.spec.js +0 -1
- package/esm/app/PageTitle.js +46 -74
- package/esm/core/Accordion/index.js +64 -52
- package/esm/core/Blockquote/index.js +13 -39
- package/esm/core/Button/BackButton.js +18 -36
- package/esm/core/Button/ButtonLink.js +16 -0
- package/esm/core/Button/CallToAction.js +19 -9
- package/esm/core/Button/Icon.js +5 -35
- package/esm/core/Button/index.js +26 -87
- package/esm/core/Details/index.js +5 -62
- package/esm/core/Divider/index.js +7 -6
- package/esm/core/ErrorSummary/index.js +2 -21
- package/esm/core/List/List.js +2 -26
- package/esm/core/List/ListItem.js +2 -30
- package/esm/core/List/ListItemTitle.js +1 -3
- package/esm/core/NavList/NavListItem.js +1 -1
- package/esm/core/NotificationBanner/index.js +27 -45
- package/esm/core/NotificationBanner/index.spec.js +3 -1
- package/esm/core/ServiceBadge/index.js +15 -25
- package/esm/core/SummaryList/index.js +7 -119
- package/esm/core/Tabs/index.js +33 -93
- package/esm/core/WarningText/index.js +2 -33
- package/esm/govgr/Footer/Copyright.js +14 -36
- package/esm/govgr/Footer/HellenicRepublicLogo.js +2 -30
- package/esm/govgr/Footer/LicenseCCSA.js +2 -17
- package/esm/govgr/Footer/index.js +23 -69
- package/esm/govgr/Logo/index.js +2 -14
- package/esm/hooks/useTogglableSections.js +96 -0
- package/esm/index.js +1 -1
- package/esm/layouts/Basic/Bottom/index.js +3 -13
- package/esm/layouts/Basic/Content/index.js +14 -51
- package/esm/layouts/Basic/Content/index.mdx +1 -1
- package/esm/layouts/Basic/Main/index.js +3 -21
- package/esm/layouts/Basic/Masthead/index.js +4 -47
- package/esm/layouts/Basic/Masthead/index.mdx +1 -1
- package/esm/layouts/Basic/Side/index.js +6 -28
- package/esm/layouts/Basic/Top/index.js +7 -36
- package/esm/layouts/Basic/index.js +3 -49
- package/esm/themes/grnet.js +1 -1
- package/esm/typography/Caption.js +5 -21
- package/esm/typography/NormalText.js +2 -10
- package/esm/typography/Paragraph.js +1 -29
- package/esm/typography/Title.js +40 -87
- package/esm/utils/withDeprecation.js +93 -0
- package/govgr/Footer/Copyright.js +15 -42
- package/govgr/Footer/HellenicRepublicLogo.js +8 -39
- package/govgr/Footer/LicenseCCSA.js +2 -19
- package/govgr/Footer/index.js +23 -72
- package/govgr/Logo/index.js +9 -28
- package/hooks/useTogglableSections.js +108 -0
- package/layouts/Basic/Bottom/index.js +10 -19
- package/layouts/Basic/Content/index.js +17 -68
- package/layouts/Basic/Content/index.mdx +1 -1
- package/layouts/Basic/Main/index.js +10 -23
- package/layouts/Basic/Masthead/index.js +17 -54
- package/layouts/Basic/Masthead/index.mdx +1 -1
- package/layouts/Basic/Side/index.js +9 -35
- package/layouts/Basic/Top/index.js +7 -40
- package/layouts/Basic/index.js +4 -57
- package/{api → libs/ui/src/api}/APIErrors.d.ts +0 -0
- package/{api → libs/ui/src/api}/APIProvider.d.ts +0 -0
- package/{api → libs/ui/src/api}/fetchAPI.d.ts +0 -0
- package/{api → libs/ui/src/api}/index.d.ts +0 -0
- package/{api → libs/ui/src/api}/index.spec.d.ts +0 -0
- package/{api → libs/ui/src/api}/useResource.d.ts +0 -0
- package/{api → libs/ui/src/api}/useResourceAction.d.ts +0 -0
- package/{api → libs/ui/src/api}/useResourceQuery.d.ts +0 -0
- package/{api → libs/ui/src/api}/utils.d.ts +0 -0
- package/{app → libs/ui/src/app}/App.d.ts +0 -0
- package/libs/ui/src/app/Header/HeaderLogo.d.ts +3 -0
- package/libs/ui/src/app/Header/HeaderSection.d.ts +5 -0
- package/libs/ui/src/app/Header/HeaderTitle.d.ts +5 -0
- package/libs/ui/src/app/Header/index.d.ts +9 -0
- package/{app → libs/ui/src/app}/Header/index.spec.d.ts +0 -0
- package/{app → libs/ui/src/app}/NotFound/index.d.ts +0 -0
- package/{app → libs/ui/src/app}/OutdatedBrowserBanner.d.ts +0 -0
- package/libs/ui/src/app/PageTitle.d.ts +10 -0
- package/{app → libs/ui/src/app}/QrCodeScanner/index.d.ts +0 -0
- package/{app → libs/ui/src/app}/QrCodeScanner/index.spec.d.ts +0 -0
- package/{app → libs/ui/src/app}/i18n.d.ts +0 -0
- package/{app → libs/ui/src/app}/index.d.ts +0 -0
- package/libs/ui/src/core/Accordion/index.d.ts +21 -0
- package/{core → libs/ui/src/core}/Accordion/index.spec.d.ts +0 -0
- package/libs/ui/src/core/Blockquote/index.d.ts +3 -0
- package/{core → libs/ui/src/core}/Blockquote/index.spec.d.ts +0 -0
- package/libs/ui/src/core/Button/BackButton.d.ts +3 -0
- package/libs/ui/src/core/Button/ButtonLink.d.ts +4 -0
- package/libs/ui/src/core/Button/CallToAction.d.ts +7 -0
- package/libs/ui/src/core/Button/Icon.d.ts +2 -0
- package/libs/ui/src/core/Button/index.d.ts +14 -0
- package/{core → libs/ui/src/core}/Button/index.spec.d.ts +0 -0
- package/libs/ui/src/core/Details/index.d.ts +5 -0
- package/{core → libs/ui/src/core}/Details/index.spec.d.ts +0 -0
- package/libs/ui/src/core/Divider/index.d.ts +5 -0
- package/libs/ui/src/core/ErrorSummary/index.d.ts +3 -0
- package/{core → libs/ui/src/core}/ErrorSummary/index.spec.d.ts +0 -0
- package/{core → libs/ui/src/core}/Link/index.d.ts +0 -0
- package/{core → libs/ui/src/core}/Link/index.spec.d.ts +0 -0
- package/libs/ui/src/core/List/List.d.ts +3 -0
- package/libs/ui/src/core/List/ListItem.d.ts +3 -0
- package/{core → libs/ui/src/core}/List/ListItemContent.d.ts +0 -0
- package/{core → libs/ui/src/core}/List/ListItemIcon.d.ts +0 -0
- package/{core → libs/ui/src/core}/List/ListItemText.d.ts +1 -0
- package/{core → libs/ui/src/core}/List/ListItemTitle.d.ts +0 -0
- package/{core → libs/ui/src/core}/List/index.d.ts +0 -0
- package/{core → libs/ui/src/core}/List/index.spec.d.ts +0 -0
- package/{core → libs/ui/src/core}/NavList/NavList.d.ts +1 -1
- package/{core → libs/ui/src/core}/NavList/NavListContext.d.ts +0 -0
- package/{core → libs/ui/src/core}/NavList/NavListItem.d.ts +0 -0
- package/{core → libs/ui/src/core}/NavList/NavListItemBase.d.ts +1 -1
- package/{core → libs/ui/src/core}/NavList/NavListSubMenu.d.ts +0 -0
- package/{core → libs/ui/src/core}/NavList/index.d.ts +0 -0
- package/{core → libs/ui/src/core}/NavList/index.spec.d.ts +0 -0
- package/libs/ui/src/core/NotificationBanner/index.d.ts +17 -0
- package/{core → libs/ui/src/core}/NotificationBanner/index.spec.d.ts +0 -0
- package/libs/ui/src/core/ServiceBadge/index.d.ts +8 -0
- package/libs/ui/src/core/SummaryList/index.d.ts +7 -0
- package/{core → libs/ui/src/core}/SummaryList/index.spec.d.ts +0 -0
- package/libs/ui/src/core/Tabs/index.d.ts +16 -0
- package/libs/ui/src/core/WarningText/index.d.ts +3 -0
- package/{core → libs/ui/src/core}/WarningText/index.spec.d.ts +0 -0
- package/{core → libs/ui/src/core}/index.d.ts +0 -0
- package/{govgr → libs/ui/src/govgr}/Footer/Copyright.d.ts +1 -1
- package/libs/ui/src/govgr/Footer/HellenicRepublicLogo.d.ts +3 -0
- package/{govgr → libs/ui/src/govgr}/Footer/LicenseCCSA.d.ts +0 -0
- package/{govgr → libs/ui/src/govgr}/Footer/index.d.ts +3 -3
- package/{govgr → libs/ui/src/govgr}/Footer/logo.d.ts +0 -0
- package/libs/ui/src/govgr/Footer/logos/logo-el.d.ts +2 -0
- package/libs/ui/src/govgr/Footer/logos/logo-en.d.ts +2 -0
- package/libs/ui/src/govgr/Logo/index.d.ts +3 -0
- package/{govgr → libs/ui/src/govgr}/Logo/logo.d.ts +0 -0
- package/{govgr → libs/ui/src/govgr}/index.d.ts +0 -0
- package/{hooks → libs/ui/src/hooks}/useDebounce.d.ts +0 -0
- package/{hooks → libs/ui/src/hooks}/useLatest.d.ts +0 -0
- package/{hooks → libs/ui/src/hooks}/useOutdatedBrowserCheck.d.ts +0 -0
- package/{hooks → libs/ui/src/hooks}/useSearch.d.ts +0 -0
- package/libs/ui/src/hooks/useTogglableSections.d.ts +18 -0
- package/{index.d.ts → libs/ui/src/index.d.ts} +0 -0
- package/libs/ui/src/layouts/Basic/Bottom/index.d.ts +3 -0
- package/libs/ui/src/layouts/Basic/Content/index.d.ts +5 -0
- package/libs/ui/src/layouts/Basic/Main/index.d.ts +3 -0
- package/libs/ui/src/layouts/Basic/Masthead/index.d.ts +4 -0
- package/libs/ui/src/layouts/Basic/Side/index.d.ts +3 -0
- package/libs/ui/src/layouts/Basic/Top/index.d.ts +3 -0
- package/libs/ui/src/layouts/Basic/index.d.ts +8 -0
- package/{layouts → libs/ui/src/layouts}/Basic/index.spec.d.ts +0 -0
- package/{layouts → libs/ui/src/layouts}/index.d.ts +0 -0
- package/{locales → libs/ui/src/locales}/el.d.ts +0 -0
- package/{locales → libs/ui/src/locales}/en.d.ts +0 -0
- package/{router → libs/ui/src/router}/index.d.ts +0 -0
- package/{test-utils → libs/ui/src/test-utils}/delay.d.ts +0 -0
- package/{test-utils → libs/ui/src/test-utils}/mountWithTheme.d.ts +0 -0
- package/{themes → libs/ui/src/themes}/govgr.d.ts +0 -0
- package/{themes → libs/ui/src/themes}/grnet.d.ts +0 -0
- package/{themes → libs/ui/src/themes}/index.d.ts +0 -0
- package/libs/ui/src/typography/Caption.d.ts +7 -0
- package/libs/ui/src/typography/NormalText.d.ts +5 -0
- package/libs/ui/src/typography/Paragraph.d.ts +6 -0
- package/libs/ui/src/typography/Title.d.ts +9 -0
- package/{typography → libs/ui/src/typography}/index.d.ts +0 -0
- package/{utils → libs/ui/src/utils}/evaluateBrowserVersion.d.ts +0 -0
- package/libs/ui/src/utils/withDeprecation.d.ts +16 -0
- package/libs-ui/react-core/src/Accordion/index.d.ts +10 -0
- package/libs-ui/react-core/src/AccordionControls/index.d.ts +9 -0
- package/libs-ui/react-core/src/AccordionSection/index.d.ts +15 -0
- package/libs-ui/react-core/src/AccordionSectionContent/index.d.ts +10 -0
- package/libs-ui/react-core/src/AccordionSectionHeader/index.d.ts +9 -0
- package/libs-ui/react-core/src/Aside/index.d.ts +10 -0
- package/libs-ui/react-core/src/BackLink/index.d.ts +13 -0
- package/libs-ui/react-core/src/Blockquote/index.d.ts +9 -0
- package/libs-ui/react-core/src/Bottom/index.d.ts +9 -0
- package/libs-ui/react-core/src/Button/index.d.ts +21 -0
- package/libs-ui/react-core/src/ButtonLink/index.d.ts +17 -0
- package/libs-ui/react-core/src/CallToAction/index.d.ts +10 -0
- package/libs-ui/react-core/src/Container/index.d.ts +9 -0
- package/libs-ui/react-core/src/Copyright/index.d.ts +10 -0
- package/libs-ui/react-core/src/Details/index.d.ts +10 -0
- package/libs-ui/react-core/src/DetailsContent/index.d.ts +10 -0
- package/libs-ui/react-core/src/DetailsSummary/index.d.ts +9 -0
- package/libs-ui/react-core/src/ErrorSummary/index.d.ts +9 -0
- package/libs-ui/react-core/src/Footer/index.d.ts +9 -0
- package/libs-ui/react-core/src/FooterContainer/index.d.ts +9 -0
- package/libs-ui/react-core/src/FooterMeta/index.d.ts +11 -0
- package/libs-ui/react-core/src/FooterMetaItem/index.d.ts +14 -0
- package/libs-ui/react-core/src/GovGRLogo/index.d.ts +9 -0
- package/libs-ui/react-core/src/Grid/index.d.ts +20 -0
- package/libs-ui/react-core/src/Header/index.d.ts +10 -0
- package/libs-ui/react-core/src/HeaderLogo/index.d.ts +17 -0
- package/libs-ui/react-core/src/HeaderSection/index.d.ts +9 -0
- package/libs-ui/react-core/src/HeaderSubtitle/index.d.ts +9 -0
- package/libs-ui/react-core/src/HeaderTitle/index.d.ts +13 -0
- package/libs-ui/react-core/src/Heading/index.d.ts +21 -0
- package/libs-ui/react-core/src/HeadingCaption/index.d.ts +15 -0
- package/libs-ui/react-core/src/HellenicRepublicLogo/index.d.ts +20 -0
- package/{govgr/Footer/logos → libs-ui/react-core/src/HellenicRepublicLogo}/logo-el.d.ts +0 -0
- package/{govgr/Footer/logos → libs-ui/react-core/src/HellenicRepublicLogo}/logo-en.d.ts +0 -0
- package/libs-ui/react-core/src/Layout/index.d.ts +10 -0
- package/libs-ui/react-core/src/List/index.d.ts +18 -0
- package/libs-ui/react-core/src/ListItem/index.d.ts +9 -0
- package/libs-ui/react-core/src/Main/index.d.ts +9 -0
- package/libs-ui/react-core/src/Masthead/index.d.ts +9 -0
- package/libs-ui/react-core/src/MastheadBody/index.d.ts +9 -0
- package/libs-ui/react-core/src/NormalText/index.d.ts +28 -0
- package/libs-ui/react-core/src/NotificationBanner/index.d.ts +17 -0
- package/libs-ui/react-core/src/NotificationBannerContent/index.d.ts +12 -0
- package/libs-ui/react-core/src/NotificationBannerHeader/index.d.ts +11 -0
- package/libs-ui/react-core/src/NotificationBannerHeading/index.d.ts +11 -0
- package/libs-ui/react-core/src/Paragraph/index.d.ts +26 -0
- package/libs-ui/react-core/src/PhaseBanner/index.d.ts +15 -0
- package/libs-ui/react-core/src/PhaseBannerTag/index.d.ts +9 -0
- package/libs-ui/react-core/src/SectionBreak/index.d.ts +18 -0
- package/libs-ui/react-core/src/SummaryList/index.d.ts +10 -0
- package/libs-ui/react-core/src/SummaryListItem/index.d.ts +10 -0
- package/libs-ui/react-core/src/SummaryListItemAction/index.d.ts +10 -0
- package/libs-ui/react-core/src/SummaryListItemKey/index.d.ts +10 -0
- package/libs-ui/react-core/src/SummaryListItemValue/index.d.ts +9 -0
- package/libs-ui/react-core/src/Tabs/index.d.ts +10 -0
- package/libs-ui/react-core/src/TabsHeading/index.d.ts +15 -0
- package/libs-ui/react-core/src/TabsList/index.d.ts +10 -0
- package/libs-ui/react-core/src/TabsListItem/index.d.ts +20 -0
- package/libs-ui/react-core/src/TabsPanel/index.d.ts +16 -0
- package/libs-ui/react-core/src/Top/index.d.ts +9 -0
- package/libs-ui/react-core/src/WarningText/index.d.ts +11 -0
- package/package.json +3 -2
- package/themes/grnet.js +1 -1
- package/typography/Caption.js +5 -25
- package/typography/NormalText.js +9 -16
- package/typography/Paragraph.js +3 -39
- package/typography/Title.js +42 -88
- package/utils/withDeprecation.js +105 -0
- package/app/Header/HeaderLogo.d.ts +0 -12
- package/app/Header/HeaderSection.d.ts +0 -6
- package/app/Header/HeaderTitle.d.ts +0 -26
- package/app/Header/index.d.ts +0 -20
- package/app/PageTitle.d.ts +0 -21
- package/core/Accordion/index.d.ts +0 -23
- package/core/Blockquote/index.d.ts +0 -9
- package/core/Button/BackButton.d.ts +0 -4
- package/core/Button/CallToAction.d.ts +0 -8
- package/core/Button/Icon.d.ts +0 -9
- package/core/Button/__snapshots__/index.spec.tsx.snap +0 -145
- package/core/Button/index.d.js +0 -1
- package/core/Button/index.d.ts +0 -26
- package/core/Details/index.d.ts +0 -17
- package/core/Divider/index.d.ts +0 -6
- package/core/ErrorSummary/index.d.ts +0 -8
- package/core/List/List.d.ts +0 -10
- package/core/List/ListItem.d.ts +0 -10
- package/core/NotificationBanner/index.d.ts +0 -7
- package/core/ServiceBadge/index.d.ts +0 -7
- package/core/SummaryList/index.d.ts +0 -29
- package/core/Tabs/index.d.ts +0 -21
- package/core/WarningText/index.d.ts +0 -8
- package/es/core/Button/__snapshots__/index.spec.tsx.snap +0 -145
- package/es/core/Button/index.d.js +0 -0
- package/esm/core/Button/__snapshots__/index.spec.tsx.snap +0 -145
- package/esm/core/Button/index.d.js +0 -0
- package/govgr/Footer/HellenicRepublicLogo.d.ts +0 -6
- package/govgr/Logo/index.d.ts +0 -3
- package/layouts/Basic/Bottom/index.d.ts +0 -5
- package/layouts/Basic/Content/index.d.ts +0 -9
- package/layouts/Basic/Main/index.d.ts +0 -8
- package/layouts/Basic/Masthead/index.d.ts +0 -7
- package/layouts/Basic/Side/index.d.ts +0 -14
- package/layouts/Basic/Top/index.d.ts +0 -13
- package/layouts/Basic/index.d.ts +0 -31
- package/typography/Caption.d.ts +0 -10
- package/typography/NormalText.d.ts +0 -6
- package/typography/Paragraph.d.ts +0 -7
- package/typography/Title.d.ts +0 -16
package/es/api/index.spec.js
CHANGED
|
@@ -8,7 +8,7 @@ import React, { Suspense, useEffect } from 'react';
|
|
|
8
8
|
import { render, fireEvent } from '@testing-library/react';
|
|
9
9
|
import fetchMock from 'fetch-mock';
|
|
10
10
|
import { APIProvider, useResource, useResourceAction, useResourceMany, APIErrors } from '@digigov/ui/api/index';
|
|
11
|
-
import delay from '
|
|
11
|
+
import delay from '@digigov/ui/test-utils/delay';
|
|
12
12
|
import fetchAPI from '@digigov/ui/api/fetchAPI';
|
|
13
13
|
import 'whatwg-fetch';
|
|
14
14
|
|
|
@@ -105,7 +105,7 @@ describe('fetchAPI', function () {
|
|
|
105
105
|
resource = 'resource';
|
|
106
106
|
path = 'some_id';
|
|
107
107
|
fetchMock.mock.apply(fetchMock, _toConsumableArray(buildMockOptions({
|
|
108
|
-
resource: "".concat(resource, "/").concat(path),
|
|
108
|
+
resource: "".concat(resource, "/").concat(path, "/"),
|
|
109
109
|
response: {
|
|
110
110
|
value: 'SWR'
|
|
111
111
|
}
|
|
@@ -137,7 +137,7 @@ describe('useResource', function () {
|
|
|
137
137
|
beforeEach(fetchMock.resetBehavior);
|
|
138
138
|
beforeEach(fetchMock.resetHistory);
|
|
139
139
|
it('useResource should return data', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
140
|
-
var resource, Page, _render, container;
|
|
140
|
+
var resource, Page, _render, container, _container$firstChild, _container$firstChild2;
|
|
141
141
|
|
|
142
142
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
143
143
|
while (1) {
|
|
@@ -167,12 +167,12 @@ describe('useResource', function () {
|
|
|
167
167
|
break;
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
170
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild = container.firstChild) === null || _container$firstChild === void 0 ? void 0 : _container$firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
171
171
|
_context2.next = 9;
|
|
172
172
|
return delay(DELAY);
|
|
173
173
|
|
|
174
174
|
case 9:
|
|
175
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
175
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild2 = container.firstChild) === null || _container$firstChild2 === void 0 ? void 0 : _container$firstChild2.textContent).toMatchInlineSnapshot("\"hello, SWR\"");
|
|
176
176
|
|
|
177
177
|
case 10:
|
|
178
178
|
expect(fetchMock.calls()).toHaveLength(1);
|
|
@@ -184,80 +184,20 @@ describe('useResource', function () {
|
|
|
184
184
|
}
|
|
185
185
|
}, _callee2);
|
|
186
186
|
})));
|
|
187
|
-
it('
|
|
188
|
-
var
|
|
187
|
+
it('should run duplicate request once', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
188
|
+
var _container$firstChild3, _container$firstChild4;
|
|
189
|
+
|
|
190
|
+
var resource, Page, _render2, container;
|
|
189
191
|
|
|
190
192
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
191
193
|
while (1) {
|
|
192
194
|
switch (_context3.prev = _context3.next) {
|
|
193
195
|
case 0:
|
|
194
196
|
Page = function _Page2() {
|
|
195
|
-
var _useResource2 = useResource(resource),
|
|
196
|
-
data = _useResource2.data; // eslint-disable-next-line
|
|
197
|
-
// @ts-ignore
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
var _useResource3 = useResource(resource2, function () {
|
|
201
|
-
return data.id;
|
|
202
|
-
}),
|
|
203
|
-
finalData = _useResource3.data;
|
|
204
|
-
|
|
205
|
-
return /*#__PURE__*/React.createElement("div", null, "hello, ", finalData === null || finalData === void 0 ? void 0 : finalData.value);
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
resource = 'resource1';
|
|
209
|
-
resource2 = 'resource2';
|
|
210
|
-
fetchMock.mock.apply(fetchMock, _toConsumableArray(buildMockOptions({
|
|
211
|
-
resource: resource,
|
|
212
|
-
response: {
|
|
213
|
-
id: 'myid'
|
|
214
|
-
}
|
|
215
|
-
})));
|
|
216
|
-
fetchMock.mock.apply(fetchMock, _toConsumableArray(buildMockOptions({
|
|
217
|
-
resource: "".concat(resource2, "/myid"),
|
|
218
|
-
response: {
|
|
219
|
-
value: 'MyFriend'
|
|
220
|
-
}
|
|
221
|
-
})));
|
|
222
|
-
_render2 = render( /*#__PURE__*/React.createElement(Page, null), {
|
|
223
|
-
wrapper: wrapper
|
|
224
|
-
}), container = _render2.container;
|
|
225
|
-
expect(container.firstChild).not.toBe(null);
|
|
226
|
-
|
|
227
|
-
if (!container.firstChild) {
|
|
228
|
-
_context3.next = 12;
|
|
229
|
-
break;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"something went wrong\"");
|
|
233
|
-
_context3.next = 11;
|
|
234
|
-
return delay(DELAY * 2);
|
|
235
|
-
|
|
236
|
-
case 11:
|
|
237
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"something went wrong\"");
|
|
238
|
-
|
|
239
|
-
case 12:
|
|
240
|
-
expect(fetchMock.calls()).toHaveLength(2);
|
|
241
|
-
|
|
242
|
-
case 13:
|
|
243
|
-
case "end":
|
|
244
|
-
return _context3.stop();
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}, _callee3);
|
|
248
|
-
})));
|
|
249
|
-
it('should run duplicate request once', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
250
|
-
var resource, Page, _render3, container;
|
|
251
|
-
|
|
252
|
-
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
253
|
-
while (1) {
|
|
254
|
-
switch (_context4.prev = _context4.next) {
|
|
255
|
-
case 0:
|
|
256
|
-
Page = function _Page3() {
|
|
257
197
|
useResource(resource);
|
|
258
198
|
|
|
259
|
-
var
|
|
260
|
-
duplData =
|
|
199
|
+
var _useResource2 = useResource(resource),
|
|
200
|
+
duplData = _useResource2.data;
|
|
261
201
|
|
|
262
202
|
return /*#__PURE__*/React.createElement("div", null, "hello, ", duplData === null || duplData === void 0 ? void 0 : duplData.value);
|
|
263
203
|
};
|
|
@@ -269,32 +209,24 @@ describe('useResource', function () {
|
|
|
269
209
|
value: 'myvalue'
|
|
270
210
|
}
|
|
271
211
|
})));
|
|
272
|
-
|
|
212
|
+
_render2 = render( /*#__PURE__*/React.createElement(Page, null), {
|
|
273
213
|
wrapper: wrapper
|
|
274
|
-
}), container =
|
|
214
|
+
}), container = _render2.container;
|
|
275
215
|
expect(container.firstChild).not.toBe(null);
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
_context4.next = 10;
|
|
279
|
-
break;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
283
|
-
_context4.next = 9;
|
|
216
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild3 = container.firstChild) === null || _container$firstChild3 === void 0 ? void 0 : _container$firstChild3.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
217
|
+
_context3.next = 8;
|
|
284
218
|
return delay(DELAY);
|
|
285
219
|
|
|
286
|
-
case
|
|
287
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
288
|
-
|
|
289
|
-
case 10:
|
|
220
|
+
case 8:
|
|
221
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild4 = container.firstChild) === null || _container$firstChild4 === void 0 ? void 0 : _container$firstChild4.textContent).toMatchInlineSnapshot("\"hello, myvalue\"");
|
|
290
222
|
expect(fetchMock.calls()).toHaveLength(1);
|
|
291
223
|
|
|
292
|
-
case
|
|
224
|
+
case 10:
|
|
293
225
|
case "end":
|
|
294
|
-
return
|
|
226
|
+
return _context3.stop();
|
|
295
227
|
}
|
|
296
228
|
}
|
|
297
|
-
},
|
|
229
|
+
}, _callee3);
|
|
298
230
|
})));
|
|
299
231
|
});
|
|
300
232
|
describe('useResourceAction', function () {
|
|
@@ -304,14 +236,16 @@ describe('useResourceAction', function () {
|
|
|
304
236
|
});
|
|
305
237
|
beforeEach(fetchMock.resetBehavior);
|
|
306
238
|
beforeEach(fetchMock.resetHistory);
|
|
307
|
-
it('useResourceAction should return result ', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
308
|
-
var
|
|
239
|
+
it('useResourceAction should return result ', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
240
|
+
var _container$firstChild5, _container$firstChild6;
|
|
309
241
|
|
|
310
|
-
|
|
242
|
+
var resource, Page, _render3, container;
|
|
243
|
+
|
|
244
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
311
245
|
while (1) {
|
|
312
|
-
switch (
|
|
246
|
+
switch (_context4.prev = _context4.next) {
|
|
313
247
|
case 0:
|
|
314
|
-
Page = function
|
|
248
|
+
Page = function _Page3() {
|
|
315
249
|
var _useResourceAction = useResourceAction(resource, undefined, 'POST', {
|
|
316
250
|
some: 'data'
|
|
317
251
|
}, undefined),
|
|
@@ -332,41 +266,35 @@ describe('useResourceAction', function () {
|
|
|
332
266
|
},
|
|
333
267
|
method: 'POST'
|
|
334
268
|
})));
|
|
335
|
-
|
|
269
|
+
_render3 = render( /*#__PURE__*/React.createElement(Page, null), {
|
|
336
270
|
wrapper: wrapper
|
|
337
|
-
}), container =
|
|
271
|
+
}), container = _render3.container;
|
|
338
272
|
expect(container.firstChild).not.toBe(null);
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
_context5.next = 10;
|
|
342
|
-
break;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
346
|
-
_context5.next = 9;
|
|
273
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild5 = container.firstChild) === null || _container$firstChild5 === void 0 ? void 0 : _container$firstChild5.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
274
|
+
_context4.next = 8;
|
|
347
275
|
return delay(DELAY * 2);
|
|
348
276
|
|
|
349
|
-
case
|
|
350
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
351
|
-
|
|
352
|
-
case 10:
|
|
277
|
+
case 8:
|
|
278
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild6 = container.firstChild) === null || _container$firstChild6 === void 0 ? void 0 : _container$firstChild6.textContent).toMatchInlineSnapshot("\"hello, myvalue\"");
|
|
353
279
|
expect(fetchMock.calls()).toHaveLength(1);
|
|
354
280
|
|
|
355
|
-
case
|
|
281
|
+
case 10:
|
|
356
282
|
case "end":
|
|
357
|
-
return
|
|
283
|
+
return _context4.stop();
|
|
358
284
|
}
|
|
359
285
|
}
|
|
360
|
-
},
|
|
286
|
+
}, _callee4);
|
|
361
287
|
})));
|
|
362
|
-
it('useResourceAction should be invalidated and run twice', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
363
|
-
var
|
|
288
|
+
it('useResourceAction should be invalidated and run twice', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
289
|
+
var _container$firstChild7, _container$firstChild8, _container$firstChild9, _container$firstChild10;
|
|
364
290
|
|
|
365
|
-
|
|
291
|
+
var resource, Page, _render4, container;
|
|
292
|
+
|
|
293
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
366
294
|
while (1) {
|
|
367
|
-
switch (
|
|
295
|
+
switch (_context5.prev = _context5.next) {
|
|
368
296
|
case 0:
|
|
369
|
-
Page = function
|
|
297
|
+
Page = function _Page4() {
|
|
370
298
|
var _useResourceAction2 = useResourceAction(resource, undefined, 'POST', {
|
|
371
299
|
some: 'data'
|
|
372
300
|
}, undefined),
|
|
@@ -396,42 +324,34 @@ describe('useResourceAction', function () {
|
|
|
396
324
|
},
|
|
397
325
|
method: 'POST'
|
|
398
326
|
})));
|
|
399
|
-
|
|
327
|
+
_render4 = render( /*#__PURE__*/React.createElement(Page, null), {
|
|
400
328
|
wrapper: wrapper
|
|
401
|
-
}), container =
|
|
329
|
+
}), container = _render4.container;
|
|
402
330
|
expect(container.firstChild).not.toBe(null);
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
_context6.next = 16;
|
|
406
|
-
break;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
410
|
-
_context6.next = 9;
|
|
331
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild7 = container.firstChild) === null || _container$firstChild7 === void 0 ? void 0 : _container$firstChild7.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
332
|
+
_context5.next = 8;
|
|
411
333
|
return delay(DELAY);
|
|
412
334
|
|
|
413
|
-
case
|
|
414
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
415
|
-
|
|
335
|
+
case 8:
|
|
336
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild8 = container.firstChild) === null || _container$firstChild8 === void 0 ? void 0 : _container$firstChild8.textContent).toMatchInlineSnapshot("\"hello, myvalue\"");
|
|
337
|
+
_context5.next = 11;
|
|
416
338
|
return delay(DELAY);
|
|
417
339
|
|
|
418
|
-
case
|
|
419
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
420
|
-
|
|
340
|
+
case 11:
|
|
341
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild9 = container.firstChild) === null || _container$firstChild9 === void 0 ? void 0 : _container$firstChild9.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
342
|
+
_context5.next = 14;
|
|
421
343
|
return delay(DELAY * 2);
|
|
422
344
|
|
|
423
|
-
case
|
|
424
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
425
|
-
|
|
426
|
-
case 16:
|
|
345
|
+
case 14:
|
|
346
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild10 = container.firstChild) === null || _container$firstChild10 === void 0 ? void 0 : _container$firstChild10.textContent).toMatchInlineSnapshot("\"hello, myvalue\"");
|
|
427
347
|
expect(fetchMock.calls()).toHaveLength(2);
|
|
428
348
|
|
|
429
|
-
case
|
|
349
|
+
case 16:
|
|
430
350
|
case "end":
|
|
431
|
-
return
|
|
351
|
+
return _context5.stop();
|
|
432
352
|
}
|
|
433
353
|
}
|
|
434
|
-
},
|
|
354
|
+
}, _callee5);
|
|
435
355
|
})));
|
|
436
356
|
});
|
|
437
357
|
describe('useResourceMany', function () {
|
|
@@ -440,15 +360,18 @@ describe('useResourceMany', function () {
|
|
|
440
360
|
fetchMock.restore();
|
|
441
361
|
});
|
|
442
362
|
beforeEach(fetchMock.resetBehavior);
|
|
443
|
-
beforeEach(fetchMock.resetHistory);
|
|
444
|
-
it('useResourceMany should return data', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
445
|
-
var resource, Page, _render6, container;
|
|
363
|
+
beforeEach(fetchMock.resetHistory); //check this test again (loading/hello)
|
|
446
364
|
|
|
447
|
-
|
|
365
|
+
it('useResourceMany should return data', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
366
|
+
var _container$firstChild11, _container$firstChild12;
|
|
367
|
+
|
|
368
|
+
var resource, Page, _render5, container;
|
|
369
|
+
|
|
370
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
448
371
|
while (1) {
|
|
449
|
-
switch (
|
|
372
|
+
switch (_context6.prev = _context6.next) {
|
|
450
373
|
case 0:
|
|
451
|
-
Page = function
|
|
374
|
+
Page = function _Page5() {
|
|
452
375
|
var _useResourceMany = useResourceMany(resource),
|
|
453
376
|
data = _useResourceMany.data;
|
|
454
377
|
|
|
@@ -470,41 +393,35 @@ describe('useResourceMany', function () {
|
|
|
470
393
|
}
|
|
471
394
|
}
|
|
472
395
|
})));
|
|
473
|
-
|
|
396
|
+
_render5 = render( /*#__PURE__*/React.createElement(Page, null), {
|
|
474
397
|
wrapper: wrapper
|
|
475
|
-
}), container =
|
|
398
|
+
}), container = _render5.container;
|
|
476
399
|
expect(container.firstChild).not.toBe(null);
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
_context7.next = 10;
|
|
480
|
-
break;
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"Loading\"");
|
|
484
|
-
_context7.next = 9;
|
|
400
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild11 = container.firstChild) === null || _container$firstChild11 === void 0 ? void 0 : _container$firstChild11.textContent).toMatchInlineSnapshot("\"Loading\"");
|
|
401
|
+
_context6.next = 8;
|
|
485
402
|
return delay(DELAY * 2);
|
|
486
403
|
|
|
487
|
-
case
|
|
488
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"
|
|
489
|
-
|
|
490
|
-
case 10:
|
|
404
|
+
case 8:
|
|
405
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild12 = container.firstChild) === null || _container$firstChild12 === void 0 ? void 0 : _container$firstChild12.textContent).toMatchInlineSnapshot("\"hello, SWR\"");
|
|
491
406
|
expect(fetchMock.calls()).toHaveLength(1);
|
|
492
407
|
|
|
493
|
-
case
|
|
408
|
+
case 10:
|
|
494
409
|
case "end":
|
|
495
|
-
return
|
|
410
|
+
return _context6.stop();
|
|
496
411
|
}
|
|
497
412
|
}
|
|
498
|
-
},
|
|
413
|
+
}, _callee6);
|
|
499
414
|
})));
|
|
500
|
-
it('useResourceMany should handle hasNext, hasPrevious', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
501
|
-
var
|
|
415
|
+
it('useResourceMany should handle hasNext, hasPrevious', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
416
|
+
var _container$firstChild13, _container$firstChild14;
|
|
502
417
|
|
|
503
|
-
|
|
418
|
+
var resource, Page, _render6, container;
|
|
419
|
+
|
|
420
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
504
421
|
while (1) {
|
|
505
|
-
switch (
|
|
422
|
+
switch (_context7.prev = _context7.next) {
|
|
506
423
|
case 0:
|
|
507
|
-
Page = function
|
|
424
|
+
Page = function _Page6() {
|
|
508
425
|
var _useResourceMany2 = useResourceMany(resource),
|
|
509
426
|
hasNext = _useResourceMany2.hasNext,
|
|
510
427
|
hasPrevious = _useResourceMany2.hasPrevious;
|
|
@@ -527,41 +444,35 @@ describe('useResourceMany', function () {
|
|
|
527
444
|
}
|
|
528
445
|
}
|
|
529
446
|
})));
|
|
530
|
-
|
|
447
|
+
_render6 = render( /*#__PURE__*/React.createElement(Page, null), {
|
|
531
448
|
wrapper: wrapper
|
|
532
|
-
}), container =
|
|
449
|
+
}), container = _render6.container;
|
|
533
450
|
expect(container.firstChild).not.toBe(null);
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
_context8.next = 10;
|
|
537
|
-
break;
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"Loading\"");
|
|
541
|
-
_context8.next = 9;
|
|
451
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild13 = container.firstChild) === null || _container$firstChild13 === void 0 ? void 0 : _container$firstChild13.textContent).toMatchInlineSnapshot("\"Loading\"");
|
|
452
|
+
_context7.next = 8;
|
|
542
453
|
return delay(DELAY);
|
|
543
454
|
|
|
544
|
-
case
|
|
545
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"
|
|
546
|
-
|
|
547
|
-
case 10:
|
|
455
|
+
case 8:
|
|
456
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild14 = container.firstChild) === null || _container$firstChild14 === void 0 ? void 0 : _container$firstChild14.textContent).toMatchInlineSnapshot("\"no next,no previous\"");
|
|
548
457
|
expect(fetchMock.calls()).toHaveLength(1);
|
|
549
458
|
|
|
550
|
-
case
|
|
459
|
+
case 10:
|
|
551
460
|
case "end":
|
|
552
|
-
return
|
|
461
|
+
return _context7.stop();
|
|
553
462
|
}
|
|
554
463
|
}
|
|
555
|
-
},
|
|
464
|
+
}, _callee7);
|
|
556
465
|
})));
|
|
557
|
-
it('useResourceMany should handle setPage with custom limit option', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
558
|
-
var
|
|
466
|
+
it('useResourceMany should handle setPage with custom limit option', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
467
|
+
var _container$firstChild15, _container$firstChild16, _container$firstChild17;
|
|
468
|
+
|
|
469
|
+
var resource, Page, _render7, container, getByText;
|
|
559
470
|
|
|
560
|
-
return _regeneratorRuntime.wrap(function
|
|
471
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
561
472
|
while (1) {
|
|
562
|
-
switch (
|
|
473
|
+
switch (_context8.prev = _context8.next) {
|
|
563
474
|
case 0:
|
|
564
|
-
Page = function
|
|
475
|
+
Page = function _Page7() {
|
|
565
476
|
var _useResourceMany3 = useResourceMany(resource, {
|
|
566
477
|
limit: 10
|
|
567
478
|
}),
|
|
@@ -607,37 +518,29 @@ describe('useResourceMany', function () {
|
|
|
607
518
|
}
|
|
608
519
|
}
|
|
609
520
|
})));
|
|
610
|
-
|
|
521
|
+
_render7 = render( /*#__PURE__*/React.createElement(Page, null), {
|
|
611
522
|
wrapper: wrapper
|
|
612
|
-
}), container =
|
|
523
|
+
}), container = _render7.container, getByText = _render7.getByText;
|
|
613
524
|
expect(container.firstChild).not.toBe(null);
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
_context9.next = 15;
|
|
617
|
-
break;
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"Loading\"");
|
|
621
|
-
_context9.next = 10;
|
|
525
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild15 = container.firstChild) === null || _container$firstChild15 === void 0 ? void 0 : _container$firstChild15.textContent).toMatchInlineSnapshot("\"Loading\"");
|
|
526
|
+
_context8.next = 9;
|
|
622
527
|
return delay(DELAY);
|
|
623
528
|
|
|
624
|
-
case
|
|
625
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"
|
|
529
|
+
case 9:
|
|
530
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild16 = container.firstChild) === null || _container$firstChild16 === void 0 ? void 0 : _container$firstChild16.textContent).toMatchInlineSnapshot("\"hello, SWRnext\"");
|
|
626
531
|
fireEvent.click(getByText('next'));
|
|
627
|
-
|
|
628
|
-
return delay(DELAY);
|
|
629
|
-
|
|
630
|
-
case 14:
|
|
631
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, RWSnext\"");
|
|
532
|
+
_context8.next = 13;
|
|
533
|
+
return delay(DELAY * 2);
|
|
632
534
|
|
|
633
|
-
case
|
|
535
|
+
case 13:
|
|
536
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild17 = container.firstChild) === null || _container$firstChild17 === void 0 ? void 0 : _container$firstChild17.textContent).toMatchInlineSnapshot("\"hello, RWSnext\"");
|
|
634
537
|
expect(fetchMock.calls()).toHaveLength(2);
|
|
635
538
|
|
|
636
|
-
case
|
|
539
|
+
case 15:
|
|
637
540
|
case "end":
|
|
638
|
-
return
|
|
541
|
+
return _context8.stop();
|
|
639
542
|
}
|
|
640
543
|
}
|
|
641
|
-
},
|
|
544
|
+
}, _callee8);
|
|
642
545
|
})));
|
|
643
546
|
});
|
package/es/app/App.js
CHANGED
|
@@ -5,25 +5,23 @@ export var useAppStyles = makeStyles({
|
|
|
5
5
|
root: {}
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
var _ref2 = /*#__PURE__*/React.createElement(CssBaseline, null);
|
|
9
|
-
|
|
10
8
|
var App = function App(_ref) {
|
|
11
9
|
var theme = _ref.theme,
|
|
12
10
|
children = _ref.children;
|
|
13
11
|
return /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
14
12
|
theme: theme
|
|
15
|
-
},
|
|
13
|
+
}, /*#__PURE__*/React.createElement(Suspense, {
|
|
16
14
|
fallback: 'loading...'
|
|
17
15
|
}, children));
|
|
18
16
|
};
|
|
19
17
|
|
|
20
|
-
var
|
|
18
|
+
var _ref3 = /*#__PURE__*/React.createElement(CssBaseline, null);
|
|
21
19
|
|
|
22
|
-
export var StaticApp = function StaticApp(
|
|
23
|
-
var theme =
|
|
24
|
-
children =
|
|
20
|
+
export var StaticApp = function StaticApp(_ref2) {
|
|
21
|
+
var theme = _ref2.theme,
|
|
22
|
+
children = _ref2.children;
|
|
25
23
|
return /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
26
24
|
theme: theme
|
|
27
|
-
},
|
|
25
|
+
}, _ref3, children);
|
|
28
26
|
};
|
|
29
27
|
export default App;
|
|
@@ -1,32 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import CoreHeaderLogo from '@digigov/react-core/HeaderLogo';
|
|
2
|
+
import withDeprecation from '@digigov/ui/utils/withDeprecation';
|
|
3
|
+
export var HeaderLogo = withDeprecation(CoreHeaderLogo, {
|
|
4
|
+
name: 'HeaderLogo',
|
|
5
|
+
props: {
|
|
6
|
+
height: {
|
|
7
|
+
warning: true
|
|
8
|
+
},
|
|
9
|
+
linkprops: {
|
|
10
|
+
warning: true
|
|
11
|
+
},
|
|
12
|
+
label: {
|
|
13
|
+
warning: true
|
|
14
|
+
}
|
|
15
|
+
}
|
|
11
16
|
});
|
|
12
|
-
export var HeaderLogo = function HeaderLogo(_ref) {
|
|
13
|
-
var _ref$href = _ref.href,
|
|
14
|
-
href = _ref$href === void 0 ? '' : _ref$href,
|
|
15
|
-
src = _ref.src,
|
|
16
|
-
label = _ref.label,
|
|
17
|
-
height = _ref.height,
|
|
18
|
-
className = _ref.className,
|
|
19
|
-
children = _ref.children,
|
|
20
|
-
linkProps = _ref.linkProps;
|
|
21
|
-
var styles = useHeaderLogoStyles();
|
|
22
|
-
return /*#__PURE__*/React.createElement(HeaderTitle, {
|
|
23
|
-
linkComponent: "a",
|
|
24
|
-
href: href,
|
|
25
|
-
linkProps: linkProps,
|
|
26
|
-
className: clsx(className, styles.root)
|
|
27
|
-
}, src ? /*#__PURE__*/React.createElement("img", {
|
|
28
|
-
src: src,
|
|
29
|
-
height: height || 40
|
|
30
|
-
}) : children || label || '');
|
|
31
|
-
};
|
|
32
17
|
export default HeaderLogo;
|
|
@@ -1,38 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import Grid from '@material-ui/core/Grid';
|
|
7
|
-
import { makeStyles } from '@material-ui/core';
|
|
8
|
-
export var useHeaderSectionStyles = makeStyles(function (theme) {
|
|
9
|
-
return {
|
|
10
|
-
root: {
|
|
11
|
-
display: 'flex',
|
|
12
|
-
alignItems: 'center',
|
|
13
|
-
padding: theme.spacing(2, 0)
|
|
14
|
-
},
|
|
15
|
-
container: {
|
|
16
|
-
padding: theme.spacing(2, 0)
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
}, {
|
|
20
|
-
name: 'MuiHeaderSection'
|
|
1
|
+
import CoreHeaderSection from '@digigov/react-core/HeaderSection';
|
|
2
|
+
import withDeprecation from '@digigov/ui/utils/withDeprecation';
|
|
3
|
+
export var HeaderSection = withDeprecation(CoreHeaderSection, {
|
|
4
|
+
name: 'HeaderSection',
|
|
5
|
+
rename: 'HeaderSection'
|
|
21
6
|
});
|
|
22
|
-
export var HeaderSection = function HeaderSection(_ref) {
|
|
23
|
-
var children = _ref.children,
|
|
24
|
-
className = _ref.className,
|
|
25
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
-
|
|
27
|
-
var styles = useHeaderSectionStyles();
|
|
28
|
-
return /*#__PURE__*/React.createElement(Grid, _extends({
|
|
29
|
-
item: true,
|
|
30
|
-
className: clsx(className, styles.root)
|
|
31
|
-
}, props), /*#__PURE__*/React.createElement(Grid, {
|
|
32
|
-
container: true,
|
|
33
|
-
alignItems: "center",
|
|
34
|
-
spacing: 2,
|
|
35
|
-
className: styles.container
|
|
36
|
-
}, children));
|
|
37
|
-
};
|
|
38
7
|
export default HeaderSection;
|