-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into wip-react-redux
- Loading branch information
Showing
86 changed files
with
18,208 additions
and
2,248 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
ts/components/screens/__tests__/LoadingScreenContent.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React from "react"; | ||
import { Text } from "react-native"; | ||
import { createStore } from "redux"; | ||
import LoadingScreenContent from "../LoadingScreenContent"; | ||
import { appReducer } from "../../../store/reducers"; | ||
import { applicationChangeState } from "../../../store/actions/application"; | ||
import { renderScreenWithNavigationStoreContext } from "../../../utils/testWrapper"; | ||
import { GlobalState } from "../../../store/reducers/types"; | ||
import { preferencesDesignSystemSetEnabled } from "../../../store/actions/persistedPreferences"; | ||
|
||
describe("LoadingScreenContent", () => { | ||
it("should match the snapshot with title, no children, header hidden", () => { | ||
const defaultProps = { | ||
contentTitle: "Test Content Title" | ||
} as React.ComponentProps<typeof LoadingScreenContent>; | ||
expect(renderComponent(defaultProps)).toMatchSnapshot(); | ||
}); | ||
it("should match the snapshot with title, no children, header shown", () => { | ||
const defaultProps = { | ||
contentTitle: "Test Content Title", | ||
headerVisible: true | ||
} as React.ComponentProps<typeof LoadingScreenContent>; | ||
expect(renderComponent(defaultProps)).toMatchSnapshot(); | ||
}); | ||
it("should match the snapshot with title, a child, header hidden", () => { | ||
const defaultProps = { | ||
contentTitle: "Test Content Title", | ||
children: <Text>{"My test child"}</Text> | ||
} as React.ComponentProps<typeof LoadingScreenContent>; | ||
expect(renderComponent(defaultProps)).toMatchSnapshot(); | ||
}); | ||
it("should match the snapshot with title, a child, header shown", () => { | ||
const defaultProps = { | ||
contentTitle: "Test Content Title", | ||
children: <Text>{"My test child"}</Text>, | ||
headerVisible: true | ||
} as React.ComponentProps<typeof LoadingScreenContent>; | ||
expect(renderComponent(defaultProps)).toMatchSnapshot(); | ||
}); | ||
}); | ||
|
||
function renderComponent( | ||
props: React.ComponentProps<typeof LoadingScreenContent> | ||
) { | ||
const globalState = appReducer(undefined, applicationChangeState("active")); | ||
const designSystemEnabledState = appReducer( | ||
globalState, | ||
preferencesDesignSystemSetEnabled({ isDesignSystemEnabled: true }) | ||
); | ||
return renderScreenWithNavigationStoreContext<GlobalState>( | ||
() => <LoadingScreenContent {...props} />, | ||
"DUMMY ROUTE", | ||
{}, | ||
createStore(appReducer, designSystemEnabledState as any) | ||
); | ||
} |
Oops, something went wrong.