Skip to content

Commit 50edb26

Browse files
committed
Merge pull request #2 from mstuart/master
Fix for QR code link
2 parents ffbca1d + 5df7e1f commit 50edb26

3 files changed

Lines changed: 23 additions & 12 deletions

File tree

dist/paypal-button.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/paypal-button.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ PAYPAL.apps = PAYPAL.apps || {};
151151
key;
152152

153153
for (key in data) {
154-
url += key + '=' + data[key] + '&';
154+
url += key + '=' + encodeURIComponent(data[key]) + '&';
155155
}
156156

157157
url = encodeURIComponent(url);

test/paypal-button.js

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
11
/*jshint node:true, evil:true */
22
/*global describe:true, it:true, PAYPAL:true, document:true, window:true */
33

4-
54
var fs = require('fs'),
65
should = require('should'),
76
jsdom = require('jsdom').jsdom,
87
document = jsdom(fs.readFileSync('./test/index.html').toString()),
98
window = document.createWindow();
109

11-
1210
eval(fs.readFileSync('src/paypal-button.js').toString());
1311

14-
15-
1612
// Test the object's integrity
1713
describe('PAYPAL.apps.ButtonFactory', function () {
18-
'use strict';
1914

15+
'use strict';
2016

2117
it('Should have a PAYPAL object', function () {
2218
PAYPAL.should.be.a('object');
@@ -30,14 +26,12 @@ describe('PAYPAL.apps.ButtonFactory', function () {
3026
PAYPAL.apps.ButtonFactory.should.be.a('object');
3127
});
3228

33-
3429
});
3530

36-
3731
// Test the create method
3832
describe('PAYPAL.apps.ButtonFactory.create', function () {
39-
'use strict';
4033

34+
'use strict';
4135

4236
it('Should be a function', function () {
4337
PAYPAL.apps.ButtonFactory.create.should.be.a('function');
@@ -49,7 +43,7 @@ describe('PAYPAL.apps.ButtonFactory.create', function () {
4943
result.should.equal(false);
5044
});
5145

52-
it('Should return an element if no parameters', function () {
46+
it('Should return an element', function () {
5347
var result = PAYPAL.apps.ButtonFactory.create({
5448
business: '6XF3MPZBZV6HU',
5549
item: 'Buy now',
@@ -58,5 +52,22 @@ describe('PAYPAL.apps.ButtonFactory.create', function () {
5852

5953
result.should.be.a('object');
6054
});
55+
});
6156

57+
// Test the buttons counter object
58+
describe('PAYPAL.apps.ButtonFactory.buttons', function () {
59+
60+
'use strict';
61+
62+
it('Should have two cart buttons', function () {
63+
var result = PAYPAL.apps.ButtonFactory.buttons.cart;
64+
65+
result.should.equal(2);
66+
});
67+
68+
it('Should have one QR code', function () {
69+
var result = PAYPAL.apps.ButtonFactory.buttons.qr;
70+
71+
result.should.equal(1);
72+
});
6273
});

0 commit comments

Comments
 (0)