@@ -107,20 +107,23 @@ public function testHtmlFormSnippetOverridesDefaultAttributes()
107
107
{
108
108
109
109
$ html_snippet = \recaptcha ()->htmlFormSnippet ([
110
- "theme " => "dark " ,
111
- "size " => "compact " ,
112
- "tabindex " => "2 " ,
113
- "callback " => "callbackFunction " ,
114
- "expired-callback " => "expiredCallbackFunction " ,
115
- "error-callback " => "errorCallbackFunction " ,
110
+ "theme " => "light " ,
111
+ "size " => "normal " ,
112
+ "tabindex " => "3 " ,
113
+ "callback " => "callbackFunctionNew " ,
114
+ "expired-callback " => "expiredCallbackFunctionNew " ,
115
+ "error-callback " => "errorCallbackFunctionNew " ,
116
116
"not-allowed-attribute " => "error " ,
117
117
]);
118
118
$ this ->assertEquals (
119
- '<div class="g-recaptcha" data-callback="callbackFunction " data-error-callback="errorCallbackFunction " data-expired-callback="expiredCallbackFunction " data-sitekey="api_site_key" data-size="compact " data-tabindex="2 " data-theme="dark " id="recaptcha-element"></div> ' ,
119
+ '<div class="g-recaptcha" data-callback="callbackFunctionNew " data-error-callback="errorCallbackFunctionNew " data-expired-callback="expiredCallbackFunctionNew " data-sitekey="api_site_key" data-size="normal " data-tabindex="3 " data-theme="light " id="recaptcha-element"></div> ' ,
120
120
$ html_snippet
121
121
);
122
122
}
123
123
124
+ /**
125
+ * @test
126
+ */
124
127
public function testCleanAttributesReturnsOnlyAllowedAttributes ()
125
128
{
126
129
$ attributes = ReCaptchaBuilderV2::cleanAttributes ([
@@ -141,6 +144,22 @@ public function testCleanAttributesReturnsOnlyAllowedAttributes()
141
144
$ this ->assertArrayNotHasKey ("not-allowed-attribute " , $ attributes );
142
145
}
143
146
147
+ /**
148
+ * @test
149
+ */
150
+ public function testHtmlFormSnippetKeepsDefaultConfigValuesUnlessOtherwiseStated ()
151
+ {
152
+ $ html_snippet = \recaptcha ()->htmlFormSnippet ([
153
+ 'callback ' => 'callbackFunction ' ,
154
+ 'expired-callback ' => 'expiredCallbackFunction ' ,
155
+ 'error-callback ' => 'errorCallbackFunction ' ,
156
+ ]);
157
+ $ this ->assertEquals (
158
+ '<div class="g-recaptcha" data-callback="callbackFunction" data-error-callback="errorCallbackFunction" data-expired-callback="expiredCallbackFunction" data-sitekey="api_site_key" data-size="compact" data-tabindex="2" data-theme="dark" id="recaptcha-element"></div> ' ,
159
+ $ html_snippet
160
+ );
161
+ }
162
+
144
163
/**
145
164
* Define environment setup.
146
165
*
0 commit comments