-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [IOCOM-864,IOCOM-865] Update message attachment's preview with …
…the new DS (#5428) ## Short description This PR updates the message attachment's preview screen to the new DS system. | Preview | Data Error | Preview Error | | ------------- | ------------- | ------------- | |  |  |  | ## List of changes proposed in this pull request - New screen and components, referencing the new design system's components only - Removed in-preview attachment download ## How to test Using the io-dev-api-server, download some attachment. After that, enable the new DS and navigate to previously downloaded attachments to see the new DS. Check both Android and iOS. Check both success and failure cases. --------- Co-authored-by: Alessandro Dell'Oste <[email protected]>
- Loading branch information
Showing
30 changed files
with
3,964 additions
and
193 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import * as React from "react"; | ||
import { Text } from "react-native"; | ||
import { render } from "@testing-library/react-native"; | ||
import configureMockStore from "redux-mock-store"; | ||
import { Provider } from "react-redux"; | ||
import { appReducer } from "../../store/reducers"; | ||
import { applicationChangeState } from "../../store/actions/application"; | ||
import { preferencesDesignSystemSetEnabled } from "../../store/actions/persistedPreferences"; | ||
import { GlobalState } from "../../store/reducers/types"; | ||
import LoadingSpinnerOverlay from "../LoadingSpinnerOverlay"; | ||
|
||
describe("LoadingSpinnerOverlay", () => { | ||
it("Should match base no-loading snapshot", () => { | ||
const component = renderComponent(false); | ||
expect(component.toJSON()).toMatchSnapshot(); | ||
}); | ||
it("Should match base loading snapshot", () => { | ||
const component = renderComponent(true); | ||
expect(component.toJSON()).toMatchSnapshot(); | ||
}); | ||
it("Should match all-properties and not-loading snapshot", () => { | ||
const child = <Text>This is a child</Text>; | ||
const loadingCaption = "This is the loading caption"; | ||
const loadingOpacity = 0.65; | ||
const onCancelCallback = () => undefined; | ||
const component = renderComponent( | ||
false, | ||
child, | ||
loadingCaption, | ||
loadingOpacity, | ||
onCancelCallback | ||
); | ||
expect(component.toJSON()).toMatchSnapshot(); | ||
}); | ||
it("Should match all-properties and loading snapshot", () => { | ||
const child = <Text>This is a child</Text>; | ||
const loadingCaption = "This is the loading caption"; | ||
const loadingOpacity = 0.65; | ||
const onCancelCallback = () => undefined; | ||
const component = renderComponent( | ||
true, | ||
child, | ||
loadingCaption, | ||
loadingOpacity, | ||
onCancelCallback | ||
); | ||
expect(component.toJSON()).toMatchSnapshot(); | ||
}); | ||
}); | ||
|
||
const renderComponent = ( | ||
isLoading: boolean, | ||
children?: React.ReactNode, | ||
loadingCaption?: string, | ||
loadingOpacity?: number, | ||
onCancel?: () => void | ||
) => { | ||
const initialState = appReducer(undefined, applicationChangeState("active")); | ||
const dsState = appReducer( | ||
initialState, | ||
preferencesDesignSystemSetEnabled({ isDesignSystemEnabled: true }) | ||
); | ||
const mockStore = configureMockStore<GlobalState>(); | ||
const store: ReturnType<typeof mockStore> = mockStore(dsState); | ||
return render( | ||
<Provider store={store}> | ||
<LoadingSpinnerOverlay | ||
isLoading={isLoading} | ||
loadingCaption={loadingCaption} | ||
loadingOpacity={loadingOpacity} | ||
onCancel={onCancel} | ||
> | ||
{children} | ||
</LoadingSpinnerOverlay> | ||
</Provider> | ||
); | ||
}; |
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
Oops, something went wrong.