Skip to content

Commit

Permalink
Merge pull request #9 from sequra/token-form-iframe-visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
golive authored Jun 10, 2024
2 parents 9d32e49 + 72418e0 commit 81ce2a1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/paymentForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,17 @@ const paymentForm = ({
name: 'mufasa-iframe',
src: url,
});
const tokenFormStyles = !hidden ? {} : {
position: 'absolute',
height: '0px',
left: '-999px',
overflow: 'hidden',
opacity: '0',
};
setElementStyles(mufasaIframe, {
...baseStyles,
...styles,
display: hidden ? 'none' : 'block'
...tokenFormStyles,
});
if(className) {
mufasaIframe.className = className;
Expand Down
8 changes: 7 additions & 1 deletion src/tests/sequraPCI.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ describe('SequraPCI', () => {
test('mounts the iframe in the DOM, hidden', () => {
paymentForm = SequraPCI.paymentForm({ url: emptyUrl }).mount('my-container', { hidden: true });
const mufasaIframe = document.querySelector('iframe');
expect(mufasaIframe.style["display"]).toEqual("none");
expect(mufasaIframe).toHaveStyle({
position: 'absolute',
height: '0px',
left: '-999px',
overflow: 'hidden',
opacity: '0',
});
});

test('it uses custom styles', () => {
Expand Down

0 comments on commit 81ce2a1

Please sign in to comment.