-
Notifications
You must be signed in to change notification settings - Fork 687
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/issue-3192
- Loading branch information
Showing
537 changed files
with
8,845 additions
and
8,539 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
15 changes: 15 additions & 0 deletions
15
...ns/venia-sample-payments-checkmo/src/components/__tests__/__snapshots__/edit.spec.js.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,15 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`renders correctly 1`] = ` | ||
<div | ||
className="root" | ||
> | ||
<mock-CheckMo | ||
onPaymentError={[MockFunction onPaymentError]} | ||
onPaymentReady={[MockFunction onPaymentReady]} | ||
onPaymentSuccess={[MockFunction onPaymentSuccess]} | ||
resetShouldSubmit={[MockFunction resetShouldSubmit]} | ||
shouldSubmit={false} | ||
/> | ||
</div> | ||
`; |
58 changes: 58 additions & 0 deletions
58
...venia-sample-payments-checkmo/src/components/__tests__/__snapshots__/summary.spec.js.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,58 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`renders correctly 1`] = ` | ||
<div | ||
className="root" | ||
> | ||
<div | ||
className="heading_container" | ||
> | ||
<h5 | ||
className="heading" | ||
> | ||
<div | ||
componentName="Formatted Message Component" | ||
defaultMessage="Payment Information" | ||
id="checkoutPage.paymentInformation" | ||
/> | ||
</h5> | ||
<mock-LinkButton | ||
className="edit_button" | ||
onClick={[MockFunction onEdit]} | ||
type="button" | ||
> | ||
<mock-Icon | ||
classes={ | ||
Object { | ||
"icon": "edit_icon", | ||
} | ||
} | ||
size={16} | ||
src={[Function]} | ||
/> | ||
<span | ||
className="edit_text" | ||
> | ||
<div | ||
componentName="Formatted Message Component" | ||
defaultMessage="Edit" | ||
id="global.editButton" | ||
/> | ||
</span> | ||
</mock-LinkButton> | ||
</div> | ||
<div | ||
className="checkmo_details_container" | ||
> | ||
<span | ||
className="payment_type" | ||
> | ||
<div | ||
componentName="Formatted Message Component" | ||
defaultMessage="Check / Money Order" | ||
id="checkMo.paymentType" | ||
/> | ||
</span> | ||
</div> | ||
</div> | ||
`; |
28 changes: 28 additions & 0 deletions
28
packages/extensions/venia-sample-payments-checkmo/src/components/__tests__/edit.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,28 @@ | ||
import React from 'react'; | ||
import { createTestInstance } from '@magento/peregrine'; | ||
|
||
import Edit from '../edit'; | ||
|
||
jest.mock('@magento/venia-ui/lib/classify'); | ||
jest.mock('../checkmo', () => props => <mock-CheckMo {...props} />); | ||
|
||
const mocks = { | ||
onPaymentReady: jest.fn().mockName('onPaymentReady'), | ||
onPaymentSuccess: jest.fn().mockName('onPaymentSuccess'), | ||
onPaymentError: jest.fn().mockName('onPaymentError'), | ||
resetShouldSubmit: jest.fn().mockName('resetShouldSubmit') | ||
}; | ||
|
||
test('renders correctly', () => { | ||
// Arrange. | ||
const props = { | ||
...mocks, | ||
shouldSubmit: false | ||
}; | ||
|
||
// Act. | ||
const tree = createTestInstance(<Edit {...props} />); | ||
|
||
// Assert. | ||
expect(tree.toJSON()).toMatchSnapshot(); | ||
}); |
30 changes: 30 additions & 0 deletions
30
packages/extensions/venia-sample-payments-checkmo/src/components/__tests__/summary.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,30 @@ | ||
import React from 'react'; | ||
import { createTestInstance } from '@magento/peregrine'; | ||
|
||
import Summary from '../summary'; | ||
|
||
jest.mock('@magento/venia-ui/lib/classify'); | ||
jest.mock('react-intl', () => ({ | ||
FormattedMessage: props => ( | ||
<div componentName="Formatted Message Component" {...props} /> | ||
) | ||
})); | ||
jest.mock('@magento/venia-ui/lib/components/LinkButton', () => props => ( | ||
<mock-LinkButton {...props} /> | ||
)); | ||
jest.mock('@magento/venia-ui/lib/components/Icon', () => props => ( | ||
<mock-Icon {...props} /> | ||
)); | ||
|
||
test('renders correctly', () => { | ||
// Arrange. | ||
const props = { | ||
onEdit: jest.fn().mockName('onEdit') | ||
}; | ||
|
||
// Act. | ||
const tree = createTestInstance(<Summary {...props} />); | ||
|
||
// Assert. | ||
expect(tree.toJSON()).toMatchSnapshot(); | ||
}); |
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
4 changes: 4 additions & 0 deletions
4
packages/extensions/venia-sample-payments-checkmo/src/components/edit.css
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,4 @@ | ||
.root { | ||
overflow: auto; | ||
padding: 0.5rem 1rem; | ||
} |
47 changes: 47 additions & 0 deletions
47
packages/extensions/venia-sample-payments-checkmo/src/components/edit.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,47 @@ | ||
import React from 'react'; | ||
import { shape, string, bool, func } from 'prop-types'; | ||
|
||
import { mergeClasses } from '@magento/venia-ui/lib/classify'; | ||
|
||
import CheckMo from './checkmo'; | ||
import defaultClasses from './edit.css'; | ||
|
||
/** | ||
* The edit view for the Checkmo payment method. | ||
*/ | ||
const EditCheckMo = props => { | ||
const { | ||
onPaymentReady, | ||
onPaymentSuccess, | ||
onPaymentError, | ||
resetShouldSubmit, | ||
shouldSubmit | ||
} = props; | ||
|
||
const classes = mergeClasses(defaultClasses, props.classes); | ||
|
||
return ( | ||
<div className={classes.root}> | ||
<CheckMo | ||
onPaymentReady={onPaymentReady} | ||
onPaymentSuccess={onPaymentSuccess} | ||
onPaymentError={onPaymentError} | ||
resetShouldSubmit={resetShouldSubmit} | ||
shouldSubmit={shouldSubmit} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default EditCheckMo; | ||
|
||
EditCheckMo.propTypes = { | ||
classes: shape({ | ||
root: string | ||
}), | ||
onPaymentReady: func.isRequired, | ||
onPaymentSuccess: func.isRequired, | ||
onPaymentError: func.isRequired, | ||
resetShouldSubmit: func.isRequired, | ||
shouldSubmit: bool | ||
}; |
42 changes: 42 additions & 0 deletions
42
packages/extensions/venia-sample-payments-checkmo/src/components/summary.css
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,42 @@ | ||
.root { | ||
display: grid; | ||
gap: 1.125rem; | ||
padding: 2rem; | ||
} | ||
|
||
.heading_container { | ||
display: grid; | ||
grid-auto-flow: column; | ||
grid-template-columns: 1fr; | ||
} | ||
|
||
.heading { | ||
font-weight: 600; | ||
} | ||
|
||
.edit_button { | ||
color: rgb(var(--venia-brand-color-1-700)); | ||
padding: 1rem; | ||
margin: -1rem; | ||
} | ||
|
||
.edit_icon { | ||
stroke: rgb(var(--venia-brand-color-1-700)); | ||
} | ||
|
||
.edit_text { | ||
} | ||
|
||
.checkmo_details_container { | ||
display: grid; | ||
gap: 0.5rem; | ||
} | ||
|
||
.payment_type { | ||
} | ||
|
||
@media (max-width: 960px) { | ||
.edit_text { | ||
display: none; | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
packages/extensions/venia-sample-payments-checkmo/src/components/summary.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,73 @@ | ||
import React from 'react'; | ||
import { func, shape, string } from 'prop-types'; | ||
import { FormattedMessage } from 'react-intl'; | ||
import { Edit2 as EditIcon } from 'react-feather'; | ||
|
||
import { mergeClasses } from '@magento/venia-ui/lib/classify'; | ||
import Icon from '@magento/venia-ui/lib/components/Icon'; | ||
import LinkButton from '@magento/venia-ui/lib/components/LinkButton'; | ||
|
||
import defaultClasses from './summary.css'; | ||
|
||
/** | ||
* The Summary component of the Check / Money Order payment method extension. | ||
*/ | ||
const Summary = props => { | ||
const { onEdit } = props; | ||
|
||
const classes = mergeClasses(defaultClasses, props.classes); | ||
|
||
return ( | ||
<div className={classes.root}> | ||
<div className={classes.heading_container}> | ||
<h5 className={classes.heading}> | ||
<FormattedMessage | ||
id={'checkoutPage.paymentInformation'} | ||
defaultMessage={'Payment Information'} | ||
/> | ||
</h5> | ||
<LinkButton | ||
className={classes.edit_button} | ||
onClick={onEdit} | ||
type="button" | ||
> | ||
<Icon | ||
size={16} | ||
src={EditIcon} | ||
classes={{ icon: classes.edit_icon }} | ||
/> | ||
<span className={classes.edit_text}> | ||
<FormattedMessage | ||
id={'global.editButton'} | ||
defaultMessage={'Edit'} | ||
/> | ||
</span> | ||
</LinkButton> | ||
</div> | ||
<div className={classes.checkmo_details_container}> | ||
<span className={classes.payment_type}> | ||
<FormattedMessage | ||
id={'checkMo.paymentType'} | ||
defaultMessage={'Check / Money Order'} | ||
/> | ||
</span> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Summary; | ||
|
||
Summary.propTypes = { | ||
classes: shape({ | ||
root: string, | ||
checkmo_details_container: string, | ||
edit_button: string, | ||
edit_icon: string, | ||
edit_text: string, | ||
heading_container: string, | ||
heading: string, | ||
payment_type: string | ||
}), | ||
onEdit: func | ||
}; |
Oops, something went wrong.