Skip to content

Commit bb4a117

Browse files
committed
feat(cli): add data-testid
1 parent 1bcb8f8 commit bb4a117

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

.hygen/generate/resource/create/page-content.ejs.t

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ function CreateFormActions() {
5050
color="primary"
5151
type="submit"
5252
disabled={isSubmitting}
53+
data-testid="submit-button"
5354
>
5455
{t("actions.submit")}
5556
</Button>

.hygen/generate/resource/edit/page-content.ejs.t

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ function EditFormActions() {
5555
color="primary"
5656
type="submit"
5757
disabled={isSubmitting}
58+
data-testid="submit-button"
5859
>
5960
{t("actions.submit")}
6061
</Button>

.hygen/generate/resource/page-content.ejs.t

+5-1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ function Actions({ entityItem }: { entityItem: <%= name %> }) {
9999
variant="contained"
100100
LinkComponent={Link}
101101
href={`/admin-panel/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/edit/${entityItem.id}`}
102+
data-testid="edit-button"
102103
>
103104
{t("actions.edit")}
104105
</Button>
@@ -121,6 +122,7 @@ function Actions({ entityItem }: { entityItem: <%= name %> }) {
121122
aria-label="select"
122123
aria-haspopup="menu"
123124
onClick={handleToggle}
125+
data-testid="actions-button"
124126
>
125127
<ArrowDropDownIcon />
126128
</Button>
@@ -156,6 +158,7 @@ function Actions({ entityItem }: { entityItem: <%= name %> }) {
156158
},
157159
}}
158160
onClick={handleDelete}
161+
data-testid="delete-button"
159162
>
160163
{t("actions.delete")}
161164
</MenuItem>
@@ -191,7 +194,7 @@ function <%= h.inflection.transform(name, ['pluralize']) %>() {
191194
<Grid container spacing={3} pt={3}>
192195
<Grid container size={{ xs: 12 }} spacing={3}>
193196
<Grid size="grow">
194-
<Typography variant="h3">{t("title")}</Typography>
197+
<Typography variant="h3" data-testid="index-page-title">{t("title")}</Typography>
195198
</Grid>
196199
<Grid container size="auto" wrap="nowrap" spacing={2}>
197200
<Grid size="auto">
@@ -200,6 +203,7 @@ function <%= h.inflection.transform(name, ['pluralize']) %>() {
200203
LinkComponent={Link}
201204
href="/admin-panel/<%= h.inflection.transform(name, ['pluralize', 'underscore', 'dasherize']) %>/create"
202205
color="success"
206+
data-testid="add-button"
203207
>
204208
{t("actions.create")}
205209
</Button>

0 commit comments

Comments
 (0)