Skip to content

Commit 2b13100

Browse files
committed
Merge pull request #25 from tjokimie/support-size
Support size
2 parents 2f072f8 + 7a83704 commit 2b13100

File tree

3 files changed

+29
-8
lines changed

3 files changed

+29
-8
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,14 @@ Angular.JS wrapper for Google's No CAPTCHA reCAPTCHA. See demo at [http://codedi
5050
5151
## no-captcha element parameters
5252
53-
| Param | Type | Details |
54-
|----------------------|------------------------|--------------------------------------------------------------------|
55-
| g-recaptcha-response | Expression | Bind reCAPTCHA response token |
56-
| theme | String {light \| dark} | Optional. The color theme of the widget. Can be set also in config |
57-
| site-key | String | Optional. Your site key. Can be set also in config |
58-
| control | Expression | Optional. Object where reset-function will be injected |
59-
| expired-callback | Expression | Optional. Callback for expired event |
53+
| Param | Type | Details |
54+
|----------------------|----------------------------|--------------------------------------------------------------------|
55+
| g-recaptcha-response | Expression | Bind reCAPTCHA response token |
56+
| theme | String {light \| dark} | Optional. The color theme of the widget. Can be set also in config |
57+
| size | String {normal \| compact} | Optional. The size of the widget. Can be set also in config |
58+
| site-key | String | Optional. Your site key. Can be set also in config |
59+
| control | Expression | Optional. Object where reset-function will be injected |
60+
| expired-callback | Expression | Optional. Callback for expired event |
6061
6162
## Example
6263

src/angular-no-captcha.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,26 @@ angular
2424
}])
2525
.provider('noCAPTCHA', function noCaptchaProvider(){
2626
var siteKey,
27+
size,
2728
theme;
2829

2930
this.setSiteKey = function (_siteKey){
3031
siteKey = _siteKey;
3132
};
3233

34+
this.setSize = function (_size){
35+
size = _size;
36+
};
37+
3338
this.setTheme = function (_theme){
3439
theme = _theme;
3540
};
3641

3742
this.$get = [function noCaptchaFactory(){
3843
return {
3944
theme: theme,
40-
siteKey: siteKey
45+
siteKey: siteKey,
46+
size: size
4147
}
4248
}];
4349
})
@@ -74,6 +80,7 @@ angular
7480
scope: {
7581
gRecaptchaResponse: '=',
7682
siteKey: '@',
83+
size: '@',
7784
theme: '@',
7885
control: '=?',
7986
expiredCallback: '=?'
@@ -88,6 +95,7 @@ angular
8895

8996
grecaptchaCreateParameters = {
9097
sitekey: scope.siteKey || noCaptcha.siteKey,
98+
size: scope.size || noCaptcha.size,
9199
theme: scope.theme || noCaptcha.theme,
92100
callback: function (r){
93101
scope.$apply(function (){

tests/no-captcha.provider.test.mocha.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ describe('noCAPTCHA provider', function() {
2525
}]));
2626
});
2727

28+
describe('set site size', function() {
29+
var testSize = 'compact';
30+
31+
beforeEach(function() {
32+
noCAPTCHAProvider.setSize(testSize);
33+
});
34+
35+
it('should remember the value', inject(['noCAPTCHA', function(noCAPTCHA) {
36+
expect(noCAPTCHA.size).to.equal(testSize);
37+
}]));
38+
});
39+
2840
describe('set theme', function() {
2941
var theme = 'dark';
3042

0 commit comments

Comments
 (0)