|
28 | 28 | <title>Subtle Tests</title> |
29 | 29 | <link rel="stylesheet" href="vendor/qunit-1.23.1.css"> |
30 | 30 |
|
| 31 | + <style> |
| 32 | + #qunit-stop-button { |
| 33 | + margin-left: 0.5em; |
| 34 | + font: bold small Arial, Helvetica, sans-serif; |
| 35 | + color: #fff; |
| 36 | + background: #c0392b; |
| 37 | + border: none; |
| 38 | + border-radius: 3px; |
| 39 | + padding: 2px 10px; |
| 40 | + cursor: pointer; |
| 41 | + vertical-align: middle; |
| 42 | + } |
| 43 | + |
| 44 | + #qunit-stop-button:hover { |
| 45 | + background: #a93226; |
| 46 | + } |
| 47 | + |
| 48 | + #qunit-stop-button[disabled] { |
| 49 | + background: #b9b9b9; |
| 50 | + cursor: default; |
| 51 | + } |
| 52 | + </style> |
| 53 | + |
31 | 54 | </head> |
32 | 55 |
|
33 | 56 | <body style="background-color: gray"> |
|
36 | 59 | <div id="qunit-fixture"></div> |
37 | 60 | <script src="vendor/qunit-1.23.1.js"></script> |
38 | 61 |
|
39 | | - <script> |
40 | | - QUnit.config.autostart = false; |
41 | | - </script> |
42 | | - |
43 | 62 | <!-- load msrCrypto & ie11 wrapper by default --> |
44 | 63 | <script id="msrCrypto" type="text/javascript" src="../dist/msrcrypto.js"></script> |
45 | 64 |
|
|
83 | 102 | <script src="Test.ConcatKdf.js"></script> |
84 | 103 | <script src="Test.Errors.js"></script> |
85 | 104 |
|
86 | | - <input type="button" onclick="QUnit.start();"></input> |
| 105 | + <!-- test runner controls: stop the in-progress run --> |
| 106 | + <script> |
| 107 | + (function () { |
| 108 | + |
| 109 | + var button; |
| 110 | + |
| 111 | + function stopRun() { |
| 112 | + if (QUnit.config.queue) { |
| 113 | + QUnit.config.queue.length = 0; |
| 114 | + } |
| 115 | + button.disabled = true; |
| 116 | + } |
| 117 | + |
| 118 | + // QUnit only builds its toolbar (and module picker) when a run |
| 119 | + // begins, so add the Stop button to the toolbar at that point, |
| 120 | + // next to QUnit's native module picker. This begin callback runs |
| 121 | + // after QUnit's own (which builds the toolbar) because it is |
| 122 | + // registered later. |
| 123 | + QUnit.begin(function () { |
| 124 | + var container = document.getElementById("qunit-modulefilter-container") || |
| 125 | + document.getElementById("qunit-testrunner-toolbar"); |
| 126 | + if (container && !button) { |
| 127 | + button = document.createElement("button"); |
| 128 | + button.id = "qunit-stop-button"; |
| 129 | + button.type = "button"; |
| 130 | + button.innerHTML = "Stop"; |
| 131 | + // Abort the in-progress run by clearing QUnit's task queue. |
| 132 | + // QUnit's process loop halts once the queue is empty, |
| 133 | + // leaving the native UI (including its module picker) on |
| 134 | + // screen so a specific module can be selected and run next. |
| 135 | + button.onclick = stopRun; |
| 136 | + container.appendChild(button); |
| 137 | + } |
| 138 | + if (button) { |
| 139 | + button.disabled = false; |
| 140 | + } |
| 141 | + }); |
| 142 | + |
| 143 | + QUnit.done(function () { |
| 144 | + if (button) { |
| 145 | + button.disabled = true; |
| 146 | + } |
| 147 | + }); |
| 148 | + |
| 149 | + })(); |
| 150 | + </script> |
87 | 151 |
|
88 | 152 | </body> |
89 | 153 |
|
|
0 commit comments