This repository has been archived by the owner on Dec 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from Ultimaker/form-disable-button
Making the popup and form components more flexible
- Loading branch information
Showing
15 changed files
with
398 additions
and
241 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
38 changes: 38 additions & 0 deletions
38
src/components/__tests__/__snapshots__/form_actions.test.tsx.snap
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,38 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`The form actions component should render its children 1`] = ` | ||
<div | ||
className="form__actions" | ||
> | ||
<div | ||
className="form__btn-container" | ||
key="0" | ||
> | ||
<Button | ||
className="" | ||
key=".0" | ||
linkToNewTab={false} | ||
shape="rectangle" | ||
style="primary" | ||
type="button" | ||
> | ||
First Button | ||
</Button> | ||
</div> | ||
<div | ||
className="form__btn-container" | ||
key="1" | ||
> | ||
<Button | ||
className="" | ||
key=".1" | ||
linkToNewTab={false} | ||
shape="rectangle" | ||
style="primary" | ||
type="button" | ||
> | ||
Second Button | ||
</Button> | ||
</div> | ||
</div> | ||
`; |
52 changes: 16 additions & 36 deletions
52
src/components/__tests__/__snapshots__/popup.test.tsx.snap
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 |
---|---|---|
@@ -1,42 +1,22 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`The Popup component should render a confirm popup 1`] = ` | ||
<div | ||
className="popup" | ||
<PopupBase | ||
headerText="Popup header" | ||
width="sm" | ||
> | ||
<Modal | ||
width="sm" | ||
<p | ||
key="0" | ||
> | ||
<div | ||
className="popup__container" | ||
> | ||
<div | ||
className="popup__content" | ||
> | ||
<div | ||
className="popup__header" | ||
> | ||
Popup header | ||
</div> | ||
<div | ||
className="popup__body" | ||
> | ||
<p | ||
key="0" | ||
> | ||
Popup body | ||
</p> | ||
<Form | ||
alwaysEnableSubmitButton={true} | ||
onSubmitHandler={[Function]} | ||
primaryBtnShowSpinner={false} | ||
primaryBtnText="Primary button" | ||
secondaryBtnHandler={[Function]} | ||
secondaryBtnShowSpinner={false} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
</Modal> | ||
</div> | ||
Popup body | ||
</p> | ||
<Form | ||
alwaysEnableSubmitButton={true} | ||
onSubmitHandler={[Function]} | ||
primaryBtnShowSpinner={false} | ||
primaryBtnText="Primary button" | ||
secondaryBtnHandler={[Function]} | ||
secondaryBtnShowSpinner={false} | ||
/> | ||
</PopupBase> | ||
`; |
28 changes: 28 additions & 0 deletions
28
src/components/__tests__/__snapshots__/popup_base.test.tsx.snap
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,28 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`The PopupBase component should render a modal 1`] = ` | ||
<div | ||
className="popup" | ||
> | ||
<Modal | ||
width="sm" | ||
> | ||
<div | ||
className="popup__container" | ||
> | ||
<div | ||
className="popup__content" | ||
> | ||
<div | ||
className="popup__header" | ||
> | ||
PopupBase header | ||
</div> | ||
<div | ||
className="popup__body" | ||
/> | ||
</div> | ||
</div> | ||
</Modal> | ||
</div> | ||
`; |
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,24 @@ | ||
// Copyright (c) 2018 Ultimaker B.V. | ||
import * as React from 'react'; | ||
import { shallow, mount } from 'enzyme'; | ||
|
||
// component | ||
import FormActions from '../form_actions'; | ||
import Button from '../button'; | ||
|
||
describe('The form actions component', () => { | ||
let wrapper; | ||
|
||
beforeEach(() => { | ||
wrapper = shallow( | ||
<FormActions> | ||
<Button>First Button</Button> | ||
<Button>Second Button</Button> | ||
</FormActions> | ||
); | ||
}); | ||
|
||
it('should render its children', () => { | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); |
Oops, something went wrong.