-
Notifications
You must be signed in to change notification settings - Fork 642
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: onChange can also update other fields
- Loading branch information
1 parent
d4ce9a2
commit 46dacb9
Showing
8 changed files
with
59 additions
and
31 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
example-app/cypress/integration/nested/create-nested.spec.js
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,19 @@ | ||
/// <reference types="cypress" /> | ||
/// <reference types="../../support" /> | ||
|
||
context('resources/Nested/actions/new', () => { | ||
before(() => { | ||
cy.login() | ||
}) | ||
|
||
beforeEach(() => { | ||
Cypress.Cookies.preserveOnce(Cypress.env('COOKIE_NAME')) | ||
cy.visit('resources/Nested/actions/new') | ||
}) | ||
|
||
it('fills name when button is clicked', () => { | ||
cy.get('[data-testid="name-button"]').click() | ||
cy.get('[data-testid="property-edit-name"] input') | ||
.should('have.value', 'my new name') | ||
}) | ||
}) |
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,25 @@ | ||
import React from 'react' | ||
import { EditPropertyProps } from 'admin-bro' | ||
import { Button, Box } from '@admin-bro/design-system' | ||
|
||
const ValueTrigger: React.FC<EditPropertyProps> = (props) => { | ||
const { onChange, record } = props | ||
|
||
const handleClick = (): void => { | ||
onChange({ | ||
...record, | ||
params: { | ||
...record.params, | ||
name: 'my new name', | ||
}, | ||
}) | ||
} | ||
|
||
return ( | ||
<Box mb="xxl"> | ||
<Button data-testid="name-button" type="button" onClick={handleClick}>Set Name</Button> | ||
</Box> | ||
) | ||
} | ||
|
||
export default ValueTrigger |
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
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
This file was deleted.
Oops, something went wrong.