Skip to content

Commit

Permalink
chore: add reload nav action golden definition (#367)
Browse files Browse the repository at this point in the history
  • Loading branch information
alharris-at committed Feb 25, 2022
1 parent 4e4d4fc commit 9d978bf
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,45 @@ export default function NavigateButton(
}
`;

exports[`amplify render tests actions navigation reload navigation action 1`] = `
Object {
"componentText": "/* eslint-disable */
import React from \\"react\\";
import {
EscapeHatchProps,
getOverrideProps,
useNavigateAction,
} from \\"@aws-amplify/ui-react/internal\\";
import { Button, ButtonProps } from \\"@aws-amplify/ui-react\\";

export type ReloadButtonProps = React.PropsWithChildren<
Partial<ButtonProps> & {
overrides?: EscapeHatchProps | undefined | null;
}
>;
export default function ReloadButton(
props: ReloadButtonProps
): React.ReactElement {
const { overrides, ...rest } = props;
const action = useNavigateAction({ type: \\"reload\\" });
return (
/* @ts-ignore: TS2322 */
<Button
children=\\"Reload the page.\\"
onClick={() => {
action.run();
}}
{...rest}
{...getOverrideProps(overrides, \\"ReloadButton\\")}
></Button>
);
}
",
"declaration": undefined,
"renderComponentToFilesystem": [Function],
}
`;

exports[`amplify render tests basic component tests should generate a simple button component 1`] = `
"/* eslint-disable */
import React from \\"react\\";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,10 @@ describe('amplify render tests', () => {
it('anchor navigation action', () => {
expect(generateWithAmplifyRenderer('workflow/anchorNavigationAction')).toMatchSnapshot();
});

it('reload navigation action', () => {
expect(generateWithAmplifyRenderer('workflow/reloadNavigationAction')).toMatchSnapshot();
});
});

describe('auth', () => {
Expand Down
26 changes: 0 additions & 26 deletions packages/codegen-ui/example-schemas/workflow/navigationAction.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"componentType": "Button",
"name": "ReloadButton",
"properties": {
"children": {
"value": "Reload the page."
}
},
"events": {
"click": {
"action": "Amplify.Navigate",
"parameters": {
"type": {
"value": "reload"
}
}
}
}
}

0 comments on commit 9d978bf

Please sign in to comment.