| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 704a3ec commit 6631415
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -262,7 +262,7 @@ <h2>Options button</h2> | |||
| 262 | 262 | data-name="Buy now!" | |
| 263 | 263 | data-amount="1.00" | |
| 264 | 264 | data-option0="Color=Blue:8.00,Green:12.00,Red:10.00" | |
| 265 | - data-option1="Size=Small,Medium,Large" | ||
| 265 | + data-option1="Size=Tiny,Small,Medium,Large,X-Large" | ||
| 266 | 266 | > | |
| 267 | 267 | </script> | |
| 268 | 268 | </div> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,9 @@ | |||
| 1 | 1 | /*jshint node:true, evil:true */ | |
| 2 | 2 | /*global describe:true, it:true, paypal:true, document:true, window:true, before:true, beforeEach:true */ | |
| 3 | 3 | ||
| 4 | + 'use strict'; | ||
| 5 | + | ||
| 6 | + | ||
| 4 | 7 | if (typeof window === 'undefined') { | |
| 5 | 8 | var fs = require('fs'), | |
| 6 | 9 | should = require('should'), | |
@@ -16,8 +19,6 @@ if (typeof window === 'undefined') { | |||
| 16 | 19 | // Test the object's integrity | |
| 17 | 20 | describe('JavaScript API', function () { | |
| 18 | 21 | ||
| 19 | - 'use strict'; | ||
| 20 | - | ||
| 21 | 22 | var namespace; | |
| 22 | 23 | ||
| 23 | 24 | before(function () { | |
@@ -44,8 +45,6 @@ describe('JavaScript API', function () { | |||
| 44 | 45 | // Test the buttons counter object | |
| 45 | 46 | describe('Test page button counter', function () { | |
| 46 | 47 | ||
| 47 | - 'use strict'; | ||
| 48 | - | ||
| 49 | 48 | var buttons; | |
| 50 | 49 | ||
| 51 | 50 | before(function () { | |
@@ -73,8 +72,6 @@ describe('Test page button counter', function () { | |||
| 73 | 72 | // Test environments | |
| 74 | 73 | describe('Environments', function () { | |
| 75 | 74 | ||
| 76 | - 'use strict'; | ||
| 77 | - | ||
| 78 | 75 | var sandbox, www; | |
| 79 | 76 | ||
| 80 | 77 | before(function () { | |
@@ -95,7 +92,6 @@ describe('Environments', function () { | |||
| 95 | 92 | ||
| 96 | 93 | // Test different forms | |
| 97 | 94 | describe('Form factors', function () { | |
| 98 | - 'use strict'; | ||
| 99 | 95 | ||
| 100 | 96 | it('Should produce a valid form', function () { | |
| 101 | 97 | document.querySelectorAll('#buynow-sm form').length.should.equal(1); | |
@@ -115,8 +111,6 @@ describe('Form factors', function () { | |||
| 115 | 111 | // Test editable fields | |
| 116 | 112 | describe('Editable buttons', function () { | |
| 117 | 113 | ||
| 118 | - 'use strict'; | ||
| 119 | - | ||
| 120 | 114 | var inputs; | |
| 121 | 115 | ||
| 122 | 116 | before(function () { | |
@@ -132,19 +126,19 @@ describe('Editable buttons', function () { | |||
| 132 | 126 | }); | |
| 133 | 127 | ||
| 134 | 128 | it('Should have a CSS class on the label', function () { | |
| 135 | - inputs[0].parentNode.children[0].className.should.include('paypal-label'); | ||
| 129 | + inputs[0].parentNode.className.should.include('paypal-label'); | ||
| 136 | 130 | }); | |
| 137 | 131 | ||
| 138 | 132 | it('Should have proper labels', function () { | |
| 139 | 133 | var labels = document.querySelectorAll('#buynow-editable label'); | |
| 140 | 134 | ||
| 141 | - labels[0].textContent.should.equal('Item'); | ||
| 142 | - labels[1].textContent.should.equal('Amount'); | ||
| 143 | - labels[2].textContent.should.equal('Quantity'); | ||
| 135 | + labels[0].textContent.replace(/^\s+/, '').replace(/\s+$/, '').should.equal('Item'); | ||
| 136 | + labels[1].textContent.replace(/^\s+/, '').replace(/\s+$/, '').should.equal('Amount'); | ||
| 137 | + labels[2].textContent.replace(/^\s+/, '').replace(/\s+$/, '').should.equal('Quantity'); | ||
| 144 | 138 | }); | |
| 145 | 139 | ||
| 146 | 140 | it('Should have a CSS class on the container', function () { | |
| 147 | - inputs[0].parentNode.className.should.include('paypal-group'); | ||
| 141 | + inputs[0].parentNode.parentNode.className.should.include('paypal-group'); | ||
| 148 | 142 | }); | |
| 149 | 143 | ||
| 150 | 144 | }); | |
@@ -153,8 +147,6 @@ describe('Editable buttons', function () { | |||
| 153 | 147 | // Test multi-language support | |
| 154 | 148 | describe('Multi-language button images', function () { | |
| 155 | 149 | ||
| 156 | - 'use strict'; | ||
| 157 | - | ||
| 158 | 150 | function testLanguage(locale, type, expected) { | |
| 159 | 151 | it('Should have a ' + locale + ' version of the ' + type + ' button', function () { | |
| 160 | 152 | var button = document.querySelector('#' + type + '-' + locale + ' button[type=submit] .paypal-button-content'), | |
@@ -173,8 +165,6 @@ describe('Multi-language button images', function () { | |||
| 173 | 165 | // Test multiple button image sizes | |
| 174 | 166 | describe('Multiple button image sizes', function () { | |
| 175 | 167 | ||
| 176 | - 'use strict'; | ||
| 177 | - | ||
| 178 | 168 | function testSize(size, type, expected) { | |
| 179 | 169 | it('Should have a ' + size + ' version of ' + type + ' button', function () { | |
| 180 | 170 | var button = document.querySelector('#' + type + '-' + size + ' button[type=submit]'), | |
@@ -205,8 +195,6 @@ describe('Multiple button image sizes', function () { | |||
| 205 | 195 | // Test button styles | |
| 206 | 196 | describe('Styled buttons', function () { | |
| 207 | 197 | ||
| 208 | - 'use strict'; | ||
| 209 | - | ||
| 210 | 198 | var primary, secondary; | |
| 211 | 199 | ||
| 212 | 200 | before(function () { | |
@@ -223,3 +211,27 @@ describe('Styled buttons', function () { | |||
| 223 | 211 | }); | |
| 224 | 212 | ||
| 225 | 213 | }); | |
| 214 | + | ||
| 215 | + | ||
| 216 | + describe('Options buttons', function () { | ||
| 217 | + var form = document.getElementById('button-options'); | ||
| 218 | + var selects = form.getElementsByTagName('select'); | ||
| 219 | + | ||
| 220 | + it('Should have two selects', function () { | ||
| 221 | + selects.length.should.equal(2); | ||
| 222 | + }); | ||
| 223 | + | ||
| 224 | + it('Should have the right number of options per select', function () { | ||
| 225 | + selects[0].options.length.should.equal(3); | ||
| 226 | + selects[1].options.length.should.equal(5); | ||
| 227 | + }); | ||
| 228 | + | ||
| 229 | + it('Should have the right values per options', function () { | ||
| 230 | + selects[0].options[0].textContent.should.equal('Blue 8.00'); | ||
| 231 | + selects[0].options[0].value.should.equal('Blue'); | ||
| 232 | + | ||
| 233 | + selects[1].options[0].textContent.should.equal('Tiny'); | ||
| 234 | + selects[1].options[0].value.should.equal('Tiny'); | ||
| 235 | + }); | ||
| 236 | + | ||
| 237 | + }); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments