✨ Story 5.6: feedback utilisateur
This commit is contained in:
19
tests/contact-submit.test.php
Normal file
19
tests/contact-submit.test.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
function assertTrue($cond, $msg) {
|
||||
if (!$cond) {
|
||||
fwrite(STDERR, $msg . PHP_EOL);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$content = file_get_contents(__DIR__ . '/../assets/js/contact-form.js');
|
||||
|
||||
assertTrue(strpos($content, 'class ContactFormSubmit') !== false, 'missing ContactFormSubmit');
|
||||
assertTrue(strpos($content, 'fetch(') !== false, 'missing fetch');
|
||||
assertTrue(strpos($content, 'submit-text') !== false, 'missing submit-text');
|
||||
assertTrue(strpos($content, 'submit-loading') !== false, 'missing submit-loading');
|
||||
assertTrue(strpos($content, 'setLoadingState') !== false, 'missing loading state');
|
||||
assertTrue(strpos($content, 'formSuccess') !== false, 'missing formSuccess dispatch');
|
||||
assertTrue(strpos($content, 'AppState.clearFormData') !== false, 'missing localStorage clear');
|
||||
|
||||
fwrite(STDOUT, "OK\n");
|
||||
@@ -41,6 +41,11 @@ assertTrue(strpos($content, 'data-error="objet"') !== false, 'missing objet erro
|
||||
assertTrue(strpos($content, 'data-error="message"') !== false, 'missing message error');
|
||||
assertTrue(strpos($content, 'id="submit-btn"') !== false, 'missing submit id');
|
||||
assertTrue(strpos($content, 'id="clear-form-btn"') !== false, 'missing clear button id');
|
||||
assertTrue(strpos($content, 'id="submit-text"') !== false, 'missing submit text');
|
||||
assertTrue(strpos($content, 'id="submit-loading"') !== false, 'missing submit loading');
|
||||
assertTrue(strpos($content, 'id="success-message"') !== false, 'missing success message');
|
||||
assertTrue(strpos($content, 'id="error-message"') !== false, 'missing error message');
|
||||
assertTrue(strpos($content, 'id="error-text"') !== false, 'missing error text');
|
||||
assertTrue(strpos($content, '/assets/js/state.js') !== false, 'missing state script');
|
||||
assertTrue(strpos($content, '/assets/js/contact-form.js') !== false, 'missing contact script');
|
||||
|
||||
|
||||
@@ -25,4 +25,5 @@ php (Join-Path $here 'contact-validation.test.php')
|
||||
php (Join-Path $here 'contact-state.test.php')
|
||||
php (Join-Path $here 'recaptcha.test.php')
|
||||
php (Join-Path $here 'contact-api.test.php')
|
||||
php (Join-Path $here 'contact-submit.test.php')
|
||||
'OK'
|
||||
|
||||
Reference in New Issue
Block a user