Skip to content

Commit a316485

Browse files
authored
add deploy app option in getting started only for web developers (#8281)
* add deploy app option in getting started only for web developers * update text and change how amplify works to next/link component * update test for GetStartedPopover
1 parent f1ebb32 commit a316485

File tree

4 files changed

+128
-150
lines changed

4 files changed

+128
-150
lines changed

src/components/GetStartedPopover/GetStartedPopover.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ export const GetStartedPopover = ({
3737
query: { platform: platform }
3838
}}
3939
>
40-
Get started
40+
{['swift', 'android', 'flutter', 'react-native'].includes(platform)
41+
? 'Get started'
42+
: 'Build a new app'}
4143
</InternalLinkButton>
4244
<Popover>
4345
<Popover.Trigger

src/components/GetStartedPopover/__tests__/GetStartedPopover.test.tsx

+31-46
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ import {
1616
const routerMock = {
1717
__esModule: true,
1818
useRouter: () => {
19-
return {
20-
query: { platform: 'react' },
21-
asPath: '/'
22-
};
19+
return { query: { platform: 'react' }, asPath: '/' };
2320
}
2421
};
2522

@@ -32,82 +29,55 @@ describe('GetStartedPopover', () => {
3229
const getStartedLinks = [
3330
{
3431
title: 'React',
35-
href: {
36-
pathname: getStartedHref,
37-
query: { platform: 'react' }
38-
},
32+
href: { pathname: getStartedHref, query: { platform: 'react' } },
3933
icon: <IconReact />,
4034
platform: 'react'
4135
},
4236
{
4337
title: 'JavaScript',
44-
href: {
45-
pathname: getStartedHref,
46-
query: { platform: 'javascript' }
47-
},
38+
href: { pathname: getStartedHref, query: { platform: 'javascript' } },
4839
icon: <IconJS />,
4940
platform: 'javascript'
5041
},
5142
{
5243
title: 'Flutter',
53-
href: {
54-
pathname: getStartedHref,
55-
query: { platform: 'flutter' }
56-
},
44+
href: { pathname: getStartedHref, query: { platform: 'flutter' } },
5745
icon: <IconFlutter />,
5846
platform: 'flutter'
5947
},
6048
{
6149
title: 'Swift',
62-
href: {
63-
pathname: getStartedHref,
64-
query: { platform: 'swift' }
65-
},
50+
href: { pathname: getStartedHref, query: { platform: 'swift' } },
6651
icon: <IconSwift />,
6752
platform: 'swift'
6853
},
6954
{
7055
title: 'Android',
71-
href: {
72-
pathname: getStartedHref,
73-
query: { platform: 'android' }
74-
},
56+
href: { pathname: getStartedHref, query: { platform: 'android' } },
7557
icon: <IconAndroid />,
7658
platform: 'android'
7759
},
7860
{
7961
title: 'React Native',
80-
href: {
81-
pathname: getStartedHref,
82-
query: { platform: 'react-native' }
83-
},
62+
href: { pathname: getStartedHref, query: { platform: 'react-native' } },
8463
icon: <IconReact />,
8564
platform: 'react-native'
8665
},
8766
{
8867
title: 'Angular',
89-
href: {
90-
pathname: getStartedHref,
91-
query: { platform: 'angular' }
92-
},
68+
href: { pathname: getStartedHref, query: { platform: 'angular' } },
9369
icon: <IconAngular />,
9470
platform: 'angular'
9571
},
9672
{
9773
title: 'Next.js',
98-
href: {
99-
pathname: getStartedHref,
100-
query: { platform: 'nextjs' }
101-
},
74+
href: { pathname: getStartedHref, query: { platform: 'nextjs' } },
10275
icon: <IconNext />,
10376
platform: 'nextjs'
10477
},
10578
{
10679
title: 'Vue',
107-
href: {
108-
pathname: getStartedHref,
109-
query: { platform: 'vue' }
110-
},
80+
href: { pathname: getStartedHref, query: { platform: 'vue' } },
11181
icon: <IconVue />,
11282
platform: 'vue'
11383
}
@@ -131,6 +101,24 @@ describe('GetStartedPopover', () => {
131101
it('should render the GetStartedPopover component', async () => {
132102
render(component);
133103

104+
const gettingStartedBtn = await screen.findByRole('link', {
105+
name: 'Build a new app'
106+
});
107+
108+
expect(gettingStartedBtn).toBeInTheDocument();
109+
});
110+
111+
const mobileComponent = (
112+
<GetStartedPopover
113+
testId={testId}
114+
platform={'swift'}
115+
getStartedLinks={getStartedLinks}
116+
/>
117+
);
118+
119+
it('should render the GetStartedPopover mobile frameworks', async () => {
120+
render(mobileComponent);
121+
134122
const gettingStartedBtn = await screen.findByRole('link', {
135123
name: 'Get started'
136124
});
@@ -142,7 +130,7 @@ describe('GetStartedPopover', () => {
142130
render(component);
143131

144132
const popoverNode = await screen.findByRole('link', {
145-
name: 'Get started'
133+
name: 'Build a new app'
146134
});
147135
expect(popoverNode.getAttribute('href')).toContain(
148136
'/react/start/quickstart'
@@ -244,10 +232,7 @@ describe('GetStartedPopover', () => {
244232
});
245233

246234
routerMock.useRouter = () => {
247-
return {
248-
query: { platform: 'vue' },
249-
asPath: '/gen1'
250-
};
235+
return { query: { platform: 'vue' }, asPath: '/gen1' };
251236
};
252237

253238
const gen1GetStartedPopover = (
@@ -260,7 +245,7 @@ describe('GetStartedPopover', () => {
260245
render(gen1GetStartedPopover);
261246

262247
const popoverNode = await screen.findByRole('link', {
263-
name: 'Get started'
248+
name: 'Build a new app'
264249
});
265250

266251
expect(popoverNode.getAttribute('href')).toContain(

0 commit comments

Comments
 (0)