luna-one 3.1.593 → 3.1.595
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +15 -294
- package/dist/luna/components/2x2/2x2.stories.js +456 -0
- package/dist/luna/components/2x2/2x2Documentation.mdx +77 -0
- package/dist/luna/components/Accordion/Accordion.stories.js +100 -0
- package/dist/luna/components/Accordion/AccordionDocumentation.mdx +46 -0
- package/dist/luna/components/AdminCategoryData/AdminCategoryData.stories.js +43 -0
- package/dist/luna/components/AdminCategoryData/CategoryTranslationData.js +4 -4
- package/dist/luna/components/AdminProductData/AdminProductData.js +4 -4
- package/dist/luna/components/AdminProductData/AdminProductData.stories.js +44 -0
- package/dist/luna/components/BlockListItems/BlockListItem.stories.js +2381 -0
- package/dist/luna/components/BlockListItems/BlockListItemsDocumentation.mdx +339 -0
- package/dist/luna/components/BrowserSupportBanner/BrowserSupportBrowser.stories.js +19 -0
- package/dist/luna/components/CTAButtons/CTAButtons.stories.js +142 -0
- package/dist/luna/components/CTAButtons/CTAButtonsDocumentation.mdx +33 -0
- package/dist/luna/components/Carousel/Carousel.stories.js +257 -0
- package/dist/luna/components/Carousel/CarouselDocumentation.mdx +161 -0
- package/dist/luna/components/ComparisonTable/ComparisonTable.stories.js +608 -0
- package/dist/luna/components/ComparisonTable/ComparisonTableDocumentation.mdx +159 -0
- package/dist/luna/components/CtaWithHeader/CTAHeaderText.stories.js +192 -0
- package/dist/luna/components/CtaWithHeader/CTAHeaderTextDocumentation.mdx +45 -0
- package/dist/luna/components/DataPoint/DataPoint.stories.js +235 -0
- package/dist/luna/components/DataPoint/DataPointDocumentation.mdx +40 -0
- package/dist/luna/components/EventCard/EventCard.js +3 -3
- package/dist/luna/components/EventCard/EventCard.stories.js +56 -0
- package/dist/luna/components/EventCard/EventCardDocumentation.mdx +46 -0
- package/dist/luna/components/FilterHero/FilterHero.stories.js +129 -0
- package/dist/luna/components/FilterSection/FilterSection.stories.js +174 -0
- package/dist/luna/{other-organisms → components}/Flyout/Flyout.js +4 -5
- package/dist/luna/components/Flyout/Flyout.stories.js +216 -0
- package/dist/luna/components/Flyout/FlyoutDocumentation.mdx +60 -0
- package/dist/luna/components/Footer/Footer.stories.js +418 -0
- package/dist/luna/components/Footer/FooterDocumentation.mdx +133 -0
- package/dist/{application → luna}/components/FooterHandler/FooterHandler.js +1 -1
- package/dist/luna/components/FullBackgroundHero/FullBackgroundHero.stories.js +574 -0
- package/dist/luna/components/FullBackgroundHero/FullBackgroundHeroDocumentation.mdx +94 -0
- package/dist/luna/components/HTMLEmbed/HTMLEmbed.stories.js +136 -0
- package/dist/luna/components/HTMLEmbed/HTMLEmbedDocumentation.mdx +31 -0
- package/dist/luna/components/Header/Header.stories.js +75 -0
- package/dist/luna/components/Header/HeaderDocumentation.mdx +24 -0
- package/dist/luna/components/IconTextList/IconTextList.stories.js +100 -0
- package/dist/luna/components/IconTextList/IconTextListDocumentation.mdx +46 -0
- package/dist/luna/components/ImageGallery/ImageGallery.stories.js +194 -0
- package/dist/luna/components/ImageGallery/ImageGalleryDocumentation.mdx +90 -0
- package/dist/luna/components/InPageJumpNav/InPageJumpNav.stories.js +104 -0
- package/dist/luna/components/InPageJumpNav/InPageJumpNavDocumentation.mdx +23 -0
- package/dist/luna/components/JobPosting/JobPosting.stories.js +76 -0
- package/dist/luna/components/JobPosting/JobPostingDocumentation.mdx +69 -0
- package/dist/luna/{other-organisms → components}/LanguageSelector/LanguageSelector.js +3 -4
- package/dist/luna/components/LanguageSelector/LanguageSelector.stories.js +128 -0
- package/dist/luna/components/LanguageSelector/LanguageSelectorDocumentation.mdx +120 -0
- package/dist/luna/components/LinkList/LinkList.stories.js +170 -0
- package/dist/luna/components/LinkList/LinkListDocumentation.mdx +54 -0
- package/dist/luna/components/LoadingSpinner/LoadingSpinner.stories.js +53 -0
- package/dist/luna/components/Login/Login.js +3 -4
- package/dist/luna/components/Login/Login.stories.js +86 -0
- package/dist/luna/components/MarketoForm/MarketoForm.stories.js +65 -0
- package/dist/luna/components/MarketoForm/MarketoFormDocumentation.mdx +1 -0
- package/dist/luna/components/MegaMenu/MegaMenu.js +6 -7
- package/dist/luna/components/MegaMenu/menu-generators/FullSubMenu.js +1 -1
- package/dist/luna/components/MegaMenu/menu-generators/PartialSubMenu.js +4 -5
- package/dist/luna/components/MegaMenu/menu-generators/SubMenu.js +16 -14
- package/dist/luna/components/MegaMenu/menu-generators/TertiaryMenu.js +13 -11
- package/dist/luna/components/MegaMenu/menu-generators/UncollapsedLinks.js +4 -5
- package/dist/luna/components/MobileLogin/MobileLogin.js +3 -4
- package/dist/luna/components/MobileMegaMenu/MobileMegaMenu.js +6 -6
- package/dist/luna/components/MobileMegaMenu/MobileMegaMenuCategory.js +9 -9
- package/dist/luna/components/MobileMegaMenu/MobileMegaMenuPartialCategory.js +3 -3
- package/dist/luna/components/MobileMegaMenu/MobileMegaMenuSubCategory.js +8 -9
- package/dist/luna/components/MobileNav/MobileNav.js +3 -4
- package/dist/luna/{other-organisms → components}/NavBar/NavMiniMenu.js +3 -4
- package/dist/luna/components/NavBar/NavigationBar.stories.js +2297 -0
- package/dist/luna/components/NavBar/NavigationBarDocumentation.mdx +245 -0
- package/dist/luna/{other-organisms → components}/NavBar/UtilityNav.js +5 -5
- package/dist/{application → luna}/components/NavBarHandler/NavBarHandler.js +1 -1
- package/dist/luna/components/NavBarTop/NavBarTop.js +9 -10
- package/dist/luna/components/NavSearch/NavSearch.js +1 -1
- package/dist/luna/components/NonTimeBasedListEntries/NonTimeBasedListEntries.stories.js +118 -0
- package/dist/luna/components/NonTimeBasedListEntries/NonTimeBasedListEntriesDocumentation.mdx +89 -0
- package/dist/luna/components/NonTimeBasedListEntries/NonTimeBasedListEntriesMethods.js +1 -1
- package/dist/luna/components/OverlayNotice/OverlayNotice.stories.js +96 -0
- package/dist/luna/components/OverlayNotice/OverlayNoticeDocumentation.mdx +45 -0
- package/dist/luna/components/ProductSummary/ProductSummary.stories.js +163 -0
- package/dist/luna/components/ProductsPackage/ProductsPackage.stories.js +384 -0
- package/dist/luna/components/ProseLayout/ProseLayout.stories.js +187 -0
- package/dist/luna/components/ProseLayout/ProseLayoutDocumentation.mdx +93 -0
- package/dist/luna/components/PullQuote/PullQuote.stories.js +556 -0
- package/dist/luna/components/PullQuote/PullQuoteDocumentation.mdx +60 -0
- package/dist/luna/components/RegionCard/RegionCard.js +4 -4
- package/dist/luna/components/ResourceGrid/ResourceGrid.stories.js +765 -0
- package/dist/luna/components/ResourceGrid/ResourceGridDocumentation.mdx +102 -0
- package/dist/luna/components/ScrollInPlace/ScrollInPlace.stories.js +171 -0
- package/dist/luna/components/ScrollInPlace/ScrollInPlaceDocumentation.mdx +123 -0
- package/dist/luna/components/SketchUpPricingCard/SketchUpPricingCard.stories.js +91 -0
- package/dist/luna/components/SlideOutFeat/SlideOutFeat.stories.js +32 -0
- package/dist/luna/components/StoreFrontCard/StoreFrontCard.js +1 -2
- package/dist/luna/components/StoreFrontCard/StoreFrontCard.stories.js +46 -0
- package/dist/luna/{other-organisms → components}/SubNav/SiblingsMenu.js +3 -3
- package/dist/luna/{other-organisms → components}/SubNav/SubNav.js +6 -7
- package/dist/luna/components/SuperHero/SuperHero.stories.js +806 -0
- package/dist/luna/components/SuperHero/SuperHeroDocumentation.mdx +57 -0
- package/dist/luna/components/SupportCard/SupportCard.stories.js +76 -0
- package/dist/luna/components/Tabs/Tabs.js +1 -2
- package/dist/luna/components/Tabs/Tabs.stories.js +585 -0
- package/dist/luna/components/Tabs/TabsDocumentation.mdx +94 -0
- package/dist/luna/components/TimeBasedList/TimeBasedList.stories.js +297 -0
- package/dist/luna/components/TimeBasedList/TimeBasedListDocumentation.mdx +123 -0
- package/dist/luna/components/TrainerCard/TrainerCard.stories.js +39 -0
- package/dist/luna/components/TrialForm/TrialFormStart/TrialFormStart.stories.js +69 -0
- package/dist/luna/components/VariableContentCard/VariableContentCard.js +4 -4
- package/dist/luna/components/Video/Video.stories.js +135 -0
- package/dist/luna/components/Video/VideoDocumentation.mdx +56 -0
- package/dist/luna/components/WaffleMenu/WaffleMenu.js +1 -1
- package/package.json +3 -3
- package/dist/application/components/HelmetHandler/HelmetHandler.js +0 -40
- package/dist/application/components/Loading/Loading.js +0 -22
- package/dist/application/components/Loading/Loading.scss +0 -10
- package/dist/application/components/Stack/Stack.js +0 -413
- package/dist/application/hooks/tests/useErrorPageData.test.js +0 -74
- package/dist/application/hooks/tests/useFetch.test.js +0 -70
- package/dist/application/hooks/tests/useFooterData.test.js +0 -106
- package/dist/application/hooks/tests/useFooterResponse.test.js +0 -70
- package/dist/application/hooks/tests/useFooterURL.test.js +0 -46
- package/dist/application/hooks/tests/useInnerPageNav.test.js +0 -36
- package/dist/application/hooks/tests/useLanguage.test.js +0 -57
- package/dist/application/hooks/tests/useLanguages.test.js +0 -133
- package/dist/application/hooks/tests/useMetadata.test.js +0 -33
- package/dist/application/hooks/tests/useNavResponse.test.js +0 -136
- package/dist/application/hooks/tests/useNavURL.test.js +0 -49
- package/dist/application/hooks/tests/usePageFetch.test.js +0 -203
- package/dist/application/hooks/tests/useRegions.test.js +0 -234
- package/dist/application/hooks/tests/useRoutes.test.js +0 -116
- package/dist/application/hooks/tests/useSiteData.test.js +0 -86
- package/dist/application/hooks/useErrorPageData.js +0 -59
- package/dist/application/hooks/useFetch.js +0 -67
- package/dist/application/hooks/useFooterData.js +0 -45
- package/dist/application/hooks/useFooterResponse.js +0 -56
- package/dist/application/hooks/useFooterURL.js +0 -32
- package/dist/application/hooks/useLanguage.js +0 -44
- package/dist/application/hooks/useLanguages.js +0 -66
- package/dist/application/hooks/useMetadata.js +0 -23
- package/dist/application/hooks/useNavData.js +0 -45
- package/dist/application/hooks/useNavResponse.js +0 -59
- package/dist/application/hooks/useNavURL.js +0 -41
- package/dist/application/hooks/usePageFetch.js +0 -109
- package/dist/application/hooks/useRegions.js +0 -149
- package/dist/application/hooks/useRoutes.js +0 -59
- package/dist/application/hooks/useScrollTo.js +0 -60
- package/dist/application/hooks/useSiteData.js +0 -58
- package/dist/application/methods/__mocks__/formatFooterDataMethods.js +0 -54
- package/dist/application/methods/formatContentSections.js +0 -130
- package/dist/application/methods/formatFooterDataMethods.js +0 -82
- package/dist/application/methods/formatMenuSiteData.js +0 -45
- package/dist/application/methods/formatMenus.js +0 -120
- package/dist/application/methods/locationRedirect.js +0 -16
- package/dist/application/methods/organismFormat/__mocks__/formatAnchors.js +0 -11
- package/dist/application/methods/organismFormat/__mocks__/formatCTAs.js +0 -10
- package/dist/application/methods/organismFormat/__mocks__/formatTheme.js +0 -15
- package/dist/application/methods/organismFormat/feats/__mocks__/formatFeatFive.js +0 -12
- package/dist/application/methods/organismFormat/feats/__mocks__/formatFeatFour.js +0 -12
- package/dist/application/methods/organismFormat/feats/__mocks__/formatFeatOne.js +0 -12
- package/dist/application/methods/organismFormat/feats/__mocks__/formatFeatSeven.js +0 -12
- package/dist/application/methods/organismFormat/feats/__mocks__/formatFeatThree.js +0 -12
- package/dist/application/methods/organismFormat/feats/__mocks__/formatFeatTwoA.js +0 -12
- package/dist/application/methods/organismFormat/feats/__mocks__/formatFeatTwoB.js +0 -12
- package/dist/application/methods/organismFormat/feats/__mocks__/formatFeatTwoBIcons.js +0 -14
- package/dist/application/methods/organismFormat/feats/__mocks__/formatPullQuote.js +0 -12
- package/dist/application/methods/organismFormat/feats/formatFeatFive.js +0 -39
- package/dist/application/methods/organismFormat/feats/formatFeatFour.js +0 -36
- package/dist/application/methods/organismFormat/feats/formatFeatOne.js +0 -52
- package/dist/application/methods/organismFormat/feats/formatFeatSeven.js +0 -193
- package/dist/application/methods/organismFormat/feats/formatFeatThree.js +0 -41
- package/dist/application/methods/organismFormat/feats/formatFeatTwoA.js +0 -37
- package/dist/application/methods/organismFormat/feats/formatFeatTwoAFolds.js +0 -27
- package/dist/application/methods/organismFormat/feats/formatFeatTwoB.js +0 -40
- package/dist/application/methods/organismFormat/feats/formatFeatTwoBIcons.js +0 -20
- package/dist/application/methods/organismFormat/feats/formatPullQuote.js +0 -49
- package/dist/application/methods/organismFormat/feats/tests/formatFeatFive.test.js +0 -173
- package/dist/application/methods/organismFormat/feats/tests/formatFeatFour.test.js +0 -140
- package/dist/application/methods/organismFormat/feats/tests/formatFeatOne.test.js +0 -204
- package/dist/application/methods/organismFormat/feats/tests/formatFeatSeven.test.js +0 -680
- package/dist/application/methods/organismFormat/feats/tests/formatFeatThree.test.js +0 -142
- package/dist/application/methods/organismFormat/feats/tests/formatFeatTwoA.test.js +0 -342
- package/dist/application/methods/organismFormat/feats/tests/formatFeatTwoAFolds.test.js +0 -99
- package/dist/application/methods/organismFormat/feats/tests/formatFeatTwoB.test.js +0 -293
- package/dist/application/methods/organismFormat/feats/tests/formatFeatTwoBIcons.test.js +0 -78
- package/dist/application/methods/organismFormat/feats/tests/formatPullQuote.test.js +0 -178
- package/dist/application/methods/organismFormat/formatAnchors.js +0 -16
- package/dist/application/methods/organismFormat/formatCTAs.js +0 -34
- package/dist/application/methods/organismFormat/formatTheme.js +0 -29
- package/dist/application/methods/organismFormat/heroes/__mocks__/formatHeroFour.js +0 -12
- package/dist/application/methods/organismFormat/heroes/__mocks__/formatHeroOne.js +0 -12
- package/dist/application/methods/organismFormat/heroes/__mocks__/formatHeroSix.js +0 -12
- package/dist/application/methods/organismFormat/heroes/__mocks__/formatHeroThree.js +0 -12
- package/dist/application/methods/organismFormat/heroes/__mocks__/formatHeroTwo.js +0 -12
- package/dist/application/methods/organismFormat/heroes/formatHeroFour.js +0 -39
- package/dist/application/methods/organismFormat/heroes/formatHeroOne.js +0 -56
- package/dist/application/methods/organismFormat/heroes/formatHeroSeven.js +0 -56
- package/dist/application/methods/organismFormat/heroes/formatHeroSix.js +0 -51
- package/dist/application/methods/organismFormat/heroes/formatHeroThree.js +0 -58
- package/dist/application/methods/organismFormat/heroes/formatHeroTwo.js +0 -42
- package/dist/application/methods/organismFormat/heroes/tests/formatHeroFour.test.js +0 -245
- package/dist/application/methods/organismFormat/heroes/tests/formatHeroOne.test.js +0 -165
- package/dist/application/methods/organismFormat/heroes/tests/formatHeroSeven.test.js +0 -198
- package/dist/application/methods/organismFormat/heroes/tests/formatHeroSix.test.js +0 -196
- package/dist/application/methods/organismFormat/heroes/tests/formatHeroThree.test.js +0 -185
- package/dist/application/methods/organismFormat/heroes/tests/formatHeroTwo.test.js +0 -205
- package/dist/application/methods/organismFormat/listFeats/__mocks__/formatListFeatFive.js +0 -12
- package/dist/application/methods/organismFormat/listFeats/__mocks__/formatListFeatFour.js +0 -12
- package/dist/application/methods/organismFormat/listFeats/__mocks__/formatListFeatFourCards.js +0 -10
- package/dist/application/methods/organismFormat/listFeats/__mocks__/formatListFeatOne.js +0 -12
- package/dist/application/methods/organismFormat/listFeats/__mocks__/formatListFeatOneCards.js +0 -17
- package/dist/application/methods/organismFormat/listFeats/__mocks__/formatListFeatOneV2Cards.js +0 -27
- package/dist/application/methods/organismFormat/listFeats/__mocks__/formatListFeatSeven.js +0 -12
- package/dist/application/methods/organismFormat/listFeats/__mocks__/formatListFeatSevenCards.js +0 -10
- package/dist/application/methods/organismFormat/listFeats/__mocks__/formatListFeatSix.js +0 -12
- package/dist/application/methods/organismFormat/listFeats/__mocks__/formatListFeatSixCards.js +0 -10
- package/dist/application/methods/organismFormat/listFeats/__mocks__/formatListFeatThree.js +0 -12
- package/dist/application/methods/organismFormat/listFeats/__mocks__/formatListFeatThreeCards.js +0 -10
- package/dist/application/methods/organismFormat/listFeats/__mocks__/formatListFeatThreeV2Cards.js +0 -32
- package/dist/application/methods/organismFormat/listFeats/__mocks__/formatListFeatTopSection.js +0 -23
- package/dist/application/methods/organismFormat/listFeats/__mocks__/formatListFeatTwo.js +0 -12
- package/dist/application/methods/organismFormat/listFeats/__mocks__/formatListFeatTwoCards.js +0 -10
- package/dist/application/methods/organismFormat/listFeats/__mocks__/formatListFeatTwoV2Cards.js +0 -34
- package/dist/application/methods/organismFormat/listFeats/__mocks__/formatListFeatType.js +0 -10
- package/dist/application/methods/organismFormat/listFeats/__mocks__/formatListFeatV2.js +0 -33
- package/dist/application/methods/organismFormat/listFeats/formatListFeatFive.js +0 -53
- package/dist/application/methods/organismFormat/listFeats/formatListFeatFiveItemsV2.js +0 -32
- package/dist/application/methods/organismFormat/listFeats/formatListFeatFiveV2.js +0 -39
- package/dist/application/methods/organismFormat/listFeats/formatListFeatFour.js +0 -35
- package/dist/application/methods/organismFormat/listFeats/formatListFeatFourCards.js +0 -24
- package/dist/application/methods/organismFormat/listFeats/formatListFeatFourDumplingsV2.js +0 -36
- package/dist/application/methods/organismFormat/listFeats/formatListFeatFourV2.js +0 -38
- package/dist/application/methods/organismFormat/listFeats/formatListFeatOne.js +0 -46
- package/dist/application/methods/organismFormat/listFeats/formatListFeatOneCards.js +0 -36
- package/dist/application/methods/organismFormat/listFeats/formatListFeatOneV2.js +0 -41
- package/dist/application/methods/organismFormat/listFeats/formatListFeatOneV2Cards.js +0 -64
- package/dist/application/methods/organismFormat/listFeats/formatListFeatSeven.js +0 -37
- package/dist/application/methods/organismFormat/listFeats/formatListFeatSevenCards.js +0 -46
- package/dist/application/methods/organismFormat/listFeats/formatListFeatSevenCardsV2.js +0 -48
- package/dist/application/methods/organismFormat/listFeats/formatListFeatSevenV2.js +0 -39
- package/dist/application/methods/organismFormat/listFeats/formatListFeatSix.js +0 -36
- package/dist/application/methods/organismFormat/listFeats/formatListFeatSixCards.js +0 -15
- package/dist/application/methods/organismFormat/listFeats/formatListFeatSixCardsV2.js +0 -16
- package/dist/application/methods/organismFormat/listFeats/formatListFeatSixV2.js +0 -38
- package/dist/application/methods/organismFormat/listFeats/formatListFeatThree.js +0 -40
- package/dist/application/methods/organismFormat/listFeats/formatListFeatThreeCards.js +0 -48
- package/dist/application/methods/organismFormat/listFeats/formatListFeatThreeV2.js +0 -40
- package/dist/application/methods/organismFormat/listFeats/formatListFeatThreeV2Cards.js +0 -39
- package/dist/application/methods/organismFormat/listFeats/formatListFeatTopSection.js +0 -33
- package/dist/application/methods/organismFormat/listFeats/formatListFeatTwo.js +0 -36
- package/dist/application/methods/organismFormat/listFeats/formatListFeatTwoCards.js +0 -34
- package/dist/application/methods/organismFormat/listFeats/formatListFeatTwoV2.js +0 -40
- package/dist/application/methods/organismFormat/listFeats/formatListFeatTwoV2Cards.js +0 -46
- package/dist/application/methods/organismFormat/listFeats/formatListFeatType.js +0 -27
- package/dist/application/methods/organismFormat/listFeats/formatListFeatV2.js +0 -21
- package/dist/application/methods/organismFormat/listFeats/tests/formatFeatSevenV2.test.js +0 -463
- package/dist/application/methods/organismFormat/listFeats/tests/formatListFeatFive.test.js +0 -89
- package/dist/application/methods/organismFormat/listFeats/tests/formatListFeatFiveV2.test.js +0 -238
- package/dist/application/methods/organismFormat/listFeats/tests/formatListFeatFour.test.js +0 -75
- package/dist/application/methods/organismFormat/listFeats/tests/formatListFeatFourCards.test.js +0 -65
- package/dist/application/methods/organismFormat/listFeats/tests/formatListFeatFourV2.test.js +0 -358
- package/dist/application/methods/organismFormat/listFeats/tests/formatListFeatOne.test.js +0 -98
- package/dist/application/methods/organismFormat/listFeats/tests/formatListFeatOneCards.test.js +0 -67
- package/dist/application/methods/organismFormat/listFeats/tests/formatListFeatOneV2.test.js +0 -191
- package/dist/application/methods/organismFormat/listFeats/tests/formatListFeatOneV2Cards.test.js +0 -87
- package/dist/application/methods/organismFormat/listFeats/tests/formatListFeatSeven.test.js +0 -120
- package/dist/application/methods/organismFormat/listFeats/tests/formatListFeatSevenCards.test.js +0 -111
- package/dist/application/methods/organismFormat/listFeats/tests/formatListFeatSix.test.js +0 -67
- package/dist/application/methods/organismFormat/listFeats/tests/formatListFeatSixCards.test.js +0 -25
- package/dist/application/methods/organismFormat/listFeats/tests/formatListFeatSixV2.test.js +0 -242
- package/dist/application/methods/organismFormat/listFeats/tests/formatListFeatThree.test.js +0 -96
- package/dist/application/methods/organismFormat/listFeats/tests/formatListFeatThreeCards.test.js +0 -94
- package/dist/application/methods/organismFormat/listFeats/tests/formatListFeatThreeV2.test.js +0 -242
- package/dist/application/methods/organismFormat/listFeats/tests/formatListFeatThreeV2Cards.test.js +0 -96
- package/dist/application/methods/organismFormat/listFeats/tests/formatListFeatTopSection.test.js +0 -63
- package/dist/application/methods/organismFormat/listFeats/tests/formatListFeatTwo.test.js +0 -86
- package/dist/application/methods/organismFormat/listFeats/tests/formatListFeatTwoCards.test.js +0 -81
- package/dist/application/methods/organismFormat/listFeats/tests/formatListFeatTwoV2.test.js +0 -299
- package/dist/application/methods/organismFormat/listFeats/tests/formatListFeatTwoV2Cards.test.js +0 -159
- package/dist/application/methods/organismFormat/listFeats/tests/formatListFeatV2.test.js +0 -69
- package/dist/application/methods/organismFormat/listFeats/tests/mockData/listFeatOneV2MockData.js +0 -125
- package/dist/application/methods/organismFormat/tests/formatAnchors.test.js +0 -20
- package/dist/application/methods/organismFormat/tests/formatCTAs.test.js +0 -109
- package/dist/application/methods/organismFormat/tests/formatTheme.test.js +0 -54
- package/dist/application/methods/tests/formatContentSections.test.js +0 -237
- package/dist/application/methods/tests/formatFooterDataMethods.test.js +0 -138
- package/dist/luna/components/MiniFeatDropdown/MiniFeatDropdown.js +0 -78
- package/dist/luna/components/MiniFeatDropdown/MiniFeatDropdown.scss +0 -107
- package/dist/luna/featurettes/CustomFeat/CustomFeat.js +0 -157
- package/dist/luna/featurettes/CustomFeat/CustomFeat.scss +0 -18
- package/dist/luna/featurettes/Feat1/Feat1.js +0 -122
- package/dist/luna/featurettes/Feat1/Feat1.scss +0 -110
- package/dist/luna/featurettes/Feat1/feat1Methods.js +0 -18
- package/dist/luna/featurettes/Feat1/feat1Methods.test.js +0 -21
- package/dist/luna/featurettes/Feat2A/Feat2A.js +0 -101
- package/dist/luna/featurettes/Feat2A/Feat2A.scss +0 -132
- package/dist/luna/featurettes/Feat2B/Feat2B.js +0 -131
- package/dist/luna/featurettes/Feat2B/Feat2B.scss +0 -231
- package/dist/luna/featurettes/Feat2B/Feat2BMethods.js +0 -75
- package/dist/luna/featurettes/Feat2B/Feat2BMethods.test.js +0 -38
- package/dist/luna/featurettes/Feat3/Feat3.js +0 -89
- package/dist/luna/featurettes/Feat3/Feat3.scss +0 -49
- package/dist/luna/featurettes/Feat4/Feat4.js +0 -95
- package/dist/luna/featurettes/Feat4/Feat4.scss +0 -86
- package/dist/luna/featurettes/Feat5/Feat5.js +0 -194
- package/dist/luna/featurettes/Feat5/Feat5.scss +0 -235
- package/dist/luna/featurettes/Feat5/Feat5Methods.js +0 -19
- package/dist/luna/featurettes/Feat5/Feat5Methods.test.js +0 -23
- package/dist/luna/featurettes/Feat7/Feat7.js +0 -79
- package/dist/luna/featurettes/Feat7/Feat7.scss +0 -49
- package/dist/luna/featurettes/Feat7/Feat7Methods.js +0 -41
- package/dist/luna/featurettes/Feat8/Feat8.js +0 -75
- package/dist/luna/featurettes/Feat8/Feat8.scss +0 -103
- package/dist/luna/featurettes/Feat8/feat8Methods.js +0 -18
- package/dist/luna/featurettes/Feat8/feat8Methods.test.js +0 -21
- package/dist/luna/heroes/Hero1/Hero1.js +0 -111
- package/dist/luna/heroes/Hero1/Hero1.scss +0 -223
- package/dist/luna/heroes/Hero1/Hero1Methods.js +0 -84
- package/dist/luna/heroes/Hero1/useWindowSize.js +0 -47
- package/dist/luna/heroes/Hero2/Hero2.js +0 -130
- package/dist/luna/heroes/Hero2/Hero2.scss +0 -165
- package/dist/luna/heroes/Hero3/Hero3.js +0 -246
- package/dist/luna/heroes/Hero3/Hero3.scss +0 -250
- package/dist/luna/heroes/Hero3/Hero3Methods.js +0 -37
- package/dist/luna/heroes/Hero4/Hero4.js +0 -175
- package/dist/luna/heroes/Hero4/Hero4.scss +0 -112
- package/dist/luna/heroes/Hero4/hero4Methods.js +0 -18
- package/dist/luna/heroes/Hero6/Hero6.js +0 -179
- package/dist/luna/heroes/Hero6/Hero6.scss +0 -127
- package/dist/luna/heroes/Hero7/Hero7.js +0 -118
- package/dist/luna/heroes/Hero7/Hero7.scss +0 -193
- package/dist/luna/heroes/Hero7/Hero7Methods.js +0 -39
- package/dist/luna/heroes/Hero7/Hero7Methods.test.js +0 -109
- package/dist/luna/heroes/Hero7/useWindowWidth.js +0 -40
- package/dist/luna/list-feats/ListFeat/ListFeat.js +0 -149
- package/dist/luna/list-feats/ListFeat/ListFeat.scss +0 -112
- package/dist/luna/list-feats/ListFeat1/ListFeat1.js +0 -91
- package/dist/luna/list-feats/ListFeat1/ListFeat1.scss +0 -94
- package/dist/luna/list-feats/ListFeat1/listFeat1Methods.js +0 -14
- package/dist/luna/list-feats/ListFeat1/listFeat1Methods.test.js +0 -17
- package/dist/luna/list-feats/ListFeat2/ListFeat2.js +0 -30
- package/dist/luna/list-feats/ListFeat2/ListFeat2.scss +0 -20
- package/dist/luna/list-feats/ListFeat2/ListFeat2Methods.js +0 -33
- package/dist/luna/list-feats/ListFeat2/ListFeat2Methods.test.js +0 -11
- package/dist/luna/list-feats/ListFeat4/ListFeat4.js +0 -34
- package/dist/luna/list-feats/ListFeat4/ListFeat4.scss +0 -32
- package/dist/luna/list-feats/ListFeat5/ListFeat5.js +0 -28
- package/dist/luna/list-feats/ListFeat5/ListFeat5.scss +0 -27
- package/dist/luna/list-feats/ListFeat5/ListFeat5Methods.js +0 -24
- package/dist/luna/list-feats/ListFeat6/ListFeat6.js +0 -59
- package/dist/luna/list-feats/ListFeat6/ListFeat6.scss +0 -34
- package/dist/luna/list-feats/ListFeat7/ListFeat7.js +0 -51
- package/dist/luna/list-feats/ListFeat7/ListFeat7.scss +0 -14
- package/dist/luna/list-feats/ListFeat7/ListFeat7Methods.js +0 -49
- package/dist/luna/list-feats/ListFeatCustom/ListFeatCustom.js +0 -25
- package/dist/luna/list-feats/ListFeatCustom/ListFeatCustom.scss +0 -8
- package/dist/luna/list-feats/methods/listFeatMethods.js +0 -119
- /package/dist/luna/{featurettes → components}/Accordion/Accordion.js +0 -0
- /package/dist/luna/{featurettes → components}/Accordion/Accordion.scss +0 -0
- /package/dist/luna/{featurettes → components}/Accordion/AccordionItem.js +0 -0
- /package/dist/luna/{other-organisms → components}/Carousel/Carousel.js +0 -0
- /package/dist/luna/{other-organisms → components}/Carousel/Carousel.scss +0 -0
- /package/dist/luna/{heroes → components}/FilterHero/FilterHero.js +0 -0
- /package/dist/luna/{heroes → components}/FilterHero/FilterHero.scss +0 -0
- /package/dist/luna/{heroes → components}/FilterHero/FilterHeroMethods.js +0 -0
- /package/dist/luna/{other-organisms → components}/Flyout/Flyout.scss +0 -0
- /package/dist/luna/{other-organisms → components}/Footer/ExportedFooter.js +0 -0
- /package/dist/luna/{other-organisms → components}/Footer/Footer.js +0 -0
- /package/dist/luna/{other-organisms → components}/Footer/Footer.scss +0 -0
- /package/dist/luna/{other-organisms → components}/Footer/GlobalFooter.js +0 -0
- /package/dist/luna/{other-organisms → components}/Footer/SectorFooter.js +0 -0
- /package/dist/luna/{heroes → components}/FullBackgroundHero/FullBackgroundHero.js +0 -0
- /package/dist/luna/{heroes → components}/FullBackgroundHero/FullBackgroundHero.scss +0 -0
- /package/dist/luna/{heroes → components}/FullBackgroundHero/FullBackgroundHeroMethods.js +0 -0
- /package/dist/luna/{featurettes → components}/IconTextList/IconTextList.js +0 -0
- /package/dist/luna/{featurettes → components}/IconTextList/IconTextList.scss +0 -0
- /package/dist/luna/{other-organisms → components}/LanguageSelector/LanguageSelector.scss +0 -0
- /package/dist/luna/{other-organisms → components}/MarketoForm/MarketoForm.js +0 -0
- /package/dist/luna/{other-organisms → components}/MarketoForm/MarketoForm.scss +0 -0
- /package/dist/luna/{other-organisms → components}/NavBar/NavBar.js +0 -0
- /package/dist/luna/{other-organisms → components}/NavBar/NavBar.scss +0 -0
- /package/dist/luna/{other-organisms → components}/NavBar/NavOption.js +0 -0
- /package/dist/luna/{other-organisms → components}/NavBar/useNavPosition.js +0 -0
- /package/dist/luna/{featurettes → components}/ProductsPackage/ProductsPackage.js +0 -0
- /package/dist/luna/{featurettes → components}/ProductsPackage/ProductsPackage.scss +0 -0
- /package/dist/luna/{featurettes → components}/ProductsPackage/ProductsPackageMethods.js +0 -0
- /package/dist/luna/{featurettes → components}/PullQuote/PullQuote.js +0 -0
- /package/dist/luna/{featurettes → components}/PullQuote/PullQuote.scss +0 -0
- /package/dist/luna/{featurettes → components}/PullQuote/ico-quote-white.svg +0 -0
- /package/dist/luna/{featurettes → components}/PullQuote/ico-quote.svg +0 -0
- /package/dist/luna/{other-organisms → components}/SubNav/SubNav.scss +0 -0
- /package/dist/luna/{heroes → components}/SuperHero/SuperHero.js +0 -0
- /package/dist/luna/{heroes → components}/SuperHero/SuperHero.scss +0 -0
- /package/dist/luna/{heroes → components}/SuperHero/SuperHeroMethods.js +0 -0
- /package/dist/luna/{heroes → components}/SuperHero/useCompareContainerHeights.js +0 -0
- /package/dist/{application/assets → luna}/images/carat-down.svg +0 -0
- /package/dist/{application/assets → luna}/images/carat-up.svg +0 -0
- /package/dist/{application/assets → luna}/images/close-blue.svg +0 -0
- /package/dist/{application/assets → luna}/images/close.svg +0 -0
- /package/dist/{application/assets → luna}/images/ellipses.svg +0 -0
- /package/dist/{application/assets → luna}/images/facebook.svg +0 -0
- /package/dist/{application/assets → luna}/images/favicon.ico +0 -0
- /package/dist/{application/assets → luna}/images/fpoBox.png +0 -0
- /package/dist/{application/assets → luna}/images/fpoSquare.png +0 -0
- /package/dist/{application/assets → luna}/images/instagram.svg +0 -0
- /package/dist/{application/assets → luna}/images/linkedin.svg +0 -0
- /package/dist/{application/assets → luna}/images/loading-mini.gif +0 -0
- /package/dist/{application/assets → luna}/images/trimble_logo.png +0 -0
- /package/dist/{application/assets → luna}/images/twitter.svg +0 -0
- /package/dist/{application/assets → luna}/images/youtube.svg +0 -0
- /package/dist/{application → luna/utils}/hooks/useInnerPageNav.js +0 -0
@@ -1,203 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
4
|
-
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/regeneratorRuntime"));
|
5
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
6
|
-
var _reactHooks = require("@testing-library/react-hooks");
|
7
|
-
var _usePageFetch = _interopRequireDefault(require("../usePageFetch"));
|
8
|
-
var _locationRedirect = _interopRequireDefault(require("../../methods/locationRedirect"));
|
9
|
-
jest.mock("../../methods/locationRedirect");
|
10
|
-
var _url = "/mock-url";
|
11
|
-
var _setStatus = jest.fn();
|
12
|
-
var _setURL = jest.fn();
|
13
|
-
describe("usePageFetch", function () {
|
14
|
-
beforeEach(function () {
|
15
|
-
jest.clearAllMocks();
|
16
|
-
});
|
17
|
-
test("it should have initial state", function () {
|
18
|
-
var _renderHook = (0, _reactHooks.renderHook)(function () {
|
19
|
-
return (0, _usePageFetch["default"])();
|
20
|
-
}),
|
21
|
-
result = _renderHook.result;
|
22
|
-
expect(result.current.response).toEqual(null);
|
23
|
-
});
|
24
|
-
test("it should update state", function () {
|
25
|
-
var _renderHook2 = (0, _reactHooks.renderHook)(function () {
|
26
|
-
return (0, _usePageFetch["default"])();
|
27
|
-
}),
|
28
|
-
result = _renderHook2.result;
|
29
|
-
var expected = "mock response";
|
30
|
-
(0, _reactHooks.act)(function () {
|
31
|
-
return result.current.setResponse("mock response");
|
32
|
-
});
|
33
|
-
expect(result.current.response).toEqual(expected);
|
34
|
-
});
|
35
|
-
test("it should not call fetch without dependencies", function () {
|
36
|
-
var spy = jest.spyOn(global, "fetch");
|
37
|
-
(0, _reactHooks.renderHook)(function () {
|
38
|
-
return (0, _usePageFetch["default"])();
|
39
|
-
});
|
40
|
-
expect(spy).toHaveBeenCalledTimes(0);
|
41
|
-
});
|
42
|
-
test("it should call fetch", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee() {
|
43
|
-
var spy, _renderHook3, waitForNextUpdate;
|
44
|
-
return (0, _regeneratorRuntime2["default"])().wrap(function _callee$(_context) {
|
45
|
-
while (1) switch (_context.prev = _context.next) {
|
46
|
-
case 0:
|
47
|
-
spy = jest.spyOn(global, "fetch").mockReturnValue(Promise.resolve({
|
48
|
-
status: 200,
|
49
|
-
json: function json() {
|
50
|
-
return Promise.resolve({
|
51
|
-
data: "Mock fetched data"
|
52
|
-
});
|
53
|
-
}
|
54
|
-
}));
|
55
|
-
_renderHook3 = (0, _reactHooks.renderHook)(function () {
|
56
|
-
return (0, _usePageFetch["default"])(_url, _setStatus, _setURL);
|
57
|
-
}), waitForNextUpdate = _renderHook3.waitForNextUpdate;
|
58
|
-
_context.next = 4;
|
59
|
-
return waitForNextUpdate();
|
60
|
-
case 4:
|
61
|
-
expect(spy).toHaveBeenCalledTimes(1);
|
62
|
-
case 5:
|
63
|
-
case "end":
|
64
|
-
return _context.stop();
|
65
|
-
}
|
66
|
-
}, _callee);
|
67
|
-
})));
|
68
|
-
test("it should call locationRedirect", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee2() {
|
69
|
-
var _renderHook4, waitForNextUpdate;
|
70
|
-
return (0, _regeneratorRuntime2["default"])().wrap(function _callee2$(_context2) {
|
71
|
-
while (1) switch (_context2.prev = _context2.next) {
|
72
|
-
case 0:
|
73
|
-
jest.spyOn(global, "fetch").mockReturnValue(Promise.resolve({
|
74
|
-
status: 200,
|
75
|
-
json: function json() {
|
76
|
-
return Promise.resolve({
|
77
|
-
status_code: "301",
|
78
|
-
redirect_destination: ["/redirect-me-here"]
|
79
|
-
});
|
80
|
-
}
|
81
|
-
}));
|
82
|
-
_renderHook4 = (0, _reactHooks.renderHook)(function () {
|
83
|
-
return (0, _usePageFetch["default"])(_url, _setStatus, _setURL);
|
84
|
-
}), waitForNextUpdate = _renderHook4.waitForNextUpdate;
|
85
|
-
_context2.next = 4;
|
86
|
-
return waitForNextUpdate();
|
87
|
-
case 4:
|
88
|
-
expect(_locationRedirect["default"]).toHaveBeenCalled();
|
89
|
-
case 5:
|
90
|
-
case "end":
|
91
|
-
return _context2.stop();
|
92
|
-
}
|
93
|
-
}, _callee2);
|
94
|
-
})));
|
95
|
-
test('it should setStatus to "error" and call setStatus/setResponse on 301', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee3() {
|
96
|
-
var _renderHook5, waitForNextUpdate;
|
97
|
-
return (0, _regeneratorRuntime2["default"])().wrap(function _callee3$(_context3) {
|
98
|
-
while (1) switch (_context3.prev = _context3.next) {
|
99
|
-
case 0:
|
100
|
-
jest.spyOn(global, "fetch").mockReturnValue(Promise.resolve({
|
101
|
-
status: 200,
|
102
|
-
json: function json() {
|
103
|
-
return Promise.resolve({
|
104
|
-
status_code: "301"
|
105
|
-
});
|
106
|
-
}
|
107
|
-
}));
|
108
|
-
_renderHook5 = (0, _reactHooks.renderHook)(function () {
|
109
|
-
return (0, _usePageFetch["default"])(_url, _setStatus, _setURL);
|
110
|
-
}), waitForNextUpdate = _renderHook5.waitForNextUpdate;
|
111
|
-
_context3.next = 4;
|
112
|
-
return waitForNextUpdate();
|
113
|
-
case 4:
|
114
|
-
expect(_locationRedirect["default"]).toHaveBeenCalledTimes(0);
|
115
|
-
expect(_setStatus).toHaveBeenCalledWith("error");
|
116
|
-
case 6:
|
117
|
-
case "end":
|
118
|
-
return _context3.stop();
|
119
|
-
}
|
120
|
-
}, _callee3);
|
121
|
-
})));
|
122
|
-
test("it should set 404 and call setURL/setResponse", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee4() {
|
123
|
-
var _renderHook6, waitForNextUpdate;
|
124
|
-
return (0, _regeneratorRuntime2["default"])().wrap(function _callee4$(_context4) {
|
125
|
-
while (1) switch (_context4.prev = _context4.next) {
|
126
|
-
case 0:
|
127
|
-
jest.spyOn(global, "fetch").mockReturnValue(Promise.resolve({
|
128
|
-
status: 200,
|
129
|
-
json: function json() {
|
130
|
-
return Promise.resolve({
|
131
|
-
status_code: "404",
|
132
|
-
redirect_destination: []
|
133
|
-
});
|
134
|
-
}
|
135
|
-
}));
|
136
|
-
_renderHook6 = (0, _reactHooks.renderHook)(function () {
|
137
|
-
return (0, _usePageFetch["default"])(_url, _setStatus, _setURL);
|
138
|
-
}), waitForNextUpdate = _renderHook6.waitForNextUpdate;
|
139
|
-
_context4.next = 4;
|
140
|
-
return waitForNextUpdate();
|
141
|
-
case 4:
|
142
|
-
expect(_locationRedirect["default"]).toHaveBeenCalledTimes(0);
|
143
|
-
expect(_setStatus).toHaveBeenCalledWith("404");
|
144
|
-
case 6:
|
145
|
-
case "end":
|
146
|
-
return _context4.stop();
|
147
|
-
}
|
148
|
-
}, _callee4);
|
149
|
-
})));
|
150
|
-
test("it should set response data into state and call setURL", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee5() {
|
151
|
-
var _renderHook7, waitForNextUpdate, result;
|
152
|
-
return (0, _regeneratorRuntime2["default"])().wrap(function _callee5$(_context5) {
|
153
|
-
while (1) switch (_context5.prev = _context5.next) {
|
154
|
-
case 0:
|
155
|
-
jest.spyOn(global, "fetch").mockReturnValue(Promise.resolve({
|
156
|
-
status: 200,
|
157
|
-
json: function json() {
|
158
|
-
return Promise.resolve({
|
159
|
-
data: "mock data"
|
160
|
-
});
|
161
|
-
}
|
162
|
-
}));
|
163
|
-
_renderHook7 = (0, _reactHooks.renderHook)(function () {
|
164
|
-
return (0, _usePageFetch["default"])(_url, _setStatus, _setURL);
|
165
|
-
}), waitForNextUpdate = _renderHook7.waitForNextUpdate, result = _renderHook7.result;
|
166
|
-
_context5.next = 4;
|
167
|
-
return waitForNextUpdate();
|
168
|
-
case 4:
|
169
|
-
expect(_locationRedirect["default"]).toHaveBeenCalledTimes(0);
|
170
|
-
expect(_setStatus).toHaveBeenCalled();
|
171
|
-
expect(_setURL).toHaveBeenCalledWith(null);
|
172
|
-
expect(result.current.response).toStrictEqual({
|
173
|
-
data: "mock data"
|
174
|
-
});
|
175
|
-
case 8:
|
176
|
-
case "end":
|
177
|
-
return _context5.stop();
|
178
|
-
}
|
179
|
-
}, _callee5);
|
180
|
-
})));
|
181
|
-
test('it should setStatus to "error" when one is thrown', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee6() {
|
182
|
-
var _renderHook8, waitForNextUpdate, result;
|
183
|
-
return (0, _regeneratorRuntime2["default"])().wrap(function _callee6$(_context6) {
|
184
|
-
while (1) switch (_context6.prev = _context6.next) {
|
185
|
-
case 0:
|
186
|
-
jest.spyOn(global, "fetch").mockReturnValue(Promise.reject("Manual Error From Test"));
|
187
|
-
_renderHook8 = (0, _reactHooks.renderHook)(function () {
|
188
|
-
return (0, _usePageFetch["default"])(_url, _setStatus, _setURL);
|
189
|
-
}), waitForNextUpdate = _renderHook8.waitForNextUpdate, result = _renderHook8.result;
|
190
|
-
_context6.next = 4;
|
191
|
-
return waitForNextUpdate();
|
192
|
-
case 4:
|
193
|
-
expect(_locationRedirect["default"]).toHaveBeenCalledTimes(0);
|
194
|
-
expect(_setStatus).toHaveBeenCalledWith("error");
|
195
|
-
expect(_setURL).toHaveBeenCalledWith(null);
|
196
|
-
expect(result.current.response).toStrictEqual(null);
|
197
|
-
case 8:
|
198
|
-
case "end":
|
199
|
-
return _context6.stop();
|
200
|
-
}
|
201
|
-
}, _callee6);
|
202
|
-
})));
|
203
|
-
});
|
@@ -1,234 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
4
|
-
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/regeneratorRuntime"));
|
5
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
6
|
-
var _reactHooks = require("@testing-library/react-hooks");
|
7
|
-
var _useRegions = _interopRequireDefault(require("../useRegions"));
|
8
|
-
var _axios = _interopRequireDefault(require("axios"));
|
9
|
-
// MOCKS
|
10
|
-
var _regions = [{
|
11
|
-
name: "North American",
|
12
|
-
iso_code: "na",
|
13
|
-
children: [{
|
14
|
-
iso_code: "usa",
|
15
|
-
name: "United States",
|
16
|
-
rating: "rad"
|
17
|
-
}]
|
18
|
-
}];
|
19
|
-
describe("useRegions", function () {
|
20
|
-
beforeEach(function () {
|
21
|
-
jest.clearAllMocks();
|
22
|
-
});
|
23
|
-
test("should have initial state", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee() {
|
24
|
-
var _backendURL, _renderHook, result, waitForNextUpdate, _result$current, regions, region, userLocation;
|
25
|
-
return (0, _regeneratorRuntime2["default"])().wrap(function _callee$(_context) {
|
26
|
-
while (1) switch (_context.prev = _context.next) {
|
27
|
-
case 0:
|
28
|
-
_backendURL = jest.fn().mockReturnValue("www.mock.com");
|
29
|
-
jest.spyOn(_axios["default"], "get").mockImplementationOnce(function () {
|
30
|
-
return Promise.resolve(_regions);
|
31
|
-
}).mockImplementationOnce(function () {
|
32
|
-
return Promise.resolve({
|
33
|
-
data: {
|
34
|
-
data: "Fetched mock data"
|
35
|
-
}
|
36
|
-
});
|
37
|
-
});
|
38
|
-
_renderHook = (0, _reactHooks.renderHook)(function () {
|
39
|
-
return (0, _useRegions["default"])(_backendURL);
|
40
|
-
}), result = _renderHook.result, waitForNextUpdate = _renderHook.waitForNextUpdate;
|
41
|
-
_result$current = result.current, regions = _result$current.regions, region = _result$current.region, userLocation = _result$current.userLocation;
|
42
|
-
_context.next = 6;
|
43
|
-
return waitForNextUpdate();
|
44
|
-
case 6:
|
45
|
-
expect(regions).toEqual(null);
|
46
|
-
expect(region).toEqual(null);
|
47
|
-
expect(userLocation).toEqual(null);
|
48
|
-
case 9:
|
49
|
-
case "end":
|
50
|
-
return _context.stop();
|
51
|
-
}
|
52
|
-
}, _callee);
|
53
|
-
})));
|
54
|
-
test("should call axios", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee2() {
|
55
|
-
var _backendURL, spy, _renderHook2, waitForNextUpdate;
|
56
|
-
return (0, _regeneratorRuntime2["default"])().wrap(function _callee2$(_context2) {
|
57
|
-
while (1) switch (_context2.prev = _context2.next) {
|
58
|
-
case 0:
|
59
|
-
_backendURL = jest.fn().mockReturnValue("www.mock.com");
|
60
|
-
spy = jest.spyOn(_axios["default"], "get").mockImplementationOnce(function () {
|
61
|
-
return Promise.resolve({
|
62
|
-
data: _regions
|
63
|
-
});
|
64
|
-
}).mockImplementationOnce(function () {
|
65
|
-
return Promise.resolve({
|
66
|
-
data: {
|
67
|
-
data: "Fetched mock data"
|
68
|
-
}
|
69
|
-
});
|
70
|
-
});
|
71
|
-
_renderHook2 = (0, _reactHooks.renderHook)(function () {
|
72
|
-
return (0, _useRegions["default"])(_backendURL);
|
73
|
-
}), waitForNextUpdate = _renderHook2.waitForNextUpdate;
|
74
|
-
_context2.next = 5;
|
75
|
-
return waitForNextUpdate();
|
76
|
-
case 5:
|
77
|
-
expect(spy).toHaveBeenCalled();
|
78
|
-
case 6:
|
79
|
-
case "end":
|
80
|
-
return _context2.stop();
|
81
|
-
}
|
82
|
-
}, _callee2);
|
83
|
-
})));
|
84
|
-
test("should update regions", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee3() {
|
85
|
-
var _backendURL, _renderHook3, result, waitForNextUpdate, expected;
|
86
|
-
return (0, _regeneratorRuntime2["default"])().wrap(function _callee3$(_context3) {
|
87
|
-
while (1) switch (_context3.prev = _context3.next) {
|
88
|
-
case 0:
|
89
|
-
_backendURL = jest.fn().mockReturnValue("www.mock.com");
|
90
|
-
jest.spyOn(_axios["default"], "get").mockImplementationOnce(function () {
|
91
|
-
return Promise.resolve({
|
92
|
-
data: _regions
|
93
|
-
});
|
94
|
-
}).mockImplementationOnce(function () {
|
95
|
-
return Promise.resolve({
|
96
|
-
data: {
|
97
|
-
data: "Fetched mock data"
|
98
|
-
}
|
99
|
-
});
|
100
|
-
});
|
101
|
-
_renderHook3 = (0, _reactHooks.renderHook)(function () {
|
102
|
-
return (0, _useRegions["default"])(_backendURL);
|
103
|
-
}), result = _renderHook3.result, waitForNextUpdate = _renderHook3.waitForNextUpdate;
|
104
|
-
_context3.next = 5;
|
105
|
-
return waitForNextUpdate();
|
106
|
-
case 5:
|
107
|
-
expected = [{
|
108
|
-
name: "North American",
|
109
|
-
isoCode: "na",
|
110
|
-
children: [{
|
111
|
-
name: "United States",
|
112
|
-
isoCode: "usa"
|
113
|
-
}]
|
114
|
-
}];
|
115
|
-
expect(result.current.regions).toStrictEqual(expected);
|
116
|
-
case 7:
|
117
|
-
case "end":
|
118
|
-
return _context3.stop();
|
119
|
-
}
|
120
|
-
}, _callee3);
|
121
|
-
})));
|
122
|
-
test("should call fetch on userLocation", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee4() {
|
123
|
-
var _backendURL, _renderHook4, waitForNextUpdate, expected;
|
124
|
-
return (0, _regeneratorRuntime2["default"])().wrap(function _callee4$(_context4) {
|
125
|
-
while (1) switch (_context4.prev = _context4.next) {
|
126
|
-
case 0:
|
127
|
-
_backendURL = jest.fn().mockReturnValue("www.mock.com");
|
128
|
-
jest.spyOn(_axios["default"], "get").mockImplementationOnce(function () {
|
129
|
-
return Promise.resolve({
|
130
|
-
data: _regions
|
131
|
-
});
|
132
|
-
}).mockImplementationOnce(function () {
|
133
|
-
return Promise.resolve({
|
134
|
-
data: "Fetched mock data"
|
135
|
-
});
|
136
|
-
});
|
137
|
-
_renderHook4 = (0, _reactHooks.renderHook)(function () {
|
138
|
-
return (0, _useRegions["default"])(_backendURL);
|
139
|
-
}), waitForNextUpdate = _renderHook4.waitForNextUpdate;
|
140
|
-
_context4.next = 5;
|
141
|
-
return waitForNextUpdate();
|
142
|
-
case 5:
|
143
|
-
expected = "https://pro.ip-api.com/json/?key=5FeeMMNq0pC4YNt&fields=status,countryCode,query&lang=";
|
144
|
-
expect(_axios["default"].get).toHaveBeenCalledTimes(2);
|
145
|
-
expect(_axios["default"].get).toHaveBeenLastCalledWith(expected);
|
146
|
-
case 8:
|
147
|
-
case "end":
|
148
|
-
return _context4.stop();
|
149
|
-
}
|
150
|
-
}, _callee4);
|
151
|
-
})));
|
152
|
-
test("should update userLocation", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee5() {
|
153
|
-
var _backendURL, _renderHook5, waitForNextUpdate, result;
|
154
|
-
return (0, _regeneratorRuntime2["default"])().wrap(function _callee5$(_context5) {
|
155
|
-
while (1) switch (_context5.prev = _context5.next) {
|
156
|
-
case 0:
|
157
|
-
_backendURL = jest.fn().mockReturnValue("www.mock.com");
|
158
|
-
jest.spyOn(_axios["default"], "get").mockImplementationOnce(function () {
|
159
|
-
return Promise.resolve({
|
160
|
-
data: _regions
|
161
|
-
});
|
162
|
-
}).mockImplementationOnce(function () {
|
163
|
-
return Promise.resolve({
|
164
|
-
countryCode: "us"
|
165
|
-
});
|
166
|
-
});
|
167
|
-
_renderHook5 = (0, _reactHooks.renderHook)(function () {
|
168
|
-
return (0, _useRegions["default"])(_backendURL);
|
169
|
-
}), waitForNextUpdate = _renderHook5.waitForNextUpdate, result = _renderHook5.result;
|
170
|
-
_context5.next = 5;
|
171
|
-
return waitForNextUpdate();
|
172
|
-
case 5:
|
173
|
-
expect(result.current.userLocation).toStrictEqual("us");
|
174
|
-
case 6:
|
175
|
-
case "end":
|
176
|
-
return _context5.stop();
|
177
|
-
}
|
178
|
-
}, _callee5);
|
179
|
-
})));
|
180
|
-
test("should not update userLocation", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee6() {
|
181
|
-
var _backendURL, _renderHook6, waitForNextUpdate, result;
|
182
|
-
return (0, _regeneratorRuntime2["default"])().wrap(function _callee6$(_context6) {
|
183
|
-
while (1) switch (_context6.prev = _context6.next) {
|
184
|
-
case 0:
|
185
|
-
_backendURL = jest.fn().mockReturnValue("www.mock.com");
|
186
|
-
jest.spyOn(_axios["default"], "get").mockImplementationOnce(function () {
|
187
|
-
return Promise.resolve({
|
188
|
-
data: _regions
|
189
|
-
});
|
190
|
-
}).mockImplementationOnce(function () {
|
191
|
-
return Promise.resolve({});
|
192
|
-
});
|
193
|
-
_renderHook6 = (0, _reactHooks.renderHook)(function () {
|
194
|
-
return (0, _useRegions["default"])(_backendURL);
|
195
|
-
}), waitForNextUpdate = _renderHook6.waitForNextUpdate, result = _renderHook6.result;
|
196
|
-
_context6.next = 5;
|
197
|
-
return waitForNextUpdate();
|
198
|
-
case 5:
|
199
|
-
expect(result.current.userLocation).toStrictEqual(null);
|
200
|
-
case 6:
|
201
|
-
case "end":
|
202
|
-
return _context6.stop();
|
203
|
-
}
|
204
|
-
}, _callee6);
|
205
|
-
})));
|
206
|
-
test("should setRegion", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee7() {
|
207
|
-
var _backendURL, _renderHook7, waitForNextUpdate, result;
|
208
|
-
return (0, _regeneratorRuntime2["default"])().wrap(function _callee7$(_context7) {
|
209
|
-
while (1) switch (_context7.prev = _context7.next) {
|
210
|
-
case 0:
|
211
|
-
_backendURL = jest.fn().mockReturnValue("www.mock.com");
|
212
|
-
jest.spyOn(_axios["default"], "get").mockImplementationOnce(function () {
|
213
|
-
return Promise.resolve({
|
214
|
-
data: _regions
|
215
|
-
});
|
216
|
-
}).mockImplementationOnce(function () {
|
217
|
-
return Promise.resolve({
|
218
|
-
countryCode: "usa"
|
219
|
-
});
|
220
|
-
});
|
221
|
-
_renderHook7 = (0, _reactHooks.renderHook)(function () {
|
222
|
-
return (0, _useRegions["default"])(_backendURL);
|
223
|
-
}), waitForNextUpdate = _renderHook7.waitForNextUpdate, result = _renderHook7.result;
|
224
|
-
_context7.next = 5;
|
225
|
-
return waitForNextUpdate();
|
226
|
-
case 5:
|
227
|
-
expect(result.current.region).toStrictEqual("na");
|
228
|
-
case 6:
|
229
|
-
case "end":
|
230
|
-
return _context7.stop();
|
231
|
-
}
|
232
|
-
}, _callee7);
|
233
|
-
})));
|
234
|
-
});
|
@@ -1,116 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
4
|
-
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/regeneratorRuntime"));
|
5
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
6
|
-
var _reactHooks = require("@testing-library/react-hooks");
|
7
|
-
var _useRoutes = _interopRequireDefault(require("../useRoutes"));
|
8
|
-
var _axios = _interopRequireDefault(require("axios"));
|
9
|
-
var _fetch = jest.fn().mockImplementationOnce(function () {
|
10
|
-
return Promise.resolve({
|
11
|
-
json: function json() {
|
12
|
-
return Promise.resolve({
|
13
|
-
data: {
|
14
|
-
data: "mock routes data"
|
15
|
-
}
|
16
|
-
});
|
17
|
-
}
|
18
|
-
});
|
19
|
-
}).mockImplementationOnce(function () {
|
20
|
-
return Promise.resolve({
|
21
|
-
json: function json() {
|
22
|
-
return Promise.resolve({
|
23
|
-
data: {
|
24
|
-
data: "mock routes data"
|
25
|
-
}
|
26
|
-
});
|
27
|
-
}
|
28
|
-
});
|
29
|
-
}).mockImplementationOnce(function () {
|
30
|
-
return Promise.resolve({
|
31
|
-
json: function json() {
|
32
|
-
return Promise.resolve({
|
33
|
-
data: {
|
34
|
-
data: "mock routes data"
|
35
|
-
}
|
36
|
-
});
|
37
|
-
}
|
38
|
-
});
|
39
|
-
}).mockImplementationOnce(function () {
|
40
|
-
return Promise.reject("error");
|
41
|
-
});
|
42
|
-
var backendURL = "www.mock.com";
|
43
|
-
describe("useRoutes", function () {
|
44
|
-
beforeEach(function () {
|
45
|
-
jest.clearAllMocks();
|
46
|
-
});
|
47
|
-
test("it should call axios", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee() {
|
48
|
-
var _renderHook, waitForNextUpdate;
|
49
|
-
return (0, _regeneratorRuntime2["default"])().wrap(function _callee$(_context) {
|
50
|
-
while (1) switch (_context.prev = _context.next) {
|
51
|
-
case 0:
|
52
|
-
jest.spyOn(_axios["default"], "get").mockReturnValue(Promise.resolve({
|
53
|
-
data: {
|
54
|
-
data: "mock routes data"
|
55
|
-
}
|
56
|
-
}));
|
57
|
-
_renderHook = (0, _reactHooks.renderHook)(function () {
|
58
|
-
return (0, _useRoutes["default"])(backendURL);
|
59
|
-
}), waitForNextUpdate = _renderHook.waitForNextUpdate;
|
60
|
-
_context.next = 4;
|
61
|
-
return waitForNextUpdate();
|
62
|
-
case 4:
|
63
|
-
expect(_axios["default"].get).toHaveBeenCalledTimes(1);
|
64
|
-
case 5:
|
65
|
-
case "end":
|
66
|
-
return _context.stop();
|
67
|
-
}
|
68
|
-
}, _callee);
|
69
|
-
})));
|
70
|
-
test("it should update state", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee2() {
|
71
|
-
var _renderHook2, waitForNextUpdate, result, expected;
|
72
|
-
return (0, _regeneratorRuntime2["default"])().wrap(function _callee2$(_context2) {
|
73
|
-
while (1) switch (_context2.prev = _context2.next) {
|
74
|
-
case 0:
|
75
|
-
jest.spyOn(_axios["default"], "get").mockReturnValue(Promise.resolve({
|
76
|
-
data: {
|
77
|
-
data: "mock routes data"
|
78
|
-
}
|
79
|
-
}));
|
80
|
-
_renderHook2 = (0, _reactHooks.renderHook)(function () {
|
81
|
-
return (0, _useRoutes["default"])(backendURL);
|
82
|
-
}), waitForNextUpdate = _renderHook2.waitForNextUpdate, result = _renderHook2.result;
|
83
|
-
_context2.next = 4;
|
84
|
-
return waitForNextUpdate();
|
85
|
-
case 4:
|
86
|
-
expected = {
|
87
|
-
data: "mock routes data"
|
88
|
-
};
|
89
|
-
expect(result.current).toStrictEqual(expected);
|
90
|
-
case 6:
|
91
|
-
case "end":
|
92
|
-
return _context2.stop();
|
93
|
-
}
|
94
|
-
}, _callee2);
|
95
|
-
})));
|
96
|
-
test("it should set an error", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee3() {
|
97
|
-
var _renderHook3, waitForNextUpdate, result, expected;
|
98
|
-
return (0, _regeneratorRuntime2["default"])().wrap(function _callee3$(_context3) {
|
99
|
-
while (1) switch (_context3.prev = _context3.next) {
|
100
|
-
case 0:
|
101
|
-
jest.spyOn(_axios["default"], "get").mockReturnValue(Promise.reject("error"));
|
102
|
-
_renderHook3 = (0, _reactHooks.renderHook)(function () {
|
103
|
-
return (0, _useRoutes["default"])(backendURL);
|
104
|
-
}), waitForNextUpdate = _renderHook3.waitForNextUpdate, result = _renderHook3.result;
|
105
|
-
_context3.next = 4;
|
106
|
-
return waitForNextUpdate();
|
107
|
-
case 4:
|
108
|
-
expected = "error";
|
109
|
-
expect(result.current).toStrictEqual(expected);
|
110
|
-
case 6:
|
111
|
-
case "end":
|
112
|
-
return _context3.stop();
|
113
|
-
}
|
114
|
-
}, _callee3);
|
115
|
-
})));
|
116
|
-
});
|
@@ -1,86 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
4
|
-
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/regeneratorRuntime"));
|
5
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
6
|
-
var _reactHooks = require("@testing-library/react-hooks");
|
7
|
-
var _useSiteData = _interopRequireDefault(require("../useSiteData"));
|
8
|
-
var _axios = _interopRequireDefault(require("axios"));
|
9
|
-
// MOCKS //
|
10
|
-
var _language = "en";
|
11
|
-
describe("useSiteData", function () {
|
12
|
-
beforeEach(function () {
|
13
|
-
jest.clearAllMocks();
|
14
|
-
});
|
15
|
-
test("it should have initial state", function () {
|
16
|
-
var _renderHook = (0, _reactHooks.renderHook)(function () {
|
17
|
-
return (0, _useSiteData["default"])();
|
18
|
-
}),
|
19
|
-
result = _renderHook.result;
|
20
|
-
expect(result.current).toEqual(null);
|
21
|
-
});
|
22
|
-
test("it should call axios", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee() {
|
23
|
-
var _backendURL, spy, _renderHook2, waitForNextUpdate, expected;
|
24
|
-
return (0, _regeneratorRuntime2["default"])().wrap(function _callee$(_context) {
|
25
|
-
while (1) switch (_context.prev = _context.next) {
|
26
|
-
case 0:
|
27
|
-
_backendURL = "www.mock-url.com";
|
28
|
-
spy = jest.spyOn(_axios["default"], "get").mockReturnValue(Promise.resolve({
|
29
|
-
data: {
|
30
|
-
data: "Fetched mock data"
|
31
|
-
}
|
32
|
-
}));
|
33
|
-
_renderHook2 = (0, _reactHooks.renderHook)(function () {
|
34
|
-
return (0, _useSiteData["default"])(_language, _backendURL);
|
35
|
-
}), waitForNextUpdate = _renderHook2.waitForNextUpdate;
|
36
|
-
expected = "www.mock-url.com/api-v1/FetchAppData";
|
37
|
-
_context.next = 6;
|
38
|
-
return waitForNextUpdate();
|
39
|
-
case 6:
|
40
|
-
expect(spy).toHaveBeenCalledWith(expected);
|
41
|
-
expect(spy).toHaveBeenCalledTimes(1);
|
42
|
-
case 8:
|
43
|
-
case "end":
|
44
|
-
return _context.stop();
|
45
|
-
}
|
46
|
-
}, _callee);
|
47
|
-
})));
|
48
|
-
test("it should not call fetch without params", function () {
|
49
|
-
var spy = jest.spyOn(_axios["default"], "get").mockReturnValue(Promise.resolve({
|
50
|
-
data: {
|
51
|
-
data: "Fetched mock data"
|
52
|
-
}
|
53
|
-
}));
|
54
|
-
(0, _reactHooks.renderHook)(function () {
|
55
|
-
return (0, _useSiteData["default"])();
|
56
|
-
});
|
57
|
-
expect(spy).toHaveBeenCalledTimes(0);
|
58
|
-
});
|
59
|
-
test("it should set data", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee2() {
|
60
|
-
var _backendURL, _renderHook3, result, waitForNextUpdate, expected;
|
61
|
-
return (0, _regeneratorRuntime2["default"])().wrap(function _callee2$(_context2) {
|
62
|
-
while (1) switch (_context2.prev = _context2.next) {
|
63
|
-
case 0:
|
64
|
-
_backendURL = "www.mock-url.com";
|
65
|
-
jest.spyOn(_axios["default"], "get").mockReturnValue(Promise.resolve({
|
66
|
-
data: {
|
67
|
-
data: "Fetched mock data"
|
68
|
-
}
|
69
|
-
}));
|
70
|
-
_renderHook3 = (0, _reactHooks.renderHook)(function () {
|
71
|
-
return (0, _useSiteData["default"])(_language, _backendURL);
|
72
|
-
}), result = _renderHook3.result, waitForNextUpdate = _renderHook3.waitForNextUpdate;
|
73
|
-
expected = {
|
74
|
-
data: "Fetched mock data"
|
75
|
-
};
|
76
|
-
_context2.next = 6;
|
77
|
-
return waitForNextUpdate();
|
78
|
-
case 6:
|
79
|
-
expect(result.current).toStrictEqual(expected);
|
80
|
-
case 7:
|
81
|
-
case "end":
|
82
|
-
return _context2.stop();
|
83
|
-
}
|
84
|
-
}, _callee2);
|
85
|
-
})));
|
86
|
-
});
|