-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v6 - Removing Card 'showBrandsUnderCardNumber' property (#2441)
- Loading branch information
1 parent
b58aea2
commit 09ec83b
Showing
22 changed files
with
73 additions
and
305 deletions.
There are no files selected for viewing
4 changes: 0 additions & 4 deletions
4
packages/e2e/tests/cards/availableBrands/component/availableBrands.disabled.clientScripts.js
This file was deleted.
Oops, something went wrong.
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: 0 additions & 36 deletions
36
...b/src/components/Dropin/components/PaymentMethod/PaymentMethodBrands/CompactView.test.tsx
This file was deleted.
Oops, something went wrong.
35 changes: 0 additions & 35 deletions
35
...es/lib/src/components/Dropin/components/PaymentMethod/PaymentMethodBrands/CompactView.tsx
This file was deleted.
Oops, something went wrong.
58 changes: 37 additions & 21 deletions
58
...mponents/Dropin/components/PaymentMethod/PaymentMethodBrands/PaymentMethodBrands.test.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 |
---|---|---|
@@ -1,31 +1,47 @@ | ||
import { h } from 'preact'; | ||
import { mount } from 'enzyme'; | ||
import { render, screen } from '@testing-library/preact'; | ||
import PaymentMethodBrands from './PaymentMethodBrands'; | ||
import CompactView from './CompactView'; | ||
import PaymentMethodIcon from '../PaymentMethodIcon'; | ||
|
||
const brands = [ | ||
{ name: 'visa', icon: 'visa.png' }, | ||
{ name: 'mc', icon: 'mc.png' }, | ||
{ name: 'amex', icon: 'amex.png' }, | ||
{ name: 'discovery', icon: 'discovery.png' }, | ||
{ name: 'vpay', icon: 'vpay.png' }, | ||
{ name: 'maestro', icon: 'maestro.png' } | ||
]; | ||
|
||
describe('PaymentMethodBrands', () => { | ||
test('should render compact view if prop is set', () => { | ||
const wrapper = mount(<PaymentMethodBrands brands={brands} isPaymentMethodSelected={false} isCompactView />); | ||
expect(wrapper.find(CompactView)).toHaveLength(1); | ||
test('should not render anything if payment method is selected', () => { | ||
const brands = [{ name: 'visa', icon: 'visa.png' }]; | ||
const { container } = render(<PaymentMethodBrands brands={brands} isPaymentMethodSelected={true} />); | ||
|
||
expect(container).toBeEmptyDOMElement(); | ||
}); | ||
|
||
test('should render compact view if prop is not', () => { | ||
const wrapper = mount(<PaymentMethodBrands brands={brands} isPaymentMethodSelected />); | ||
expect(wrapper.find(CompactView)).toHaveLength(1); | ||
test('should render three brands', () => { | ||
const brands = [ | ||
{ name: 'visa', icon: 'visa.png' }, | ||
{ name: 'mc', icon: 'mc.png' }, | ||
{ name: 'amex', icon: 'amex.png' } | ||
]; | ||
|
||
render(<PaymentMethodBrands brands={brands} isPaymentMethodSelected={false} />); | ||
|
||
screen.getByAltText('VISA'); | ||
screen.getByAltText('MasterCard'); | ||
screen.getByAltText('American Express'); | ||
|
||
expect(screen.queryByText(/\+/)).toBeNull(); | ||
}); | ||
|
||
test('should not render compact view if prop is set to false', () => { | ||
const wrapper = mount(<PaymentMethodBrands brands={brands} isPaymentMethodSelected isCompactView={false} />); | ||
expect(wrapper.find(PaymentMethodIcon)).toHaveLength(6); | ||
test('should render three brands AND number of left over brands', () => { | ||
const brands = [ | ||
{ name: 'visa', icon: 'visa.png' }, | ||
{ name: 'mc', icon: 'mc.png' }, | ||
{ name: 'amex', icon: 'amex.png' }, | ||
{ name: 'discovery', icon: 'discovery.png' }, | ||
{ name: 'vpay', icon: 'vpay.png' }, | ||
{ name: 'maestro', icon: 'maestro.png' } | ||
]; | ||
|
||
render(<PaymentMethodBrands brands={brands} isPaymentMethodSelected={false} />); | ||
|
||
screen.getByAltText('VISA'); | ||
screen.getByAltText('MasterCard'); | ||
screen.getByAltText('American Express'); | ||
|
||
screen.getByText('+3'); | ||
}); | ||
}); |
43 changes: 19 additions & 24 deletions
43
...rc/components/Dropin/components/PaymentMethod/PaymentMethodBrands/PaymentMethodBrands.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
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.