-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into gbacc/fix/TDOPS-4682-input-file-fixes
- Loading branch information
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
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,5 @@ | ||
--- | ||
'@talend/design-system': minor | ||
--- | ||
|
||
Design System - InlineEdit and InlineEditMulti can now have a maxLength attribute |
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
41 changes: 41 additions & 0 deletions
41
packages/design-system/src/components/InlineEditing/variations/InlineEditing.textarea.cy.tsx
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,41 @@ | ||
import InlineEditingMulti from './InlineEditing.textarea'; | ||
|
||
context('<InlineEditing.Textarea />', () => { | ||
const defaultProps = { | ||
label: 'Textarea inline edit', | ||
placeholder: 'Type here', | ||
}; | ||
|
||
it('should render with filled value', () => { | ||
cy.mount(<InlineEditingMulti {...defaultProps} defaultValue="Some text" />); | ||
|
||
cy.get('[data-testid="inlineediting.button.edit"]').should('exist'); | ||
cy.get('p').should('have.text', 'Some text'); | ||
}); | ||
|
||
it('should allow inline editing', () => { | ||
cy.mount(<InlineEditingMulti {...defaultProps} />); | ||
|
||
// Switch to edit mode | ||
cy.get('[data-testid="inlineediting.button.edit"]').click(); | ||
cy.get('[data-testid="inlineediting.textarea"]').should('be.visible'); | ||
cy.get('[data-testid="inlineediting.button.cancel"]').should('be.visible'); | ||
cy.get('[data-testid="inlineediting.button.submit"]').should('be.visible'); | ||
|
||
// Input some text and submit | ||
cy.get('[data-testid="inlineediting.textarea"]').type('Here is a description'); | ||
cy.get('[data-testid="inlineediting.button.submit"]').click(); | ||
|
||
cy.get('p').should('have.text', 'Here is a description'); | ||
}); | ||
|
||
it('should allow to have some constraints', () => { | ||
cy.mount(<InlineEditingMulti {...defaultProps} required={true} maxLength={10} />); | ||
|
||
cy.get('[data-testid="inlineediting.button.edit"]').click(); | ||
cy.get('[data-testid="inlineediting.textarea"]').should('have.attr', 'required'); | ||
cy.get('[data-testid="inlineediting.textarea"]') | ||
.invoke('attr', 'maxLength') | ||
.should('equal', '10'); | ||
}); | ||
}); |