-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PP-11463 Fix Google pay description dialog bug
- When the payment reference is long and the Google pay dialog appears, then it does not show the `add` button. Which the user needs to add contact information. - This is a bug with Google chrome - it does not wrap the payment description text. So its pushes the button too wide so it is not visible. - This PR truncates the payment description if it is too long when setting up the Google payment.
- Loading branch information
Showing
3 changed files
with
46 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use strict' | ||
|
||
global.window = { | ||
Card: {}, | ||
Charge: {} | ||
} | ||
|
||
const { shortenGooglePayDescription } = require('../../../../app/assets/javascripts/browsered/web-payments/google-pay') | ||
const { expect } = require('chai') | ||
|
||
const STRING_17_CHAR_LENGTH = 'abcdefghijklmnopq' | ||
const STRING_18_CHAR_LENGTH = 'abcdefghijklmnopqr' | ||
const STRING_19_CHAR_LENGTH = 'abcdefghijklmnopqrs' | ||
|
||
describe('Google Pay', () => { | ||
describe('shorten payment description for Google pay', () => { | ||
it('should return the original description when the length < 18', () => { | ||
expect(shortenGooglePayDescription(STRING_17_CHAR_LENGTH)).to.equal(STRING_17_CHAR_LENGTH) | ||
}) | ||
|
||
it('should return the original description when length = 18', () => { | ||
expect(shortenGooglePayDescription(STRING_18_CHAR_LENGTH)).to.equal(STRING_18_CHAR_LENGTH) | ||
}) | ||
|
||
it('should tuncate the description to 17 characters and add the elipses character when length > 18', () => { | ||
expect(shortenGooglePayDescription(STRING_19_CHAR_LENGTH)).to.equal('abcdefghijklmnopq…') | ||
}) | ||
}) | ||
}) |