-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add component for payButton element #344
Conversation
189e1c4
to
e399bfa
Compare
@@ -10,6 +10,7 @@ import { | |||
PaymentRequestButtonElementComponent, | |||
CartElementComponent, | |||
} from '../types'; | |||
import {PayButtonElement} from '..'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we instead do import PayButtonElementComponent
in the above import line?
it('propagates the Element`s lineitemclick event to the current onConfirm prop', () => { | ||
const mockHandler = jest.fn(); | ||
const mockHandler2 = jest.fn(); | ||
const {rerender} = render( | ||
<Elements stripe={mockStripe}> | ||
<PayButtonElement onConfirm={mockHandler} /> | ||
</Elements> | ||
); | ||
rerender( | ||
<Elements stripe={mockStripe}> | ||
<PayButtonElement onConfirm={mockHandler2} /> | ||
</Elements> | ||
); | ||
|
||
const confirmEventMock = Symbol('lineitemclick'); | ||
simulateConfirm(confirmEventMock); | ||
expect(mockHandler2).toHaveBeenCalledWith(confirmEventMock); | ||
expect(mockHandler).not.toHaveBeenCalled(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe an accidental copy-paste?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, good catch, ty!
/** | ||
* Triggered when a buyer authorizes a payment within a supported payment method. | ||
*/ | ||
onConfirm: (event: stripeJs.StripePayButtonElementConfirmEvent) => any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice :)
Summary & motivation
Adds component for the
payButton
element.Testing & documentation
Performed manual testing using a local React project.