Skip to content

Commit fc9e7c9

Browse files
committed
feat(common): PAYPAL-7 Pass in merchant ID on PayPal button script for PayPal Express Checkout
- CR fixes
1 parent b6613e3 commit fc9e7c9

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/script-loader.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ describe('ScriptLoader', () => {
8080
it('attaches script tag to document with data attributes', async () => {
8181
await loader.loadScript(
8282
'https://code.jquery.com/jquery-3.2.1.min.js',
83-
undefined,
84-
{'data-attribute1': '1', 'data-attribute2': '2'});
83+
{async: true, attributes: {'data-attribute1': '1', 'data-attribute2': '2'}});
8584

8685
expect(script.attributes.getNamedItem('data-attribute1')!.value)
8786
.toEqual('1');

src/script-loader.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import BrowserSupport from './browser-support';
44

55
export interface LoadScriptOptions {
66
async: boolean;
7+
attributes: ScriptAttributes;
78
}
89

910
export interface PreloadScriptOptions {
@@ -26,11 +27,12 @@ export default class ScriptLoader {
2627
private _requestSender: RequestSender
2728
) {}
2829

29-
loadScript(src: string, options?: LoadScriptOptions, scriptAttributes?: ScriptAttributes): Promise<void> {
30+
loadScript(src: string, options?: LoadScriptOptions): Promise<void> {
3031
if (!this._scripts[src]) {
3132
this._scripts[src] = new Promise((resolve, reject) => {
3233
const script = document.createElement('script') as LegacyHTMLScriptElement;
3334
const { async = false } = options || {};
35+
const scriptAttributes = options && options.attributes;
3436

3537
for (const key in scriptAttributes) {
3638
if (scriptAttributes.hasOwnProperty(key)) {

0 commit comments

Comments
 (0)