Skip to content

Commit

Permalink
Copy/paste + declare PayButtonElement
Browse files Browse the repository at this point in the history
  • Loading branch information
awalker-stripe committed Nov 15, 2022
1 parent 70b08ec commit 16a6835
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/components/createElementComponent.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
PaymentElementComponent,
PaymentRequestButtonElementComponent,
CartElementComponent,
PayButtonElementComponent,
} from '../types';
import {PayButtonElement} from '..';

const {Elements} = ElementsModule;

Expand Down Expand Up @@ -176,6 +176,11 @@ describe('createElementComponent', () => {
false
);

const PayButtonElement: PayButtonElementComponent = createElementComponent(
'payButton',
false
);

it('Can remove and add CardElement at the same time', () => {
let cardMounted = false;
mockElement.mount.mockImplementation(() => {
Expand Down Expand Up @@ -551,7 +556,7 @@ describe('createElementComponent', () => {
expect(mockHandler).not.toHaveBeenCalled();
});

it('propagates the Element`s lineitemclick event to the current onConfirm prop', () => {
it('propagates the Element`s confirm event to the current onConfirm prop', () => {
const mockHandler = jest.fn();
const mockHandler2 = jest.fn();
const {rerender} = render(
Expand All @@ -565,7 +570,7 @@ describe('createElementComponent', () => {
</Elements>
);

const confirmEventMock = Symbol('lineitemclick');
const confirmEventMock = Symbol('confirm');
simulateConfirm(confirmEventMock);
expect(mockHandler2).toHaveBeenCalledWith(confirmEventMock);
expect(mockHandler).not.toHaveBeenCalled();
Expand All @@ -585,7 +590,7 @@ describe('createElementComponent', () => {
</Elements>
);

const cancelEventMock = Symbol('lineitemclick');
const cancelEventMock = Symbol('cancel');
simulateCancel(cancelEventMock);
expect(mockHandler2).toHaveBeenCalledWith(cancelEventMock);
expect(mockHandler).not.toHaveBeenCalled();
Expand Down

0 comments on commit 16a6835

Please sign in to comment.