diff --git a/.storybook/test-runner.ts b/.storybook/test-runner.ts index afcc2e0a5..ba0eb486c 100644 --- a/.storybook/test-runner.ts +++ b/.storybook/test-runner.ts @@ -25,7 +25,6 @@ const config: TestRunnerConfig = { }, async postVisit(page, context) { // the #storybook-root element wraps the story. In Storybook 6.x, the selector is #root - await new Promise((resolve) => setTimeout(resolve, 3000)); if (!ONLY_RUN || ONLY_RUN === "SNAPSHOTS") { await runSnapshots(page); } diff --git a/packages/base-map/src/__snapshots__/index.story.tsx.snap b/packages/base-map/src/__snapshots__/index.story.tsx.snap index 8d41eedaf..517280a7d 100644 --- a/packages/base-map/src/__snapshots__/index.story.tsx.snap +++ b/packages/base-map/src/__snapshots__/index.story.tsx.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`BaseMap clickAndViewportchangedEvents smoke-test 1`] = ` -
-
+
-
- +
-
-
+
+
-
+
-
+
-
-
+
- -
+
©
-
-
- +
-
-
+
+
-
+
-
+
-
-
+
- -
+
© +
-
- +
-
-
+
+
-
+
-
+
-
-
+
- -
+
© -
+
-
- +
-
-
+
+
-
+
-
+
-
-
+
- -
+
©
-
-
+
-
+ -
- -
+
This adds to the attribution information supplied by the map style json | © -
+
-
- + -
-
+
-
-
+
+
-
+
-
+
-
-
+
- -
+
© -
+
-
- +
-
-
+
+
-
+
-
+
-
-
+
- -
+
©
-
-
- +
-
-
+
+
-
+
-
+
-
-
+
- -
+
© +

50

@@ -9,7 +9,7 @@ exports[`Building-Blocks/Colors Blue smoke-test 1`] = ` #E5ECF3

-
+

100

@@ -17,7 +17,7 @@ exports[`Building-Blocks/Colors Blue smoke-test 1`] = ` #CCDAE7

-
+

200

@@ -25,7 +25,7 @@ exports[`Building-Blocks/Colors Blue smoke-test 1`] = ` #B2C7DB

-
+

300

@@ -33,7 +33,7 @@ exports[`Building-Blocks/Colors Blue smoke-test 1`] = ` #99B5CF

-
+

400

@@ -41,7 +41,7 @@ exports[`Building-Blocks/Colors Blue smoke-test 1`] = ` #7FA2C2

-
+

500

@@ -49,7 +49,7 @@ exports[`Building-Blocks/Colors Blue smoke-test 1`] = ` #6690B7

-
+

600

@@ -57,7 +57,7 @@ exports[`Building-Blocks/Colors Blue smoke-test 1`] = ` #4D7EAB

-
+

700

@@ -65,7 +65,7 @@ exports[`Building-Blocks/Colors Blue smoke-test 1`] = ` #336B9E

-
+

800

@@ -73,7 +73,7 @@ exports[`Building-Blocks/Colors Blue smoke-test 1`] = ` #1A5992

-
+

900

@@ -84,7 +84,7 @@ exports[`Building-Blocks/Colors Blue smoke-test 1`] = ` `; exports[`Building-Blocks/Colors Grey smoke-test 1`] = ` -
+

50

@@ -92,7 +92,7 @@ exports[`Building-Blocks/Colors Grey smoke-test 1`] = ` #ECECEC

-
+

100

@@ -100,7 +100,7 @@ exports[`Building-Blocks/Colors Grey smoke-test 1`] = ` #D9D9D9

-
+

200

@@ -108,7 +108,7 @@ exports[`Building-Blocks/Colors Grey smoke-test 1`] = ` #C5C5C5

-
+

300

@@ -116,7 +116,7 @@ exports[`Building-Blocks/Colors Grey smoke-test 1`] = ` #B3B3B3

-
+

400

@@ -124,7 +124,7 @@ exports[`Building-Blocks/Colors Grey smoke-test 1`] = ` #9F9F9F

-
+

500

@@ -132,7 +132,7 @@ exports[`Building-Blocks/Colors Grey smoke-test 1`] = ` #8C8C8C

-
+

600

@@ -140,7 +140,7 @@ exports[`Building-Blocks/Colors Grey smoke-test 1`] = ` #797979

-
+

700

@@ -148,7 +148,7 @@ exports[`Building-Blocks/Colors Grey smoke-test 1`] = ` #666666

-
+

800

@@ -156,7 +156,7 @@ exports[`Building-Blocks/Colors Grey smoke-test 1`] = ` #535353

-
+

900

@@ -167,7 +167,7 @@ exports[`Building-Blocks/Colors Grey smoke-test 1`] = ` `; exports[`Building-Blocks/Colors Red smoke-test 1`] = ` -
+

50

@@ -175,7 +175,7 @@ exports[`Building-Blocks/Colors Red smoke-test 1`] = ` #F7E7E6

-
+

100

@@ -183,7 +183,7 @@ exports[`Building-Blocks/Colors Red smoke-test 1`] = ` #EFCFCE

-
+

200

@@ -191,7 +191,7 @@ exports[`Building-Blocks/Colors Red smoke-test 1`] = ` #E7B6B4

-
+

300

@@ -199,7 +199,7 @@ exports[`Building-Blocks/Colors Red smoke-test 1`] = ` #DF9E9C

-
+

400

@@ -207,7 +207,7 @@ exports[`Building-Blocks/Colors Red smoke-test 1`] = ` #D78683

-
+

500

@@ -215,7 +215,7 @@ exports[`Building-Blocks/Colors Red smoke-test 1`] = ` #CF6E6B

-
+

600

@@ -223,7 +223,7 @@ exports[`Building-Blocks/Colors Red smoke-test 1`] = ` #C75652

-
+

700

@@ -231,7 +231,7 @@ exports[`Building-Blocks/Colors Red smoke-test 1`] = ` #BF3E3A

-
+

800

@@ -239,7 +239,7 @@ exports[`Building-Blocks/Colors Red smoke-test 1`] = ` #B72620

-
+

900

diff --git a/packages/core-utils/src/__snapshots__/core-utils.story.tsx.snap b/packages/core-utils/src/__snapshots__/core-utils.story.tsx.snap index 398405147..7a93ed3de 100644 --- a/packages/core-utils/src/__snapshots__/core-utils.story.tsx.snap +++ b/packages/core-utils/src/__snapshots__/core-utils.story.tsx.snap @@ -1,11 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`core-utils RouteColorTester smoke-test 1`] = ` -
-
+
+
Provided color pair
-
+
Corrected color pair
diff --git a/packages/core-utils/src/index.ts b/packages/core-utils/src/index.ts index 5ce856f76..7748bb769 100644 --- a/packages/core-utils/src/index.ts +++ b/packages/core-utils/src/index.ts @@ -8,6 +8,7 @@ import * as storage from "./storage"; import * as time from "./time"; import * as ui from "./ui"; import * as queryGen from "./query-gen"; +import SafeSuspense from "./suspense"; const core = { itinerary, @@ -22,4 +23,5 @@ const core = { ui }; +export { SafeSuspense }; export default core; diff --git a/packages/core-utils/src/suspense.tsx b/packages/core-utils/src/suspense.tsx new file mode 100644 index 000000000..9ca3f9486 --- /dev/null +++ b/packages/core-utils/src/suspense.tsx @@ -0,0 +1,19 @@ +import React, { ReactElement, ReactNode, Suspense } from "react"; + +type Props = { + children: ReactNode; + fallback: ReactNode; +}; + +const SafeSuspense = ({ children, fallback }: Props): ReactElement => { + const IS_TEST_RUNNER = window.navigator.userAgent.match( + /StorybookTestRunner/ + ); + return IS_TEST_RUNNER ? ( + <>{fallback} + ) : ( + {children} + ); +}; + +export default SafeSuspense; diff --git a/packages/endpoints-overlay/src/__snapshots__/EndpointsOverlay.story.tsx.snap b/packages/endpoints-overlay/src/__snapshots__/EndpointsOverlay.story.tsx.snap index 84dc7e98a..e1db89049 100644 --- a/packages/endpoints-overlay/src/__snapshots__/EndpointsOverlay.story.tsx.snap +++ b/packages/endpoints-overlay/src/__snapshots__/EndpointsOverlay.story.tsx.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`EndpointsOverlay EndpointsOverlayWithCustomMapMarkers smoke-test 1`] = ` -
-
+
-
- + -
-
-
-
+
+
-
+
-
+
-
-
+
- -
+
© -
+
-
- + -
-
-
-
-
+
+
-
+
-
+
-
-
+
- -
+
© -
+
-
- + -
- +
-
- +
-
-
+
+
-
+
-
+
-
-
+
- -
+
© -
+
-
- + -
-
-
-
+
+
-
+
-
+
-
-
+
- -
+
© -
+
-
- + -
-
-
-
+
+
-
+
-
+
-
-
+
- -
+
© +
Your trip: - - - - - @@ -21,8 +21,8 @@ exports[`From-To-Picker customStyleAndText smoke-test 1`] = ` `; exports[`From-To-Picker fromTo smoke-test 1`] = ` - - + + - - + - @@ -68,8 +68,8 @@ exports[`From-To-Picker smallTextSansSerif smoke-test 1`] = ` Plan a trip: - - + + - - + - diff --git a/packages/icons/src/leg-icon.js b/packages/icons/src/leg-icon.js index 1c661b935..05cd5c0da 100644 --- a/packages/icons/src/leg-icon.js +++ b/packages/icons/src/leg-icon.js @@ -1,6 +1,6 @@ -import coreUtils from "@opentripplanner/core-utils"; +import coreUtils, { SafeSuspense } from "@opentripplanner/core-utils"; import PropTypes from "prop-types"; -import React, { Suspense } from "react"; +import React from "react"; import { getCompanyIcon as defaultGetCompanyIcon } from "./companies"; @@ -10,11 +10,9 @@ const LegIcon = ({ getCompanyIcon, leg, ModeIcon, ...props }) => { if (company && typeof getCompanyIcon === "function") { const CompanyIcon = getCompanyIcon(company); if (CompanyIcon) - return ( - {company}}> - - - ); + {company}}> + + ; } let iconStr = leg.mode; // Do this for P&R, K&R and TNC trips without company icon diff --git a/packages/icons/src/stories/__snapshots__/classic-leg-icon.story.js.snap b/packages/icons/src/stories/__snapshots__/classic-leg-icon.story.js.snap index 17645fe78..59f8402d4 100644 --- a/packages/icons/src/stories/__snapshots__/classic-leg-icon.story.js.snap +++ b/packages/icons/src/stories/__snapshots__/classic-leg-icon.story.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Icons/ClassicLegIcon ClassicLegIconExamples smoke-test 1`] = ` - +
@@ -128,17 +121,12 @@ exports[`Icons/ClassicLegIcon ClassicLegIconExamples smoke-test 1`] = `
@@ -84,21 +84,14 @@ exports[`Icons/ClassicLegIcon ClassicLegIconExamples smoke-test 1`] = `
- - - - - - - - - - - - - + +
- - - - - - - +
diff --git a/packages/icons/src/stories/__snapshots__/classic-mode-icon.story.js.snap b/packages/icons/src/stories/__snapshots__/classic-mode-icon.story.js.snap index d7e6a14cc..b0f9f27a8 100644 --- a/packages/icons/src/stories/__snapshots__/classic-mode-icon.story.js.snap +++ b/packages/icons/src/stories/__snapshots__/classic-mode-icon.story.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Icons/ClassicModeIcon ClassicModeIconExamples smoke-test 1`] = ` - +
@@ -343,7 +343,7 @@ exports[`Icons/ClassicModeIcon ClassicModeIconExamples smoke-test 1`] = ` `; exports[`Icons/ClassicModeIcon ModeIconOverrideByRouteId smoke-test 1`] = ` - +
diff --git a/packages/icons/src/stories/__snapshots__/standard-leg-icon.story.js.snap b/packages/icons/src/stories/__snapshots__/standard-leg-icon.story.js.snap index b01da2b0c..fc3819a43 100644 --- a/packages/icons/src/stories/__snapshots__/standard-leg-icon.story.js.snap +++ b/packages/icons/src/stories/__snapshots__/standard-leg-icon.story.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Icons/StandardLegIcon StandardLegIconExamples smoke-test 1`] = ` - +
@@ -151,17 +144,12 @@ exports[`Icons/StandardLegIcon StandardLegIconExamples smoke-test 1`] = `
@@ -107,21 +107,14 @@ exports[`Icons/StandardLegIcon StandardLegIconExamples smoke-test 1`] = `
- - - - - - - - - - - - - + +
- - - - - - - +
diff --git a/packages/icons/src/stories/__snapshots__/standard-mode-icon.story.js.snap b/packages/icons/src/stories/__snapshots__/standard-mode-icon.story.js.snap index e08509e18..9d9ad1944 100644 --- a/packages/icons/src/stories/__snapshots__/standard-mode-icon.story.js.snap +++ b/packages/icons/src/stories/__snapshots__/standard-mode-icon.story.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Icons/StandardModeIcon StandardModeIconExamples smoke-test 1`] = ` - +
diff --git a/packages/icons/src/stories/__snapshots__/trimet-leg-icon.story.js.snap b/packages/icons/src/stories/__snapshots__/trimet-leg-icon.story.js.snap index 2c577e73f..73b486dcd 100644 --- a/packages/icons/src/stories/__snapshots__/trimet-leg-icon.story.js.snap +++ b/packages/icons/src/stories/__snapshots__/trimet-leg-icon.story.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Icons/TrimetLegIcon Trimetxamples smoke-test 1`] = ` - +
@@ -140,19 +130,16 @@ exports[`Icons/TrimetLegIcon Trimetxamples smoke-test 1`] = ` diff --git a/packages/icons/src/stories/__snapshots__/trimet-mode-icon-2021.story.js.snap b/packages/icons/src/stories/__snapshots__/trimet-mode-icon-2021.story.js.snap index b9009196b..14a2446e2 100644 --- a/packages/icons/src/stories/__snapshots__/trimet-mode-icon-2021.story.js.snap +++ b/packages/icons/src/stories/__snapshots__/trimet-mode-icon-2021.story.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Icons/TrimetModeIcon2021 TrimetModeIcon2021Examples smoke-test 1`] = ` -
@@ -95,21 +95,11 @@ exports[`Icons/TrimetLegIcon Trimetxamples smoke-test 1`] = `
- - - - - - - - - - - - - + +
- - - - - - - - + + +
+
@@ -164,11 +164,11 @@ exports[`Icons/TrimetModeIcon2021 TrimetModeIcon2021Examples smoke-test 1`] = ` xml:space="preserve" > - - @@ -191,11 +191,11 @@ exports[`Icons/TrimetModeIcon2021 TrimetModeIcon2021Examples smoke-test 1`] = ` xml:space="preserve" > - - @@ -218,11 +218,11 @@ exports[`Icons/TrimetModeIcon2021 TrimetModeIcon2021Examples smoke-test 1`] = ` xml:space="preserve" > - - diff --git a/packages/icons/src/stories/__snapshots__/trimet-mode-icon.story.js.snap b/packages/icons/src/stories/__snapshots__/trimet-mode-icon.story.js.snap index 802cd09a3..b3a4e5fd0 100644 --- a/packages/icons/src/stories/__snapshots__/trimet-mode-icon.story.js.snap +++ b/packages/icons/src/stories/__snapshots__/trimet-mode-icon.story.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Icons/TrimetModeIcon TrimetModeIconExamples smoke-test 1`] = ` - +
diff --git a/packages/itinerary-body/src/stories/__snapshots__/OtpRrItineraryBody.story.tsx.snap b/packages/itinerary-body/src/stories/__snapshots__/OtpRrItineraryBody.story.tsx.snap index 5afe4fcf3..f3fe47f90 100644 --- a/packages/itinerary-body/src/stories/__snapshots__/OtpRrItineraryBody.story.tsx.snap +++ b/packages/itinerary-body/src/stories/__snapshots__/OtpRrItineraryBody.story.tsx.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`ItineraryBody/otp-react-redux BikeOnlyItinerary smoke-test 1`] = ` -
    -
  1. -
    -
    +
      +
    1. +
      +
      - +
      -
      +
      -
      +
      3:42 PM
      - + from 503 SW Alder St, Portland, OR, USA 97204 -
      -
      -
      - - - +
      +
      +
      + + + - + - Bicycle 0.7 miles to - + 1737 SW Morrison St, Portland, OR, USA 97205 -
      - - + +
    2. -
    3. -
      - +
    4. +
      +
      -
      +
      -
      +
      3:49 PM
      - + Arrive at 1737 SW Morrison St, Portland, OR, USA 97205 -
      +
    `; exports[`ItineraryBody/otp-react-redux BikeRentalItinerary smoke-test 1`] = ` -
      -
    1. -
      -
      +
        +
      1. +
        +
        - +
        -
        +
        -
        +
        3:45 PM
        - + from 2624 SE 30th Ave, Portland, OR, USA 97202 -
        -
        -
        - - - +
        +
        +
        + + + - + - Walk 498 feet to - + SE 30th at Division -
        - - + +