| 1 | define(["doh/runner"], function(doh) { |
| 2 | doh.register("doh/tearDownTest",[ |
| 3 | { |
| 4 | name: "sync_pass_teardown", |
| 5 | pass: 1, |
| 6 | runTest: function(){ |
| 7 | doh.debug("test sync_pass_teardown called"); |
| 8 | doh.t(this.pass,"teardown was called out of order???"); |
| 9 | doh.t(1); |
| 10 | }, |
| 11 | tearDown: function(){ |
| 12 | doh.debug("teardown sync_pass_teardown called"); |
| 13 | this.pass=0; |
| 14 | } |
| 15 | }, |
| 16 | { |
| 17 | name: "sync_fail_teardown", |
| 18 | pass: 1, |
| 19 | runTest: function(){ |
| 20 | doh.debug("test sync_fail_teardown called"); |
| 21 | doh.t(this.pass,"teardown was called out of order???"); |
| 22 | doh.t(0,"SHOULD FAIL with 'teardown sync_fail_teardown called' in log"); |
| 23 | }, |
| 24 | tearDown: function(){ |
| 25 | doh.debug("teardown sync_fail_teardown called"); |
| 26 | this.pass=0; |
| 27 | } |
| 28 | }, |
| 29 | { |
| 30 | name: "async_pass_teardown", |
| 31 | pass: 1, |
| 32 | runTest: function(){ |
| 33 | doh.debug("test async_pass_teardown called"); |
| 34 | var d = new doh.Deferred(); |
| 35 | var _this=this; |
| 36 | setTimeout(d.getTestCallback(function(){ |
| 37 | doh.t(_this.pass,"teardown was called out of order???"); |
| 38 | }),900); |
| 39 | return d; |
| 40 | }, |
| 41 | tearDown: function(){ |
| 42 | this.pass=0; |
| 43 | doh.debug("teardown async_pass_teardown called"); |
| 44 | } |
| 45 | }, |
| 46 | { |
| 47 | name: "async_fail_teardown", |
| 48 | pass: 1, |
| 49 | runTest: function(){ |
| 50 | doh.debug("test async_fail_teardown called"); |
| 51 | var d = new doh.Deferred(); |
| 52 | var _this=this; |
| 53 | setTimeout(d.getTestCallback(function(){ |
| 54 | doh.t(_this.pass,"teardown was called out of order???"); |
| 55 | doh.t(0,"SHOULD FAIL with 'teardown async_fail_teardown called' in log"); |
| 56 | }),900); |
| 57 | return d; |
| 58 | }, |
| 59 | tearDown: function(){ |
| 60 | doh.debug("teardown async_fail_teardown called"); |
| 61 | this.pass=0; |
| 62 | } |
| 63 | } |
| 64 | ]); |
| 65 | }); |