-
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 jmfrancois/feat/bootstrap-theme-tokens
- Loading branch information
Showing
34 changed files
with
280 additions
and
75 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
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 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 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 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
36 changes: 36 additions & 0 deletions
36
packages/design-system/src/components/Form/Field/Input/Input.File.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,36 @@ | ||
import InputFile from './Input.File'; | ||
|
||
context('<Form.File />', () => { | ||
const defaultProps = { | ||
label: 'Select file here', | ||
name: 'file', | ||
}; | ||
it('should render', () => { | ||
cy.mount(<InputFile {...defaultProps} />); | ||
|
||
cy.get('label').should('have.text', defaultProps.label); | ||
cy.get('ol[role="list"]').should('not.exist'); | ||
cy.get('button').should('not.exist'); | ||
}); | ||
|
||
it('should render with filled value', () => { | ||
cy.mount(<InputFile {...defaultProps} files={['file.js']} />); | ||
|
||
cy.get('ol[role="list"]').should('have.text', 'file.js'); | ||
cy.get('button').should('exist'); | ||
}); | ||
|
||
it('should trigger dom events', () => { | ||
cy.document().then(doc => { | ||
doc.addEventListener('change', cy.stub().as('onChange')); | ||
}); | ||
|
||
cy.mount(<InputFile {...defaultProps} />); | ||
|
||
cy.get('input').selectFile(Cypress.Buffer.from('Hello world')); | ||
cy.get('@onChange').should('have.been.calledOnce'); | ||
|
||
cy.get('button').click({ force: true }); | ||
cy.get('@onChange').should('have.been.calledTwice'); | ||
}); | ||
}); |
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
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'); | ||
}); | ||
}); |
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
Oops, something went wrong.