SUnit.deploy.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749
  1. smalltalk.addClass('TestCase', smalltalk.Object, ['testedClass'], 'SUnit');
  2. smalltalk.addMethod(
  3. '_testedClass',
  4. smalltalk.method({
  5. selector: 'testedClass',
  6. fn: function (){
  7. var self=this;
  8. return self['@testedClass'];
  9. return self;}
  10. }),
  11. smalltalk.TestCase);
  12. smalltalk.addMethod(
  13. '_testedClass_',
  14. smalltalk.method({
  15. selector: 'testedClass:',
  16. fn: function (aClass){
  17. var self=this;
  18. self['@testedClass']=aClass;
  19. return self;}
  20. }),
  21. smalltalk.TestCase);
  22. smalltalk.addMethod(
  23. '_cleanUpInstanceVariables',
  24. smalltalk.method({
  25. selector: 'cleanUpInstanceVariables',
  26. fn: function (){
  27. var self=this;
  28. smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_instanceVariableNames", []), "_do_", [(function(name){return smalltalk.send(smalltalk.send(name, "__eq", ["testSelector"]), "_ifFalse_", [(function(){return smalltalk.send(self, "_instVarAt_put_", [name, nil]);})]);})]);
  29. return self;}
  30. }),
  31. smalltalk.TestCase);
  32. smalltalk.addMethod(
  33. '_signalFailure_',
  34. smalltalk.method({
  35. selector: 'signalFailure:',
  36. fn: function (aString){
  37. var self=this;
  38. (function($rec){smalltalk.send($rec, "_messageText_", [aString]);return smalltalk.send($rec, "_signal", []);})(smalltalk.send(smalltalk.TestFailure, "_new", []));
  39. return self;}
  40. }),
  41. smalltalk.TestCase);
  42. smalltalk.addMethod(
  43. '_setUp',
  44. smalltalk.method({
  45. selector: 'setUp',
  46. fn: function (){
  47. var self=this;
  48. return self;}
  49. }),
  50. smalltalk.TestCase);
  51. smalltalk.addMethod(
  52. '_tearDown',
  53. smalltalk.method({
  54. selector: 'tearDown',
  55. fn: function (){
  56. var self=this;
  57. return self;}
  58. }),
  59. smalltalk.TestCase);
  60. smalltalk.addMethod(
  61. '_methods',
  62. smalltalk.method({
  63. selector: 'methods',
  64. fn: function (){
  65. var self=this;
  66. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_methodDictionary", []), "_keys", []), "_select_", [(function(each){return smalltalk.send(each, "_match_", [unescape("%5Etest")]);})]);
  67. return self;}
  68. }),
  69. smalltalk.TestCase);
  70. smalltalk.addMethod(
  71. '_runCaseFor_',
  72. smalltalk.method({
  73. selector: 'runCaseFor:',
  74. fn: function (aTestResult){
  75. var self=this;
  76. smalltalk.send((function(){smalltalk.send(self, "_setUp", []);return smalltalk.send(self, "_performTestFor_", [aTestResult]);}), "_on_do_", [smalltalk.Error, (function(ex){smalltalk.send(self, "_tearDown", []);smalltalk.send(self, "_cleanUpInstanceVariables", []);return smalltalk.send(ex, "_signal", []);})]);
  77. smalltalk.send(self, "_tearDown", []);
  78. smalltalk.send(self, "_cleanUpInstanceVariables", []);
  79. return self;}
  80. }),
  81. smalltalk.TestCase);
  82. smalltalk.addMethod(
  83. '_performTestFor_',
  84. smalltalk.method({
  85. selector: 'performTestFor:',
  86. fn: function (aResult){
  87. var self=this;
  88. smalltalk.send(smalltalk.send(self, "_methods", []), "_do_", [(function(each){smalltalk.send((function(){return smalltalk.send((function(){return smalltalk.send(self, "_perform_", [each]);}), "_on_do_", [smalltalk.TestFailure, (function(ex){return smalltalk.send(aResult, "_addFailure_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_name", []), "__comma", [unescape("%3E%3E")]), "__comma", [each]), "__comma", [": "]), "__comma", [smalltalk.send(ex, "_messageText", [])])]);})]);}), "_on_do_", [smalltalk.Error, (function(ex){return smalltalk.send(aResult, "_addError_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_name", []), "__comma", [unescape("%3E%3E")]), "__comma", [each]), "__comma", [": "]), "__comma", [smalltalk.send(ex, "_messageText", [])])]);})]);return smalltalk.send(aResult, "_increaseRuns", []);})]);
  89. return self;}
  90. }),
  91. smalltalk.TestCase);
  92. smalltalk.addMethod(
  93. '_assert_',
  94. smalltalk.method({
  95. selector: 'assert:',
  96. fn: function (aBoolean){
  97. var self=this;
  98. smalltalk.send(self, "_assert_description_", [aBoolean, "Assertion failed"]);
  99. return self;}
  100. }),
  101. smalltalk.TestCase);
  102. smalltalk.addMethod(
  103. '_deny_',
  104. smalltalk.method({
  105. selector: 'deny:',
  106. fn: function (aBoolean){
  107. var self=this;
  108. smalltalk.send(self, "_assert_", [smalltalk.send(aBoolean, "_not", [])]);
  109. return self;}
  110. }),
  111. smalltalk.TestCase);
  112. smalltalk.addMethod(
  113. '_assert_equals_',
  114. smalltalk.method({
  115. selector: 'assert:equals:',
  116. fn: function (expected, actual){
  117. var self=this;
  118. return smalltalk.send(self, "_assert_description_", [smalltalk.send(expected, "__eq", [actual]), smalltalk.send(smalltalk.send(smalltalk.send("Expected: ", "__comma", [smalltalk.send(expected, "_asString", [])]), "__comma", [" but was: "]), "__comma", [smalltalk.send(actual, "_asString", [])])]);
  119. return self;}
  120. }),
  121. smalltalk.TestCase);
  122. smalltalk.addMethod(
  123. '_assert_description_',
  124. smalltalk.method({
  125. selector: 'assert:description:',
  126. fn: function (aBoolean, aString){
  127. var self=this;
  128. smalltalk.send(aBoolean, "_ifFalse_", [(function(){return smalltalk.send(self, "_signalFailure_", [aString]);})]);
  129. return self;}
  130. }),
  131. smalltalk.TestCase);
  132. smalltalk.addClass('ProgressBar', smalltalk.TabWidget, ['percent', 'progressDiv', 'div'], 'SUnit');
  133. smalltalk.addMethod(
  134. '_percent',
  135. smalltalk.method({
  136. selector: 'percent',
  137. fn: function (){
  138. var self=this;
  139. return smalltalk.send(self['@percent'], "_ifNil_", [(function(){return (0);})]);
  140. return self;}
  141. }),
  142. smalltalk.ProgressBar);
  143. smalltalk.addMethod(
  144. '_percent_',
  145. smalltalk.method({
  146. selector: 'percent:',
  147. fn: function (aNumber){
  148. var self=this;
  149. self['@percent']=aNumber;
  150. return self;}
  151. }),
  152. smalltalk.ProgressBar);
  153. smalltalk.addMethod(
  154. '_renderOn_',
  155. smalltalk.method({
  156. selector: 'renderOn:',
  157. fn: function (html){
  158. var self=this;
  159. self['@div']=(function($rec){smalltalk.send($rec, "_class_", ["progress_bar"]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(html, "_div", []));
  160. smalltalk.send(self, "_renderProgressBar", []);
  161. return self;}
  162. }),
  163. smalltalk.ProgressBar);
  164. smalltalk.addMethod(
  165. '_updatePercent_',
  166. smalltalk.method({
  167. selector: 'updatePercent:',
  168. fn: function (aNumber){
  169. var self=this;
  170. smalltalk.send(self, "_percent_", [aNumber]);
  171. smalltalk.send(self, "_renderProgressBar", []);
  172. return self;}
  173. }),
  174. smalltalk.ProgressBar);
  175. smalltalk.addMethod(
  176. '_renderProgressBar',
  177. smalltalk.method({
  178. selector: 'renderProgressBar',
  179. fn: function (){
  180. var self=this;
  181. smalltalk.send(self['@div'], "_contents_", [(function(html){return (function($rec){smalltalk.send($rec, "_class_", ["progress"]);return smalltalk.send($rec, "_style_", [smalltalk.send(smalltalk.send("width:", "__comma", [smalltalk.send(smalltalk.send(self, "_percent", []), "_asString", [])]), "__comma", [unescape("%25")])]);})(smalltalk.send(html, "_div", []));})]);
  182. return self;}
  183. }),
  184. smalltalk.ProgressBar);
  185. smalltalk.addClass('TestFailure', smalltalk.Error, [], 'SUnit');
  186. smalltalk.addClass('TestRunner', smalltalk.TabWidget, ['selectedCategories', 'categoriesList', 'selectedClasses', 'classesList', 'selectedMethods', 'progressBar', 'methodsList', 'result', 'statusDiv'], 'SUnit');
  187. smalltalk.addMethod(
  188. '_label',
  189. smalltalk.method({
  190. selector: 'label',
  191. fn: function (){
  192. var self=this;
  193. return unescape("%5BTest%20runner%5D");
  194. return self;}
  195. }),
  196. smalltalk.TestRunner);
  197. smalltalk.addMethod(
  198. '_categories',
  199. smalltalk.method({
  200. selector: 'categories',
  201. fn: function (){
  202. var self=this;
  203. var categories=nil;
  204. categories=smalltalk.send(smalltalk.Array, "_new", []);
  205. smalltalk.send(smalltalk.send(self, "_allClasses", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send(categories, "_includes_", [smalltalk.send(each, "_category", [])]), "_ifFalse_", [(function(){return smalltalk.send(categories, "_add_", [smalltalk.send(each, "_category", [])]);})]);})]);
  206. return smalltalk.send(categories, "_sort", []);
  207. return self;}
  208. }),
  209. smalltalk.TestRunner);
  210. smalltalk.addMethod(
  211. '_classes',
  212. smalltalk.method({
  213. selector: 'classes',
  214. fn: function (){
  215. var self=this;
  216. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_allClasses", []), "_select_", [(function(each){return smalltalk.send(smalltalk.send(self, "_selectedCategories", []), "_includes_", [smalltalk.send(each, "_category", [])]);})]), "_sort_", [(function(a, b){return smalltalk.send(smalltalk.send(a, "_name", []), "__gt", [smalltalk.send(b, "_name", [])]);})]);
  217. return self;}
  218. }),
  219. smalltalk.TestRunner);
  220. smalltalk.addMethod(
  221. '_selectedCategories',
  222. smalltalk.method({
  223. selector: 'selectedCategories',
  224. fn: function (){
  225. var self=this;
  226. return smalltalk.send(self['@selectedCategories'], "_ifNil_", [(function(){return self['@selectedCategories']=smalltalk.send(smalltalk.Array, "_new", []);})]);
  227. return self;}
  228. }),
  229. smalltalk.TestRunner);
  230. smalltalk.addMethod(
  231. '_allClasses',
  232. smalltalk.method({
  233. selector: 'allClasses',
  234. fn: function (){
  235. var self=this;
  236. return smalltalk.send(smalltalk.TestCase, "_allSubclasses", []);
  237. return self;}
  238. }),
  239. smalltalk.TestRunner);
  240. smalltalk.addMethod(
  241. '_selectedClasses',
  242. smalltalk.method({
  243. selector: 'selectedClasses',
  244. fn: function (){
  245. var self=this;
  246. return smalltalk.send(self['@selectedClasses'], "_ifNil_", [(function(){return self['@selectedClasses']=smalltalk.send(smalltalk.Array, "_new", []);})]);
  247. return self;}
  248. }),
  249. smalltalk.TestRunner);
  250. smalltalk.addMethod(
  251. '_progressBar',
  252. smalltalk.method({
  253. selector: 'progressBar',
  254. fn: function (){
  255. var self=this;
  256. return smalltalk.send(self['@progressBar'], "_ifNil_", [(function(){return self['@progressBar']=smalltalk.send(smalltalk.ProgressBar, "_new", []);})]);
  257. return self;}
  258. }),
  259. smalltalk.TestRunner);
  260. smalltalk.addMethod(
  261. '_selectedMethods',
  262. smalltalk.method({
  263. selector: 'selectedMethods',
  264. fn: function (){
  265. var self=this;
  266. return smalltalk.send(self['@selectedMethods'], "_ifNil_", [(function(){return smalltalk.send(smalltalk.send(self, "_selectedClasses", []), "_collect_", [(function(each){return smalltalk.send(smalltalk.send(smalltalk.send(each, "_methodDictionary", []), "_keys", []), "_select_", [(function(key){return smalltalk.send(key, "_beginsWith_", ["test"]);})]);})]);})]);
  267. return self;}
  268. }),
  269. smalltalk.TestRunner);
  270. smalltalk.addMethod(
  271. '_statusInfo',
  272. smalltalk.method({
  273. selector: 'statusInfo',
  274. fn: function (){
  275. var self=this;
  276. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_printTotal", []), "__comma", [smalltalk.send(self, "_printPasses", [])]), "__comma", [smalltalk.send(self, "_printErrors", [])]), "__comma", [smalltalk.send(self, "_printFailures", [])]);
  277. return self;}
  278. }),
  279. smalltalk.TestRunner);
  280. smalltalk.addMethod(
  281. '_result',
  282. smalltalk.method({
  283. selector: 'result',
  284. fn: function (){
  285. var self=this;
  286. return self['@result'];
  287. return self;}
  288. }),
  289. smalltalk.TestRunner);
  290. smalltalk.addMethod(
  291. '_failedMethods',
  292. smalltalk.method({
  293. selector: 'failedMethods',
  294. fn: function (){
  295. var self=this;
  296. smalltalk.send(smalltalk.send(smalltalk.send(self, "_result", []), "_failures", []), "_collect_", [(function(each){return (function($rec){smalltalk.send($rec, "_class_", ["failures"]);return smalltalk.send($rec, "_with_", [each]);})(smalltalk.send(html, "_li", []));})]);
  297. return self;}
  298. }),
  299. smalltalk.TestRunner);
  300. smalltalk.addMethod(
  301. '_selectAllCategories',
  302. smalltalk.method({
  303. selector: 'selectAllCategories',
  304. fn: function (){
  305. var self=this;
  306. smalltalk.send(smalltalk.send(self, "_categories", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send(self['@selectedCategories'], "_includes_", [each]), "_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(self, "_selectedCategories", []), "_add_", [each]);})]);})]);
  307. (function($rec){smalltalk.send($rec, "_updateCategoriesList", []);return smalltalk.send($rec, "_updateClassesList", []);})(self);
  308. return self;}
  309. }),
  310. smalltalk.TestRunner);
  311. smalltalk.addMethod(
  312. '_toggleCategory_',
  313. smalltalk.method({
  314. selector: 'toggleCategory:',
  315. fn: function (aCategory){
  316. var self=this;
  317. smalltalk.send(smalltalk.send(self, "_isSelectedCategory_", [aCategory]), "_ifFalse_ifTrue_", [(function(){return smalltalk.send(self['@selectedCategories'], "_add_", [aCategory]);}), (function(){return smalltalk.send(self['@selectedCategories'], "_remove_", [aCategory]);})]);
  318. (function($rec){smalltalk.send($rec, "_updateCategoriesList", []);return smalltalk.send($rec, "_updateClassesList", []);})(self);
  319. return self;}
  320. }),
  321. smalltalk.TestRunner);
  322. smalltalk.addMethod(
  323. '_toggleClass_',
  324. smalltalk.method({
  325. selector: 'toggleClass:',
  326. fn: function (aClass){
  327. var self=this;
  328. smalltalk.send(smalltalk.send(self, "_isSelectedClass_", [aClass]), "_ifFalse_ifTrue_", [(function(){return smalltalk.send(self['@selectedClasses'], "_add_", [aClass]);}), (function(){return smalltalk.send(self['@selectedClasses'], "_remove_", [aClass]);})]);
  329. smalltalk.send(self, "_updateClassesList", []);
  330. return self;}
  331. }),
  332. smalltalk.TestRunner);
  333. smalltalk.addMethod(
  334. '_selectAllClasses',
  335. smalltalk.method({
  336. selector: 'selectAllClasses',
  337. fn: function (){
  338. var self=this;
  339. smalltalk.send(smalltalk.send(self, "_classes", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send(self['@selectedClasses'], "_includes_", [each]), "_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(self, "_selectedClasses", []), "_add_", [each]);})]);})]);
  340. (function($rec){smalltalk.send($rec, "_updateCategoriesList", []);return smalltalk.send($rec, "_updateClassesList", []);})(self);
  341. return self;}
  342. }),
  343. smalltalk.TestRunner);
  344. smalltalk.addMethod(
  345. '_run_',
  346. smalltalk.method({
  347. selector: 'run:',
  348. fn: function (aCollection){
  349. var self=this;
  350. self['@result']=smalltalk.send(smalltalk.TestResult, "_new", []);
  351. (function($rec){smalltalk.send($rec, "_updateStatusDiv", []);return smalltalk.send($rec, "_updateMethodsList", []);})(self);
  352. smalltalk.send(smalltalk.send(self, "_progressBar", []), "_updatePercent_", [(0)]);
  353. smalltalk.send(self['@result'], "_total_", [smalltalk.send(aCollection, "_inject_into_", [(0), (function(acc, each){return smalltalk.send(acc, "__plus", [smalltalk.send(smalltalk.send(each, "_methods", []), "_size", [])]);})])]);
  354. smalltalk.send(aCollection, "_do_", [(function(each){return smalltalk.send((function(){smalltalk.send(each, "_runCaseFor_", [self['@result']]);smalltalk.send(smalltalk.send(self, "_progressBar", []), "_updatePercent_", [smalltalk.send(smalltalk.send(smalltalk.send(self['@result'], "_runs", []), "__slash", [smalltalk.send(self['@result'], "_total", [])]), "__star", [(100)])]);smalltalk.send(self, "_updateStatusDiv", []);return smalltalk.send(self, "_updateMethodsList", []);}), "_valueWithTimeout_", [(100)]);})]);
  355. return self;}
  356. }),
  357. smalltalk.TestRunner);
  358. smalltalk.addMethod(
  359. '_initialize',
  360. smalltalk.method({
  361. selector: 'initialize',
  362. fn: function (){
  363. var self=this;
  364. smalltalk.send(self, "_initialize", [], smalltalk.TabWidget);
  365. self['@result']=smalltalk.send(smalltalk.TestResult, "_new", []);
  366. return self;}
  367. }),
  368. smalltalk.TestRunner);
  369. smalltalk.addMethod(
  370. '_printErrors',
  371. smalltalk.method({
  372. selector: 'printErrors',
  373. fn: function (){
  374. var self=this;
  375. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_result", []), "_errors", []), "_size", []), "_asString", []), "__comma", [unescape("%20errors%2C%20")]);
  376. return self;}
  377. }),
  378. smalltalk.TestRunner);
  379. smalltalk.addMethod(
  380. '_printFailures',
  381. smalltalk.method({
  382. selector: 'printFailures',
  383. fn: function (){
  384. var self=this;
  385. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_result", []), "_failures", []), "_size", []), "_asString", []), "__comma", [" failures"]);
  386. return self;}
  387. }),
  388. smalltalk.TestRunner);
  389. smalltalk.addMethod(
  390. '_printPasses',
  391. smalltalk.method({
  392. selector: 'printPasses',
  393. fn: function (){
  394. var self=this;
  395. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_result", []), "_total", []), "__minus", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_result", []), "_errors", []), "_size", []), "__plus", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_result", []), "_failures", []), "_size", [])])]), "_asString", []), "__comma", [unescape("%20passes%2C%20")]);
  396. return self;}
  397. }),
  398. smalltalk.TestRunner);
  399. smalltalk.addMethod(
  400. '_printTotal',
  401. smalltalk.method({
  402. selector: 'printTotal',
  403. fn: function (){
  404. var self=this;
  405. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_result", []), "_total", []), "_asString", []), "__comma", [unescape("%20runs%2C%20")]);
  406. return self;}
  407. }),
  408. smalltalk.TestRunner);
  409. smalltalk.addMethod(
  410. '_renderBoxOn_',
  411. smalltalk.method({
  412. selector: 'renderBoxOn:',
  413. fn: function (html){
  414. var self=this;
  415. (function($rec){smalltalk.send($rec, "_renderCategoriesOn_", [html]);smalltalk.send($rec, "_renderClassesOn_", [html]);return smalltalk.send($rec, "_renderResultsOn_", [html]);})(self);
  416. return self;}
  417. }),
  418. smalltalk.TestRunner);
  419. smalltalk.addMethod(
  420. '_renderButtonsOn_',
  421. smalltalk.method({
  422. selector: 'renderButtonsOn:',
  423. fn: function (html){
  424. var self=this;
  425. (function($rec){smalltalk.send($rec, "_with_", ["Run selected"]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_run_", [smalltalk.send(smalltalk.send(self, "_selectedClasses", []), "_collect_", [(function(each){return smalltalk.send(each, "_new", []);})])]);})]);})(smalltalk.send(html, "_button", []));
  426. return self;}
  427. }),
  428. smalltalk.TestRunner);
  429. smalltalk.addMethod(
  430. '_renderCategoriesOn_',
  431. smalltalk.method({
  432. selector: 'renderCategoriesOn:',
  433. fn: function (html){
  434. var self=this;
  435. self['@categoriesList']=smalltalk.send(smalltalk.send(html, "_ul", []), "_class_", ["jt_column sunit categories"]);
  436. smalltalk.send(self, "_updateCategoriesList", []);
  437. return self;}
  438. }),
  439. smalltalk.TestRunner);
  440. smalltalk.addMethod(
  441. '_renderClassesOn_',
  442. smalltalk.method({
  443. selector: 'renderClassesOn:',
  444. fn: function (html){
  445. var self=this;
  446. self['@classesList']=smalltalk.send(smalltalk.send(html, "_ul", []), "_class_", ["jt_column sunit classes"]);
  447. smalltalk.send(self, "_updateClassesList", []);
  448. return self;}
  449. }),
  450. smalltalk.TestRunner);
  451. smalltalk.addMethod(
  452. '_renderResultsOn_',
  453. smalltalk.method({
  454. selector: 'renderResultsOn:',
  455. fn: function (html){
  456. var self=this;
  457. self['@statusDiv']=smalltalk.send(html, "_div", []);
  458. smalltalk.send(html, "_with_", [smalltalk.send(self, "_progressBar", [])]);
  459. self['@methodsList']=smalltalk.send(smalltalk.send(html, "_ul", []), "_class_", ["jt_column sunit methods"]);
  460. smalltalk.send(self, "_updateMethodsList", []);
  461. smalltalk.send(self, "_updateStatusDiv", []);
  462. return self;}
  463. }),
  464. smalltalk.TestRunner);
  465. smalltalk.addMethod(
  466. '_renderFailuresOn_',
  467. smalltalk.method({
  468. selector: 'renderFailuresOn:',
  469. fn: function (html){
  470. var self=this;
  471. smalltalk.send(smalltalk.send(smalltalk.send(self, "_result", []), "_failures", []), "_do_", [(function(each){return (function($rec){smalltalk.send($rec, "_class_", ["failures"]);return smalltalk.send($rec, "_with_", [each]);})(smalltalk.send(html, "_li", []));})]);
  472. return self;}
  473. }),
  474. smalltalk.TestRunner);
  475. smalltalk.addMethod(
  476. '_renderErrorsOn_',
  477. smalltalk.method({
  478. selector: 'renderErrorsOn:',
  479. fn: function (html){
  480. var self=this;
  481. smalltalk.send(smalltalk.send(smalltalk.send(self, "_result", []), "_errors", []), "_do_", [(function(each){return (function($rec){smalltalk.send($rec, "_class_", ["errors"]);return smalltalk.send($rec, "_with_", [each]);})(smalltalk.send(html, "_li", []));})]);
  482. return self;}
  483. }),
  484. smalltalk.TestRunner);
  485. smalltalk.addMethod(
  486. '_canBeClosed',
  487. smalltalk.method({
  488. selector: 'canBeClosed',
  489. fn: function (){
  490. var self=this;
  491. return true;
  492. return self;}
  493. }),
  494. smalltalk.TestRunner);
  495. smalltalk.addMethod(
  496. '_isSelectedClass_',
  497. smalltalk.method({
  498. selector: 'isSelectedClass:',
  499. fn: function (aClass){
  500. var self=this;
  501. return smalltalk.send(smalltalk.send(self, "_selectedClasses", []), "_includes_", [aClass]);
  502. return self;}
  503. }),
  504. smalltalk.TestRunner);
  505. smalltalk.addMethod(
  506. '_isSelectedCategory_',
  507. smalltalk.method({
  508. selector: 'isSelectedCategory:',
  509. fn: function (aCategory){
  510. var self=this;
  511. return smalltalk.send(smalltalk.send(self, "_selectedCategories", []), "_includes_", [aCategory]);
  512. return self;}
  513. }),
  514. smalltalk.TestRunner);
  515. smalltalk.addMethod(
  516. '_updateCategoriesList',
  517. smalltalk.method({
  518. selector: 'updateCategoriesList',
  519. fn: function (){
  520. var self=this;
  521. smalltalk.send(self['@categoriesList'], "_contents_", [(function(html){(function($rec){smalltalk.send($rec, "_class_", ["all"]);smalltalk.send($rec, "_with_", ["All"]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_selectAllCategories", []);})]);})(smalltalk.send(html, "_li", []));return smalltalk.send(smalltalk.send(self, "_categories", []), "_do_", [(function(each){var li=nil;
  522. li=smalltalk.send(html, "_li", []);smalltalk.send(smalltalk.send(smalltalk.send(self, "_selectedCategories", []), "_includes_", [each]), "_ifTrue_", [(function(){return smalltalk.send(li, "_class_", ["selected"]);})]);return (function($rec){smalltalk.send($rec, "_with_", [each]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_toggleCategory_", [each]);})]);})(li);})]);})]);
  523. return self;}
  524. }),
  525. smalltalk.TestRunner);
  526. smalltalk.addMethod(
  527. '_updateClassesList',
  528. smalltalk.method({
  529. selector: 'updateClassesList',
  530. fn: function (){
  531. var self=this;
  532. smalltalk.send(self['@classesList'], "_contents_", [(function(html){smalltalk.send(smalltalk.send(smalltalk.send(self, "_selectedCategories", []), "_isEmpty", []), "_ifFalse_", [(function(){return (function($rec){smalltalk.send($rec, "_class_", ["all"]);smalltalk.send($rec, "_with_", ["All"]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_selectAllClasses", []);})]);})(smalltalk.send(html, "_li", []));})]);return smalltalk.send(smalltalk.send(self, "_classes", []), "_do_", [(function(each){var li=nil;
  533. li=smalltalk.send(html, "_li", []);smalltalk.send(smalltalk.send(smalltalk.send(self, "_selectedClasses", []), "_includes_", [each]), "_ifTrue_", [(function(){return smalltalk.send(li, "_class_", ["selected"]);})]);return (function($rec){smalltalk.send($rec, "_with_", [smalltalk.send(each, "_name", [])]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_toggleClass_", [each]);})]);})(li);})]);})]);
  534. return self;}
  535. }),
  536. smalltalk.TestRunner);
  537. smalltalk.addMethod(
  538. '_updateMethodsList',
  539. smalltalk.method({
  540. selector: 'updateMethodsList',
  541. fn: function (){
  542. var self=this;
  543. smalltalk.send(self['@methodsList'], "_contents_", [(function(html){smalltalk.send(self, "_renderFailuresOn_", [html]);return smalltalk.send(self, "_renderErrorsOn_", [html]);})]);
  544. return self;}
  545. }),
  546. smalltalk.TestRunner);
  547. smalltalk.addMethod(
  548. '_updateStatusDiv',
  549. smalltalk.method({
  550. selector: 'updateStatusDiv',
  551. fn: function (){
  552. var self=this;
  553. smalltalk.send(self['@statusDiv'], "_class_", [smalltalk.send("sunit status ", "__comma", [smalltalk.send(self['@result'], "_status", [])])]);
  554. smalltalk.send(self['@statusDiv'], "_contents_", [(function(html){return smalltalk.send(smalltalk.send(html, "_span", []), "_with_", [smalltalk.send(self, "_statusInfo", [])]);})]);
  555. return self;}
  556. }),
  557. smalltalk.TestRunner);
  558. smalltalk.addClass('TestResult', smalltalk.Object, ['timestamp', 'runs', 'errors', 'failures', 'total'], 'SUnit');
  559. smalltalk.addMethod(
  560. '_timestamp',
  561. smalltalk.method({
  562. selector: 'timestamp',
  563. fn: function (){
  564. var self=this;
  565. return self['@timestamp'];
  566. return self;}
  567. }),
  568. smalltalk.TestResult);
  569. smalltalk.addMethod(
  570. '_errors',
  571. smalltalk.method({
  572. selector: 'errors',
  573. fn: function (){
  574. var self=this;
  575. return self['@errors'];
  576. return self;}
  577. }),
  578. smalltalk.TestResult);
  579. smalltalk.addMethod(
  580. '_failures',
  581. smalltalk.method({
  582. selector: 'failures',
  583. fn: function (){
  584. var self=this;
  585. return self['@failures'];
  586. return self;}
  587. }),
  588. smalltalk.TestResult);
  589. smalltalk.addMethod(
  590. '_total',
  591. smalltalk.method({
  592. selector: 'total',
  593. fn: function (){
  594. var self=this;
  595. return self['@total'];
  596. return self;}
  597. }),
  598. smalltalk.TestResult);
  599. smalltalk.addMethod(
  600. '_total_',
  601. smalltalk.method({
  602. selector: 'total:',
  603. fn: function (aNumber){
  604. var self=this;
  605. self['@total']=aNumber;
  606. return self;}
  607. }),
  608. smalltalk.TestResult);
  609. smalltalk.addMethod(
  610. '_addError_',
  611. smalltalk.method({
  612. selector: 'addError:',
  613. fn: function (anError){
  614. var self=this;
  615. smalltalk.send(smalltalk.send(self, "_errors", []), "_add_", [anError]);
  616. return self;}
  617. }),
  618. smalltalk.TestResult);
  619. smalltalk.addMethod(
  620. '_addFailure_',
  621. smalltalk.method({
  622. selector: 'addFailure:',
  623. fn: function (aFailure){
  624. var self=this;
  625. smalltalk.send(smalltalk.send(self, "_failures", []), "_add_", [aFailure]);
  626. return self;}
  627. }),
  628. smalltalk.TestResult);
  629. smalltalk.addMethod(
  630. '_runs',
  631. smalltalk.method({
  632. selector: 'runs',
  633. fn: function (){
  634. var self=this;
  635. return self['@runs'];
  636. return self;}
  637. }),
  638. smalltalk.TestResult);
  639. smalltalk.addMethod(
  640. '_increaseRuns',
  641. smalltalk.method({
  642. selector: 'increaseRuns',
  643. fn: function (){
  644. var self=this;
  645. self['@runs']=smalltalk.send(self['@runs'], "__plus", [(1)]);
  646. return self;}
  647. }),
  648. smalltalk.TestResult);
  649. smalltalk.addMethod(
  650. '_status',
  651. smalltalk.method({
  652. selector: 'status',
  653. fn: function (){
  654. var self=this;
  655. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_errors", []), "_isEmpty", []), "_ifTrue_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(self, "_failures", []), "_isEmpty", []), "_ifTrue_ifFalse_", [(function(){return "success";}), (function(){return "failure";})]);}), (function(){return "error";})]);
  656. return self;}
  657. }),
  658. smalltalk.TestResult);
  659. smalltalk.addMethod(
  660. '_initialize',
  661. smalltalk.method({
  662. selector: 'initialize',
  663. fn: function (){
  664. var self=this;
  665. smalltalk.send(self, "_initialize", [], smalltalk.Object);
  666. self['@timestamp']=smalltalk.send(smalltalk.Date, "_now", []);
  667. self['@runs']=(0);
  668. self['@errors']=smalltalk.send(smalltalk.Array, "_new", []);
  669. self['@failures']=smalltalk.send(smalltalk.Array, "_new", []);
  670. self['@total']=(0);
  671. return self;}
  672. }),
  673. smalltalk.TestResult);