Skip to content

Commit cc932c2

Browse files
fix: map prop to children prop for variant (#297) (#304)
* fix: map prop to children prop for variant Co-authored-by: Alexander Harris <[email protected]> Co-authored-by: yeung-wah <[email protected]>
1 parent 7f08cd9 commit cc932c2

18 files changed

+2008
-1
lines changed

packages/codegen-ui-react/lib/__tests__/__snapshots__/studio-ui-codegen-react.test.ts.snap

Lines changed: 567 additions & 0 deletions
Large diffs are not rendered by default.

packages/codegen-ui-react/lib/__tests__/studio-ui-codegen-react.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ describe('amplify render tests', () => {
188188
const generatedCode = generateWithAmplifyRenderer('complexTest8');
189189
expect(generatedCode.componentText).toMatchSnapshot();
190190
});
191+
it('should render complex sample 9', () => {
192+
const generatedCode = generateWithAmplifyRenderer('complexTest9');
193+
expect(generatedCode.componentText).toMatchSnapshot();
194+
});
191195
});
192196

193197
describe('concat and conditional transform', () => {
@@ -236,6 +240,20 @@ describe('amplify render tests', () => {
236240
});
237241
});
238242

243+
describe('component with variants with mapped children prop', () => {
244+
it('should render variants with options provided, and mapped children prop', () => {
245+
const generatedCode = generateWithAmplifyRenderer('componentWithVariantsWithMappedChildrenProp');
246+
expect(generatedCode).toMatchSnapshot();
247+
});
248+
});
249+
250+
describe('component with variants and not override children prop', () => {
251+
it('should render variants with options provided, and not override children prop', () => {
252+
const generatedCode = generateWithAmplifyRenderer('componentWithVariantsAndNotOverrideChildProp');
253+
expect(generatedCode).toMatchSnapshot();
254+
});
255+
});
256+
239257
describe('custom render config', () => {
240258
it('should render ES5', () => {
241259
expect(

0 commit comments

Comments
 (0)