Magix cjQuery, une bibliothèque php pour intégrer jQuery - Tag - fireunit
Magix cjQuery est une bibliothèque écrite en PHP 5.
Elle permet d’effectuer le contrôle de vos données échangé dans les champs de formulaire.
Elle peut être intégrée dans tout type de conception, et est compatible avec différents framework.
2009-12-04T23:01:33+01:00
gerits aurelien
urn:md5:fc9a43498ab43d68ba6c26764a7e06ac
Dotclear
tests unitaires avec javascript en utilisant fireunit
urn:md5:80aff637f4a579a823578dbe0061eb99
2009-08-02T00:46:00+02:00
aurelien gerits
tests et performances
fireunitmagix cjQueryoptimisation du codeperformances-javascripttests-unitairestutoriel magixcjQuery
<p><a href="https://magix-cjquery.com/tag/fireunit" hreflang="fr">FireUnit</a> est une extension Firefox crée par John Resig pour effectuer des <strong><a href="https://magix-cjquery.com/tag/tests-unitaires" hreflang="fr">tests unitaires</a> avec Javascript</strong>.<br />
Celui-ci dans la librairie pour faciliter les <strong><a href="https://magix-cjquery.com/tag/tests-unitaires" hreflang="fr">tests unitaires</a> avec Javascript</strong>.<br />
<img src="https://magix-cjquery.com/public/performances_jquery/qunit-jquery-test.png" alt="qunit-jquery-test.png" title="qunit-jquery-test.png, juil. 2009" /><br />
On peu désormais faire des tests sur divers critères dans l'addon de Firefox.</p> <h2>Pour utiliser les <a href="https://magix-cjquery.com/tag/tests-unitaires" hreflang="fr">tests unitaires</a> :</h2>
<ul>
<li>Télécharger l'<a href="http://fireunit.org/" hreflang="fr">extension pour Firefox</a></li>
<li>Instancier la class magixcjquery_jquery_fireunit</li>
<li>Utiliser les fonctions intégrée</li>
</ul>
<pre> <img src="https://magix-cjquery.com/public/performances_jquery/fireunit-addon.jpg" alt="fireunit-addon.jpg" title="fireunit-addon.jpg, juil. 2009" /><br /></pre>
<p>Pour aller plus loin, le complément qunit jQuery sera également intégré dans la librairie afin d'avoir les détails de vos tests.</p>
<h2>Un exemple simple :</h2>
<code class="PHP"><span style="color: #000000; font-weight: bold;">function</span> testUnit<span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #009900;">{</span> <br />
fireunit<span style="color: #339933;">::</span><span style="color: #004000;">iniTest</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span><br />
fireunit<span style="color: #339933;">::</span><span style="color: #004000;">ok</span><span style="color: #009900;">(</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'"test réussi"'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span><br />
fireunit<span style="color: #339933;">::</span><span style="color: #004000;">ok</span><span style="color: #009900;">(</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'"test échoué"'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span><br />
fireunit<span style="color: #339933;">::</span><span style="color: #004000;">browserEvent</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'click'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'"input"'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span><br />
fireunit<span style="color: #339933;">::</span><span style="color: #004000;">compare</span><span style="color: #009900;">(</span><span style="color: #0000ff;">'"expected data"'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'"expected data"'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'"Passing verification of expected and actual input."'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span><br />
fireunit<span style="color: #339933;">::</span><span style="color: #004000;">testDone</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <br />
<span style="color: #009900;">}</span></code>
<h3>En javascript</h3>
<code class="javascript"><span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">(</span><span style="color: #000066; font-weight: bold;">typeof</span> fireunit <span style="color: #339933;">==</span> <span style="color: #3366CC;">"undefined"</span> <span style="color: #339933;">&&</span> <span style="color: #000066; font-weight: bold;">typeof</span> fireunit <span style="color: #339933;">!==</span> <span style="color: #3366CC;">"object"</span><span style="color: #009900;">)</span><span style="color: #009900;">{</span><br />
<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">}</span><br />
fireunit.<span style="color: #660066;">ok</span><span style="color: #009900;">(</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span><span style="color: #3366CC;">"test réussi"</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span><br />
fireunit.<span style="color: #660066;">ok</span><span style="color: #009900;">(</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span><span style="color: #3366CC;">"test échoué"</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span><br />
fireunit.<span style="color: #660066;">click</span><span style="color: #009900;">(</span>$<span style="color: #009900;">(</span><span style="color: #3366CC;">"input"</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span><br />
fireunit.<span style="color: #660066;">compare</span><span style="color: #009900;">(</span><span style="color: #3366CC;">"expected data"</span><span style="color: #339933;">,</span><span style="color: #3366CC;">"expected data"</span><span style="color: #339933;">,</span><span style="color: #3366CC;">"Passing verification of expected and actual input."</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span><br />
setTimeout<span style="color: #009900;">(</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #009900;">{</span>fireunit.<span style="color: #660066;">testDone</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #009900;">}</span><span style="color: #339933;">,</span> 1000<span style="color: #009900;">)</span><span style="color: #339933;">;</span></code>
https://magix-cjquery.com/post/2009/08/02/tests-unitaires-avec-javascript-en-utilisant-fireunit#comment-form
https://magix-cjquery.com/feed/atom/comments/68