From cf6b17cb02f8673578f7331383a00f6f3c672a4a Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 7 Feb 2016 13:30:08 -0600 Subject: [PATCH 01/39] Fix receiving link MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Here’s a hack to make the link work. Closes https://github.com/gratipay/grtp.co/issues/109. Also added a team widget example for debugging. --- bin/generate-mock.sh | 6 ++++++ lib/v1/api.js | 7 ++++++- test/default-widget-team.html | 7 +++++++ .../northern-plains-athletics/charts.json | 5 +++++ .../northern-plains-athletics/public.json | 11 +++++++++++ 5 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 test/default-widget-team.html create mode 100644 test/gratipay.com/northern-plains-athletics/charts.json create mode 100644 test/gratipay.com/northern-plains-athletics/public.json diff --git a/bin/generate-mock.sh b/bin/generate-mock.sh index 3661e34..0a840c9 100755 --- a/bin/generate-mock.sh +++ b/bin/generate-mock.sh @@ -10,3 +10,9 @@ get gratipay/charts.json get rummik/public.json get rummik/charts.json + +get rummik/public.json +get rummik/charts.json + +get northern-plains-athletics/public.json +get northern-plains-athletics/charts.json diff --git a/lib/v1/api.js b/lib/v1/api.js index 6d90c78..118137a 100644 --- a/lib/v1/api.js +++ b/lib/v1/api.js @@ -132,7 +132,12 @@ text('my-tip-button', data.my_tip == 'self' ? 'You!' : (+data.my_tip > 0 ? data.my_tip : 'Gratipay')); // jshint ignore:line text('goal', '$' + data.goal); text('giving', (data.giving)? '$' + data.giving : 'anonymously'); - link('profile-link', gratipayURI + encodeURIComponent(data.username) + '/'); + // If username exists, it's a ~user, not a team. Build URL accordingly. + if (data.username in locals()) { + link('profile-link', gratipayURI + encodeURIComponent(data.username) + '/'); + } else { + link('profile-link', gratipayURI + encodeURIComponent(data.slug) + '/'); + } link('link', gratipayURI); css('goal-progress-bar', 'width:' + (data.receiving / data.goal * 100) + '%'); diff --git a/test/default-widget-team.html b/test/default-widget-team.html new file mode 100644 index 0000000..04c0187 --- /dev/null +++ b/test/default-widget-team.html @@ -0,0 +1,7 @@ + + + + + + + diff --git a/test/gratipay.com/northern-plains-athletics/charts.json b/test/gratipay.com/northern-plains-athletics/charts.json new file mode 100644 index 0000000..5bee43e --- /dev/null +++ b/test/gratipay.com/northern-plains-athletics/charts.json @@ -0,0 +1,5 @@ +{ + "error_code": 400, + "error_message_long": "Missing key: u'username'", + "error_message_short": "Bad Request" +} \ No newline at end of file diff --git a/test/gratipay.com/northern-plains-athletics/public.json b/test/gratipay.com/northern-plains-athletics/public.json new file mode 100644 index 0000000..4d40163 --- /dev/null +++ b/test/gratipay.com/northern-plains-athletics/public.json @@ -0,0 +1,11 @@ +{ + "homepage": "http://northernplainsathletics.com", + "name": "Northern Plains Athletics", + "nreceiving_from": 1, + "onboarding_url": "http://northernplainsathletics.com/about", + "owner": "~mattbk", + "receiving": 0.10, + "slug": "northern-plains-athletics", + "status": "approved", + "todo_url": "https://github.com/mattbk/npa/issues" +} \ No newline at end of file From 04a5fcbeef040c53d62da5de040c0502160a0a93 Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 7 Feb 2016 13:42:09 -0600 Subject: [PATCH 02/39] Update test/example data public.json structure has changed since these data were created. --- test/gratipay.com/gittip/charts.json | 1 - test/gratipay.com/gittip/public.json | 16 - test/gratipay.com/gratipay/public.json | 23 + .../northern-plains-athletics/charts.json | 5 - test/gratipay.com/rummik/charts.json | 497 ------------------ test/gratipay.com/rummik/public.json | 45 +- 6 files changed, 57 insertions(+), 530 deletions(-) delete mode 100644 test/gratipay.com/gittip/charts.json delete mode 100644 test/gratipay.com/gittip/public.json create mode 100644 test/gratipay.com/gratipay/public.json delete mode 100644 test/gratipay.com/northern-plains-athletics/charts.json delete mode 100644 test/gratipay.com/rummik/charts.json diff --git a/test/gratipay.com/gittip/charts.json b/test/gratipay.com/gittip/charts.json deleted file mode 100644 index 0637a08..0000000 --- a/test/gratipay.com/gittip/charts.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/test/gratipay.com/gittip/public.json b/test/gratipay.com/gittip/public.json deleted file mode 100644 index a018703..0000000 --- a/test/gratipay.com/gittip/public.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "avatar": "https://pbs.twimg.com/profile_images/378800000174073985/359a43ffb13cf9a4a39426891cdc980f.png", - "elsewhere": { - "twitter": { - "id": 80324, - "user_id": "1313765257", - "user_name": "gratipay" - } - }, - "giving": "37.00", - "goal": null, - "id": 20176, - "number": "plural", - "receiving": "370.75", - "username": "gratipay" -} \ No newline at end of file diff --git a/test/gratipay.com/gratipay/public.json b/test/gratipay.com/gratipay/public.json new file mode 100644 index 0000000..e0c48b6 --- /dev/null +++ b/test/gratipay.com/gratipay/public.json @@ -0,0 +1,23 @@ +{ + "avatar": "https://avatars.githubusercontent.com/u/1744073?s=160", + "cryptocoins": {}, + "elsewhere": { + "github": { + "id": 435394, + "user_id": "1744073", + "user_name": "gratipay" + }, + "twitter": { + "id": 80324, + "user_id": "1313765257", + "user_name": "Gratipay" + } + }, + "giving": "0.00", + "id": 20176, + "ngiving_to": 0, + "ntaking_from": 1, + "on": "gratipay", + "taking": "270.60", + "username": "Gratipay" +} \ No newline at end of file diff --git a/test/gratipay.com/northern-plains-athletics/charts.json b/test/gratipay.com/northern-plains-athletics/charts.json deleted file mode 100644 index 5bee43e..0000000 --- a/test/gratipay.com/northern-plains-athletics/charts.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "error_code": 400, - "error_message_long": "Missing key: u'username'", - "error_message_short": "Bad Request" -} \ No newline at end of file diff --git a/test/gratipay.com/rummik/charts.json b/test/gratipay.com/rummik/charts.json deleted file mode 100644 index 6226089..0000000 --- a/test/gratipay.com/rummik/charts.json +++ /dev/null @@ -1,497 +0,0 @@ -[ - { - "date": "2014-03-06", - "npatrons": 16, - "receipts": 50.75 - }, - { - "date": "2014-02-27", - "npatrons": 16, - "receipts": 50.75 - }, - { - "date": "2014-02-20", - "npatrons": 16, - "receipts": 50.75 - }, - { - "date": "2014-02-13", - "npatrons": 16, - "receipts": 50.75 - }, - { - "date": "2014-02-06", - "npatrons": 16, - "receipts": 51.25 - }, - { - "date": "2014-01-30", - "npatrons": 17, - "receipts": 53.25 - }, - { - "date": "2014-01-23", - "npatrons": 17, - "receipts": 53.50 - }, - { - "date": "2014-01-16", - "npatrons": 16, - "receipts": 54.75 - }, - { - "date": "2014-01-09", - "npatrons": 16, - "receipts": 53.75 - }, - { - "date": "2014-01-02", - "npatrons": 12, - "receipts": 51.50 - }, - { - "date": "2013-12-26", - "npatrons": 12, - "receipts": 59.50 - }, - { - "date": "2013-12-19", - "npatrons": 11, - "receipts": 58.50 - }, - { - "date": "2013-12-12", - "npatrons": 11, - "receipts": 56.50 - }, - { - "date": "2013-12-05", - "npatrons": 9, - "receipts": 70.50 - }, - { - "date": "2013-11-28", - "npatrons": 8, - "receipts": 69.50 - }, - { - "date": "2013-11-21", - "npatrons": 8, - "receipts": 69.50 - }, - { - "date": "2013-11-14", - "npatrons": 8, - "receipts": 68.50 - }, - { - "date": "2013-11-07", - "npatrons": 8, - "receipts": 68.50 - }, - { - "date": "2013-10-31", - "npatrons": 7, - "receipts": 66.75 - }, - { - "date": "2013-10-24", - "npatrons": 8, - "receipts": 68.50 - }, - { - "date": "2013-10-17", - "npatrons": 6, - "receipts": 27.75 - }, - { - "date": "2013-10-10", - "npatrons": 7, - "receipts": 66.75 - }, - { - "date": "2013-10-03", - "npatrons": 6, - "receipts": 26.75 - }, - { - "date": "2013-09-26", - "npatrons": 5, - "receipts": 25.75 - }, - { - "date": "2013-09-19", - "npatrons": 6, - "receipts": 25.75 - }, - { - "date": "2013-09-12", - "npatrons": 5, - "receipts": 29.75 - }, - { - "date": "2013-09-05", - "npatrons": 6, - "receipts": 38.75 - }, - { - "date": "2013-08-29", - "npatrons": 5, - "receipts": 28.75 - }, - { - "date": "2013-08-22", - "npatrons": 6, - "receipts": 26.75 - }, - { - "date": "2013-08-15", - "npatrons": 6, - "receipts": 20.75 - }, - { - "date": "2013-08-08", - "npatrons": 6, - "receipts": 20.75 - }, - { - "date": "2013-08-01", - "npatrons": 6, - "receipts": 21.25 - }, - { - "date": "2013-07-25", - "npatrons": 7, - "receipts": 22.50 - }, - { - "date": "2013-07-18", - "npatrons": 5, - "receipts": 10.25 - }, - { - "date": "2013-07-11", - "npatrons": 5, - "receipts": 8.25 - }, - { - "date": "2013-07-04", - "npatrons": 5, - "receipts": 7.25 - }, - { - "date": "2013-06-27", - "npatrons": 4, - "receipts": 6.25 - }, - { - "date": "2013-06-20", - "npatrons": 5, - "receipts": 16.84 - }, - { - "date": "2013-06-13", - "npatrons": 3, - "receipts": 2.69 - }, - { - "date": "2013-06-06", - "npatrons": 3, - "receipts": 2.21 - }, - { - "date": "2013-05-30", - "npatrons": 3, - "receipts": 2.30 - }, - { - "date": "2013-05-23", - "npatrons": 3, - "receipts": 2.07 - }, - { - "date": "2013-05-16", - "npatrons": 3, - "receipts": 0.83 - }, - { - "date": "2013-05-09", - "npatrons": 4, - "receipts": 3.54 - }, - { - "date": "2013-05-02", - "npatrons": 4, - "receipts": 3.54 - }, - { - "date": "2013-04-25", - "npatrons": 4, - "receipts": 3.54 - }, - { - "date": "2013-04-18", - "npatrons": 4, - "receipts": 3.54 - }, - { - "date": "2013-04-11", - "npatrons": 2, - "receipts": 3.25 - }, - { - "date": "2013-04-04", - "npatrons": 2, - "receipts": 3.25 - }, - { - "date": "2013-03-28", - "npatrons": 3, - "receipts": 4.25 - }, - { - "date": "2013-03-22", - "npatrons": 3, - "receipts": 4.25 - }, - { - "date": "2013-03-14", - "npatrons": 3, - "receipts": 4.25 - }, - { - "date": "2013-03-07", - "npatrons": 3, - "receipts": 6.25 - }, - { - "date": "2013-02-28", - "npatrons": 3, - "receipts": 6.25 - }, - { - "date": "2013-02-21", - "npatrons": 3, - "receipts": 9.25 - }, - { - "date": "2013-02-14", - "npatrons": 2, - "receipts": 9.00 - }, - { - "date": "2013-02-07", - "npatrons": 1, - "receipts": 3.00 - }, - { - "date": "2013-01-31", - "npatrons": 1, - "receipts": 3.00, - "ts_start": "2013-01-31T14:21:29.964045+00:00" - }, - { - "date": "2013-01-24", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2013-01-24T14:15:23.073011+00:00" - }, - { - "date": "2013-01-17", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2013-01-17T14:05:01.620168+00:00" - }, - { - "date": "2013-01-10", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2013-01-10T12:32:05.299853+00:00" - }, - { - "date": "2013-01-03", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2013-01-03T13:41:18.062207+00:00" - }, - { - "date": "2012-12-27", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-12-27T12:32:21.391256+00:00" - }, - { - "date": "2012-12-20", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-12-20T12:51:36.881051+00:00" - }, - { - "date": "2012-12-13", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-12-13T13:09:06.330355+00:00" - }, - { - "date": "2012-12-06", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-12-06T13:27:27.158125+00:00" - }, - { - "date": "2012-11-29", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-11-29T12:45:18.180298+00:00" - }, - { - "date": "2012-11-22", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-11-22T15:37:59.390225+00:00" - }, - { - "date": "2012-11-15", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-11-15T14:37:56.650669+00:00" - }, - { - "date": "2012-11-08", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-11-08T20:47:52.767141+00:00" - }, - { - "date": "2012-11-01", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-11-01T23:07:31.044081+00:00" - }, - { - "date": "2012-10-25", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-10-25T12:02:52.010809+00:00" - }, - { - "date": "2012-10-18", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-10-18T13:45:51.045152+00:00" - }, - { - "date": "2012-10-11", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-10-11T16:00:55.171435+00:00" - }, - { - "date": "2012-10-04", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-10-04T13:09:59.575767+00:00" - }, - { - "date": "2012-09-27", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-09-27T13:59:13.358022+00:00" - }, - { - "date": "2012-09-20", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-09-20T12:42:03.698033+00:00" - }, - { - "date": "2012-09-13", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-09-13T06:38:51.300291+00:00" - }, - { - "date": "2012-09-06", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-09-06T22:29:53.060895+00:00" - }, - { - "date": "2012-08-31", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-08-31T12:53:04.080298+00:00" - }, - { - "date": "2012-08-24", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-08-24T13:25:40.605212+00:00" - }, - { - "date": "2012-08-17", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-08-17T18:39:59.835695+00:00" - }, - { - "date": "2012-08-10", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-08-10T19:05:05.938610+00:00" - }, - { - "date": "2012-08-03", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-08-03T14:57:42.935184+00:00" - }, - { - "date": "2012-07-27", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-07-27T20:51:21.754544+00:00" - }, - { - "date": "2012-07-20", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-07-20T19:28:19.952586+00:00" - }, - { - "date": "2012-07-13", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-07-13T17:49:02.299015+00:00" - }, - { - "date": "2012-07-06", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-07-06T18:37:13.603400+00:00" - }, - { - "date": "2012-06-29", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-06-29T17:05:03.867698+00:00" - }, - { - "date": "2012-06-22", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-06-22T15:30:42.882306+00:00" - }, - { - "date": "2012-06-15", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-06-15T11:09:54.298416+00:00" - }, - { - "date": "2012-06-08", - "npatrons": 0, - "receipts": 0.00, - "ts_start": "2012-06-08T12:02:45.182409+00:00" - } -] \ No newline at end of file diff --git a/test/gratipay.com/rummik/public.json b/test/gratipay.com/rummik/public.json index 027b183..f570691 100644 --- a/test/gratipay.com/rummik/public.json +++ b/test/gratipay.com/rummik/public.json @@ -1,32 +1,55 @@ { - "avatar": "https://www.gravatar.com/avatar/970cf49bc983bc884c37a29710260aa9", - "bitcoin": "http://blockchain.info/address/19sNZKMYMUCE7U8FH7FkfVjBr7Cu5ffeEg", + "avatar": "https://avatars.githubusercontent.com/u/630909?s=160", + "cryptocoins": { + "bitcoin": "19sNZKMYMUCE7U8FH7FkfVjBr7Cu5ffeEg" + }, "elsewhere": { "bitbucket": { - "id": 70345, - "user_id": "rummik", + "id": 484700, + "user_id": "{958892e6-ead3-4bea-ac44-14dfa6c2e5ff}", "user_name": "rummik" }, "bountysource": { "id": 121894, "user_id": "17855", - "user_name": "rummik" + "user_name": null + }, + "facebook": { + "id": 532531, + "user_id": "10207846933641983", + "user_name": null }, "github": { "id": 42748, "user_id": "630909", "user_name": "rummik" }, + "google": { + "id": 506814, + "user_id": "112239280424945704046", + "user_name": null + }, + "openstreetmap": { + "id": 444521, + "user_id": "2032310", + "user_name": "rummik" + }, "twitter": { - "id": 51466, + "id": 438246, "user_id": "214136763", - "user_name": "iotasamurai" + "user_name": "IotaSamurai" + }, + "venmo": { + "id": 532532, + "user_id": "1330493886824448047", + "user_name": "rummik" } }, - "giving": "1.61", - "goal": "250.00", + "giving": "0.00", "id": 16757, - "number": "singular", - "receiving": "18.25", + "ngiving_to": 0, + "ntaking_from": 0, + "on": "gratipay", + "taking": “12.34”, "username": "rummik" } \ No newline at end of file From 132e0f74e022712f83afb4244de79ddbc89cf641 Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 7 Feb 2016 14:01:43 -0600 Subject: [PATCH 03/39] Fix anonymous receiving Closes https://github.com/gratipay/grtp.co/issues/111. Not sure if there is a use case for anonymous anymore or not. Also fixed bad quotation mark. --- lib/v1/api.js | 3 ++- test/gratipay.com/rummik/public.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/v1/api.js b/lib/v1/api.js index 118137a..59fcb66 100644 --- a/lib/v1/api.js +++ b/lib/v1/api.js @@ -127,7 +127,8 @@ Gratipay.users.getPublic(username, function(data) { element.setAttribute('data-gratipay-readystatus', 'ready'); - text('receiving', (data.receiving)? '$' + data.receiving : 'anonymously'); + // If ~user versus team + text('receiving', (data.taking)? '$' + data.taking : '$' + data.receiving); text('username', data.username); text('my-tip-button', data.my_tip == 'self' ? 'You!' : (+data.my_tip > 0 ? data.my_tip : 'Gratipay')); // jshint ignore:line text('goal', '$' + data.goal); diff --git a/test/gratipay.com/rummik/public.json b/test/gratipay.com/rummik/public.json index f570691..a6cd1fd 100644 --- a/test/gratipay.com/rummik/public.json +++ b/test/gratipay.com/rummik/public.json @@ -50,6 +50,6 @@ "ngiving_to": 0, "ntaking_from": 0, "on": "gratipay", - "taking": “12.34”, + "taking": "12.34", "username": "rummik" } \ No newline at end of file From 8e6956203e709aef4da6557474cf466d8d55d9ae Mon Sep 17 00:00:00 2001 From: mattbk Date: Tue, 9 Feb 2016 09:46:56 -0600 Subject: [PATCH 04/39] Fix indents --- lib/v1/api.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/v1/api.js b/lib/v1/api.js index 59fcb66..b54eee9 100644 --- a/lib/v1/api.js +++ b/lib/v1/api.js @@ -128,7 +128,7 @@ Gratipay.users.getPublic(username, function(data) { element.setAttribute('data-gratipay-readystatus', 'ready'); // If ~user versus team - text('receiving', (data.taking)? '$' + data.taking : '$' + data.receiving); + text('receiving', (data.taking)? '$' + data.taking : '$' + data.receiving); text('username', data.username); text('my-tip-button', data.my_tip == 'self' ? 'You!' : (+data.my_tip > 0 ? data.my_tip : 'Gratipay')); // jshint ignore:line text('goal', '$' + data.goal); @@ -138,7 +138,7 @@ link('profile-link', gratipayURI + encodeURIComponent(data.username) + '/'); } else { link('profile-link', gratipayURI + encodeURIComponent(data.slug) + '/'); - } + } link('link', gratipayURI); css('goal-progress-bar', 'width:' + (data.receiving / data.goal * 100) + '%'); From bb98204d47add24527c5c9124bd50fea4bc3b762 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 11 Feb 2016 09:49:21 -0600 Subject: [PATCH 05/39] See if changing test title makes tests easier to read --- test/test_custom-widget.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_custom-widget.js b/test/test_custom-widget.js index e065fc4..f7c206c 100644 --- a/test/test_custom-widget.js +++ b/test/test_custom-widget.js @@ -1,6 +1,6 @@ module.exports = { - 'readystatus should be ready': function(test) { + 'custom-widget: readystatus should be ready': function(test) { test.open('http://localhost:9537/test/custom-widget.html') .waitFor(function() { return !!document.querySelector('[data-gratipay-readystatus="ready"]'); @@ -9,7 +9,7 @@ module.exports = { .done(); }, - 'it should fill the standard values': function(test) { + 'custom-widget: it should fill the standard values': function(test) { test.open('http://localhost:9537/test/custom-widget.html') .waitFor(function() { return !!document.querySelector('[data-gratipay-readystatus="ready"]'); From 1166a521db910d04af0a18f67efe1819e938254d Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 11 Feb 2016 11:10:59 -0600 Subject: [PATCH 06/39] Make title tests more specific This makes test results easier to read. --- test/test_custom-widget-legacy.js | 4 ++-- test/test_default-widget-anonymous.js | 4 ++-- test/test_default-widget-legacy.js | 4 ++-- test/test_default-widget.js | 4 ++-- test/test_expose-api-to-iframe.js | 2 +- test/test_giving-widget-anonymous.js | 4 ++-- test/test_giving-widget-legacy.js | 4 ++-- test/test_giving-widget.js | 4 ++-- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/test/test_custom-widget-legacy.js b/test/test_custom-widget-legacy.js index aea9773..3c2da21 100644 --- a/test/test_custom-widget-legacy.js +++ b/test/test_custom-widget-legacy.js @@ -1,6 +1,6 @@ module.exports = { - 'readystatus should be ready': function(test) { + 'custom-widget-legacy: readystatus should be ready': function(test) { test.open('http://localhost:9537/test/custom-widget-legacy.html') .waitFor(function() { return !!document.querySelector('[data-gratipay-readystatus="ready"]'); @@ -9,7 +9,7 @@ module.exports = { .done(); }, - 'it should fill the standard values': function(test) { + 'custom-widget-legacy: it should fill the standard values': function(test) { test.open('http://localhost:9537/test/custom-widget-legacy.html') .waitFor(function() { return !!document.querySelector('[data-gratipay-readystatus="ready"]'); diff --git a/test/test_default-widget-anonymous.js b/test/test_default-widget-anonymous.js index 0f9cf05..feae273 100644 --- a/test/test_default-widget-anonymous.js +++ b/test/test_default-widget-anonymous.js @@ -1,6 +1,6 @@ module.exports = { - 'readystatus should be ready': function(test) { + 'default-widget-anonymous: readystatus should be ready': function(test) { test.open('http://localhost:9537/test/default-widget-anonymous.html') .waitFor(function() { return !!document.querySelector('[data-gratipay-readystatus="ready"]'); @@ -9,7 +9,7 @@ module.exports = { .done(); }, - 'it should show anonymous receiving': function(test) { + 'default-widget-anonymous: it should show anonymous receiving': function(test) { test.open('http://localhost:9537/test/default-widget-anonymous.html') .waitFor(function() { return !!document.querySelector('[data-gratipay-readystatus="ready"]'); diff --git a/test/test_default-widget-legacy.js b/test/test_default-widget-legacy.js index 2efd5b2..e4452dd 100644 --- a/test/test_default-widget-legacy.js +++ b/test/test_default-widget-legacy.js @@ -1,6 +1,6 @@ module.exports = { - 'readystatus should be ready': function(test) { + 'default-widget-legacy: readystatus should be ready': function(test) { test.open('http://localhost:9537/test/default-widget-legacy.html') .waitFor(function() { return !!document.querySelector('[data-gratipay-readystatus="ready"]'); @@ -9,7 +9,7 @@ module.exports = { .done(); }, - 'it should fill the standard values': function(test) { + 'default-widget-legacy: it should fill the standard values': function(test) { test.open('http://localhost:9537/test/default-widget-legacy.html') .waitFor(function() { return !!document.querySelector('[data-gratipay-readystatus="ready"]'); diff --git a/test/test_default-widget.js b/test/test_default-widget.js index 17dc215..8476243 100644 --- a/test/test_default-widget.js +++ b/test/test_default-widget.js @@ -1,6 +1,6 @@ module.exports = { - 'readystatus should be ready': function(test) { + 'default-widget: readystatus should be ready': function(test) { test.open('http://localhost:9537/test/default-widget.html') .waitFor(function() { return !!document.querySelector('[data-gratipay-readystatus="ready"]'); @@ -9,7 +9,7 @@ module.exports = { .done(); }, - 'it should fill the standard values': function(test) { + 'default-widget: it should fill the standard values': function(test) { test.open('http://localhost:9537/test/default-widget.html') .waitFor(function() { return !!document.querySelector('[data-gratipay-readystatus="ready"]'); diff --git a/test/test_expose-api-to-iframe.js b/test/test_expose-api-to-iframe.js index f086ca4..8afdee9 100644 --- a/test/test_expose-api-to-iframe.js +++ b/test/test_expose-api-to-iframe.js @@ -1,6 +1,6 @@ module.exports = { - 'widget should have Gratipay defined': function(test) { + 'expose-api-to-iframe: widget should have Gratipay defined': function(test) { test.open('http://localhost:9537/test/expose-api-to-iframe.html') .waitFor(function() { return !!document.querySelector('[data-gratipay-readystatus="ready"]'); diff --git a/test/test_giving-widget-anonymous.js b/test/test_giving-widget-anonymous.js index 910d809..b4649e4 100644 --- a/test/test_giving-widget-anonymous.js +++ b/test/test_giving-widget-anonymous.js @@ -1,6 +1,6 @@ module.exports = { - 'readystatus should be ready': function(test) { + 'giving-widget-anonymous: readystatus should be ready': function(test) { test.open('http://localhost:9537/test/giving-widget-anonymous.html') .waitFor(function() { return !!document.querySelector('[data-gratipay-readystatus="ready"]'); @@ -9,7 +9,7 @@ module.exports = { .done(); }, - 'it should show anonymous giving': function(test) { + 'giving-widget-anonymous: it should show anonymous giving': function(test) { test.open('http://localhost:9537/test/giving-widget-anonymous.html') .waitFor(function() { return !!document.querySelector('[data-gratipay-readystatus="ready"]'); diff --git a/test/test_giving-widget-legacy.js b/test/test_giving-widget-legacy.js index dd243f7..97dd371 100644 --- a/test/test_giving-widget-legacy.js +++ b/test/test_giving-widget-legacy.js @@ -1,6 +1,6 @@ module.exports = { - 'readystatus should be ready': function(test) { + 'giving-widget-legacy: readystatus should be ready': function(test) { test.open('http://localhost:9537/test/giving-widget-legacy.html') .waitFor(function() { return !!document.querySelector('[data-gratipay-readystatus="ready"]'); @@ -9,7 +9,7 @@ module.exports = { .done(); }, - 'it should fill the standard values': function(test) { + 'giving-widget-legacy: it should fill the standard values': function(test) { test.open('http://localhost:9537/test/giving-widget-legacy.html') .waitFor(function() { return !!document.querySelector('[data-gratipay-readystatus="ready"]'); diff --git a/test/test_giving-widget.js b/test/test_giving-widget.js index f428242..847c681 100644 --- a/test/test_giving-widget.js +++ b/test/test_giving-widget.js @@ -1,6 +1,6 @@ module.exports = { - 'readystatus should be ready': function(test) { + 'giving-widget: readystatus should be ready': function(test) { test.open('http://localhost:9537/test/giving-widget.html') .waitFor(function() { return !!document.querySelector('[data-gratipay-readystatus="ready"]'); @@ -9,7 +9,7 @@ module.exports = { .done(); }, - 'it should fill the standard values': function(test) { + 'giving-widget: it should fill the standard values': function(test) { test.open('http://localhost:9537/test/giving-widget.html') .waitFor(function() { return !!document.querySelector('[data-gratipay-readystatus="ready"]'); From 17dace3d4def31ae5456be1613c584c02ebe79f7 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 11 Feb 2016 14:05:56 -0600 Subject: [PATCH 07/39] Update anon-user public.json --- test/gratipay.com/anon-user/public.json | 30 +++++++++++++++++++------ 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/test/gratipay.com/anon-user/public.json b/test/gratipay.com/anon-user/public.json index f16ee3b..4e82a99 100644 --- a/test/gratipay.com/anon-user/public.json +++ b/test/gratipay.com/anon-user/public.json @@ -1,19 +1,35 @@ { - "avatar": "https://avatars.githubusercontent.com/u/3893573?s=128", + "avatar": "https://avatars.githubusercontent.com/u/3893573?s=160", + "cryptocoins": { + "bitcoin": "3MNVEUyqYqnxF5jKBbfKRrWp5XYRDSjzDs" + }, "elsewhere": { + "bountysource": { + "id": 481481, + "user_id": "24752", + "user_name": null + }, "github": { "id": 205991, "user_id": "3893573", "user_name": "rohitpaulk" + }, + "google": { + "id": 476989, + "user_id": "103133617858201182649", + "user_name": "PaulKuruvilla" + }, + "twitter": { + "id": 473541, + "user_id": "1079733008", + "user_name": "RohitPaulK" } }, - "giving": null, - "goal": null, + "giving": "5.72", "id": 145878, - "my_tip": "self", - "npatrons": 0, - "number": "singular", + "ngiving_to": 24, + "ntaking_from": 0, "on": "gratipay", - "receiving": null, + "taking": "0.00", "username": "rohitpaulk" } \ No newline at end of file From ff9f7865fc4a15abaab4fddd5e5295eb143490af Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 11 Feb 2016 14:35:19 -0600 Subject: [PATCH 08/39] Remove anonymous receiving test There is no more anonymous receiving, only anonymous giving. --- test/test_default-widget-anonymous.js | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/test/test_default-widget-anonymous.js b/test/test_default-widget-anonymous.js index feae273..1a1cc7d 100644 --- a/test/test_default-widget-anonymous.js +++ b/test/test_default-widget-anonymous.js @@ -7,19 +7,6 @@ module.exports = { }, [], 2000) .assert.attr('[data-gratipay-username]', 'data-gratipay-readystatus').is('ready', 'readystatus should be ready') .done(); - }, - - 'default-widget-anonymous: it should show anonymous receiving': function(test) { - test.open('http://localhost:9537/test/default-widget-anonymous.html') - .waitFor(function() { - return !!document.querySelector('[data-gratipay-readystatus="ready"]'); - }, [], 2000) - .assert.exists('iframe') - .toFrame('iframe') - .assert.exists('.gratipay-receiving') - .assert.text('.gratipay-receiving').is('anonymously', 'receiving should not be empty') - .toParent() - .done(); - }, - + } + }; From 6efa3b85347c98e3f5bac7e666398e254762f6ed Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 12 Feb 2016 09:09:53 -0600 Subject: [PATCH 09/39] Change how anonymous giving is tested public.json now returns "null" rather than "anonymous". --- test/test_giving-widget-anonymous.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_giving-widget-anonymous.js b/test/test_giving-widget-anonymous.js index b4649e4..9392ee1 100644 --- a/test/test_giving-widget-anonymous.js +++ b/test/test_giving-widget-anonymous.js @@ -17,7 +17,7 @@ module.exports = { .assert.exists('iframe') .toFrame('iframe') .assert.exists('.gratipay-giving') - .assert.text('.gratipay-giving').is('anonymously', 'giving should not be empty') + .assert.text('.gratipay-giving').is('null', 'giving should not be empty') .toParent() .done(); }, From 92eb32280809d10f608721f2b48df7473d10003d Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 12 Feb 2016 09:56:06 -0600 Subject: [PATCH 10/39] Make anon-user giving anonymous Oops. --- test/gratipay.com/anon-user/public.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/gratipay.com/anon-user/public.json b/test/gratipay.com/anon-user/public.json index 4e82a99..09a5a18 100644 --- a/test/gratipay.com/anon-user/public.json +++ b/test/gratipay.com/anon-user/public.json @@ -25,7 +25,7 @@ "user_name": "RohitPaulK" } }, - "giving": "5.72", + "giving": null, "id": 145878, "ngiving_to": 24, "ntaking_from": 0, From 1b2d3af52c3f7c66d4ee5a134e92712402b4f568 Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 12 Feb 2016 10:45:37 -0600 Subject: [PATCH 11/39] Is 'null' null? --- test/test_giving-widget-anonymous.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_giving-widget-anonymous.js b/test/test_giving-widget-anonymous.js index 9392ee1..b06ea83 100644 --- a/test/test_giving-widget-anonymous.js +++ b/test/test_giving-widget-anonymous.js @@ -17,7 +17,7 @@ module.exports = { .assert.exists('iframe') .toFrame('iframe') .assert.exists('.gratipay-giving') - .assert.text('.gratipay-giving').is('null', 'giving should not be empty') + .assert.text('.gratipay-giving').is(null, 'giving should not be empty') .toParent() .done(); }, From 6a8b1e75fb857273b230e06cc2d0834f13edb0b0 Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 12 Feb 2016 10:46:49 -0600 Subject: [PATCH 12/39] Revert "Is 'null' null?" This reverts commit 1b2d3af52c3f7c66d4ee5a134e92712402b4f568. --- test/test_giving-widget-anonymous.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_giving-widget-anonymous.js b/test/test_giving-widget-anonymous.js index b06ea83..9392ee1 100644 --- a/test/test_giving-widget-anonymous.js +++ b/test/test_giving-widget-anonymous.js @@ -17,7 +17,7 @@ module.exports = { .assert.exists('iframe') .toFrame('iframe') .assert.exists('.gratipay-giving') - .assert.text('.gratipay-giving').is(null, 'giving should not be empty') + .assert.text('.gratipay-giving').is('null', 'giving should not be empty') .toParent() .done(); }, From 31f0c1dd9f9b4620fa401f7a8412465f1edfb2d8 Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 12 Feb 2016 10:47:48 -0600 Subject: [PATCH 13/39] Revert "Change how anonymous giving is tested" This reverts commit 6efa3b85347c98e3f5bac7e666398e254762f6ed. --- test/test_giving-widget-anonymous.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_giving-widget-anonymous.js b/test/test_giving-widget-anonymous.js index 9392ee1..b4649e4 100644 --- a/test/test_giving-widget-anonymous.js +++ b/test/test_giving-widget-anonymous.js @@ -17,7 +17,7 @@ module.exports = { .assert.exists('iframe') .toFrame('iframe') .assert.exists('.gratipay-giving') - .assert.text('.gratipay-giving').is('null', 'giving should not be empty') + .assert.text('.gratipay-giving').is('anonymously', 'giving should not be empty') .toParent() .done(); }, From 91bb2474bb3ac84a5d87851463c080fbcadd764a Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 12 Feb 2016 11:50:40 -0600 Subject: [PATCH 14/39] Comment out where I think the problem is Not sure what this line does, but making sure this is the kicker. --- lib/v1.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/v1.js b/lib/v1.js index d38ce69..37ff19f 100644 --- a/lib/v1.js +++ b/lib/v1.js @@ -44,7 +44,7 @@ _grtp.push(element); } - element.setAttribute('data-gratipay-readystatus', 'loading'); + // element.setAttribute('data-gratipay-readystatus', 'loading'); } } })(); From fd5b78966dc9ffe3c4357ca4e41f6d9a38292dbb Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 12 Feb 2016 12:56:42 -0600 Subject: [PATCH 15/39] Revert "Comment out where I think the problem is" This reverts commit 91bb2474bb3ac84a5d87851463c080fbcadd764a. --- lib/v1.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/v1.js b/lib/v1.js index 37ff19f..d38ce69 100644 --- a/lib/v1.js +++ b/lib/v1.js @@ -44,7 +44,7 @@ _grtp.push(element); } - // element.setAttribute('data-gratipay-readystatus', 'loading'); + element.setAttribute('data-gratipay-readystatus', 'loading'); } } })(); From b16b5828ecc0e682732f8fce8c0022f265fc85df Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 12 Feb 2016 13:55:25 -0600 Subject: [PATCH 16/39] Distinguish between loading states --- lib/v1.js | 2 +- lib/v1/api.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/v1.js b/lib/v1.js index d38ce69..be9f6bf 100644 --- a/lib/v1.js +++ b/lib/v1.js @@ -44,7 +44,7 @@ _grtp.push(element); } - element.setAttribute('data-gratipay-readystatus', 'loading'); + element.setAttribute('data-gratipay-readystatus', 'loading v1.js'); } } })(); diff --git a/lib/v1/api.js b/lib/v1/api.js index b54eee9..9158287 100644 --- a/lib/v1/api.js +++ b/lib/v1/api.js @@ -181,7 +181,7 @@ var username = element.getAttribute('data-gratipay-username') || element.getAttribute('data-gittip-username'); // Set a readystate on the element - element.setAttribute('data-gratipay-readystatus', 'loading'); + element.setAttribute('data-gratipay-readystatus', 'loading api.js'); // Skip to applying widget data if this is a custom/user-defined widget if (['false', 'none', 'user-defined', 'custom'].indexOf(widgetType.toLowerCase()) != -1) { From 11e4fe907a659dfa3721a995e574315d78d3738c Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 13 Feb 2016 17:42:05 -0600 Subject: [PATCH 17/39] Add temporary debug steps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I’m pretty lost here. --- lib/v1/api.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/v1/api.js b/lib/v1/api.js index 9158287..b6aa832 100644 --- a/lib/v1/api.js +++ b/lib/v1/api.js @@ -188,6 +188,8 @@ return Gratipay.widgets.apply(element); } + element.setAttribute('data-gratipay-readystatus', 'loading api.js step 1'); + // Get the widget (defined by widgetType) Gratipay.widgets.getWidget(widgetType, function(widget) { var container = _.jsonml(['iframe', { @@ -204,7 +206,7 @@ float: 'left' }] ]); - + element.setAttribute('data-gratipay-readystatus', 'loading api.js step 2'); // FireFox's