Forked from: Akiyah's QUnit sample diff(59) forked: QUnit sample cancer6 Follow 2012-01-10 23:41:20 License: MIT License Fork0 Fav1 View1748 Play Stop Reload Fullscreen Smart Phone Readme JavaScript 85 lines HTML 8 lines CSS 1 lines forked: QUnit sample jQuery v1.7.1 QUnit // forked from Akiyah's "QUnit sample" http://jsdo.it/Akiyah/497D $(function(){ module('sample1'); function hoge (x) { return x; }; test("example1", function() { hoge(10); ok( true, "all pass" ); }); test("example2", function() { _hoge(10); ok( true, "all pass" ); //_hoge()は無いので通らない }); module('sample2'); function hoge (x) { return x; }; test("example1", function(){ var ho = hoge(10); equals( 10, ho, "引数は10でした。" ); }); module('sample3'); asyncTest("asyncTest",function(){ stop(1000); //1000ms経っても$.getの応答がなかったら中断 var r = $.get('/'); r.done(function(e){ start(); console.log; ok(true,'success'); }); ok(true,'finish'); //中断しても実行される }); module('sample4'); test("even_test",function(){ //偶数を取ってきたい $.each([1,2,3,4,5,6], function(i){ var surplus = i%3; //間違えた! if(surplus === 0){ ok(true, 'This number is even!'); } }); expect(3); //テストの実行は2回しかされないので、不通過になる }); }); /*$(document).ready(function(){ test("a basic test example", function() { ok( true, "this test is fine" ); var value = "hello"; equals( "hello", value, "We expect value to be hello" ); }); module("Module A"); test("first test within module", function() { ok( true, "all pass" ); }); test("second test within module", function() { ok( true, "all pass" ); }); module("Module B"); test("some other test", function() { expect(2); equals( true, false, "failing test" ); equals( true, true, "passing test" ); }); }); */ <h1 id="qunit-header">QUnit example</h1> <h2 id="qunit-banner"></h2> <div id="qunit-testrunner-toolbar"></div> <h2 id="qunit-userAgent"></h2> <ol id="qunit-tests"></ol> <div id="qunit-fixture">test markup, will be hidden</div> forked: QUnit sample QUnit body { background-color: #DDDDDD; font: 30px sans-serif; } // forked from Akiyah's "QUnit sample" http://jsdo.it/Akiyah/497D $(function(){ module('sample1'); function hoge (x) { return x; }; test("example1", function() { hoge(10); ok( true, "all pass" ); }); test("example2", function() { _hoge(10); ok( true, "all pass" ); //_hoge()は無いので通らない }); module('sample2'); function hoge (x) { return x; }; test("example1", function(){ var ho = hoge(10); equals( 10, ho, "引数は10でした。" ); }); module('sample3'); asyncTest("asyncTest",function(){ stop(1000); //1000ms経っても$.getの応答がなかったら中断 var r = $.get('/'); r.done(function(e){ start(); console.log; ok(true,'success'); }); ok(true,'finish'); //中断しても実行される }); module('sample4'); test("even_test",function(){ //偶数を取ってきたい $.each([1,2,3,4,5,6], function(i){ var surplus = i%3; //間違えた! if(surplus === 0){ ok(true, 'This number is even!'); } }); expect(3); //テストの実行は2回しかされないので、不通過になる }); }); /*$(document).ready(function(){ test("a basic test example", function() { ok( true, "this test is fine" ); var value = "hello"; equals( "hello", value, "We expect value to be hello" ); }); module("Module A"); test("first test within module", function() { ok( true, "all pass" ); }); test("second test within module", function() { ok( true, "all pass" ); }); module("Module B"); test("some other test", function() { expect(2); equals( true, false, "failing test" ); equals( true, true, "passing test" ); }); }); */ <h1 id="qunit-header">QUnit example</h1> <h2 id="qunit-banner"></h2> <div id="qunit-testrunner-toolbar"></div> <h2 id="qunit-userAgent"></h2> <ol id="qunit-tests"></ol> <div id="qunit-fixture">test markup, will be hidden</div> body { background-color: #DDDDDD; font: 30px sans-serif; } use an iframe compat browser, deer Play on jsdo.it games Share Embed QR Tag Download Complete! Description どんなゲームですか? Control Device スマートフォンコントローラー jsdo.it WebSocket Controller» マウス キーボード タッチデバイス Fullscreen 有効 無効 jsdo.it games から削除する Submit Tweet style Design view Code view code <script type="text/javascript" src="http://jsdo.it/blogparts/gvyU/js?view=design"></script><p class="ttlBpJsdoit" style="width: 465px; margin: 0; text-align: right; font-size: 11px;"><a href="http://jsdo.it/cancer6/gvyU" title="forked: QUnit sample">forked: QUnit sample - jsdo.it - share JavaScript, HTML5 and CSS</a></p> QUnit sample Tweet twitter Tags QUnit sample Favorite by .rapmon