1
0

JQuery-Tests.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. smalltalk.addClass('JQueryTest', smalltalk.TestCase, ['document'], 'JQuery-Tests');
  2. smalltalk.addMethod(
  3. unescape('_setUp'),
  4. smalltalk.method({
  5. selector: unescape('setUp'),
  6. category: 'running',
  7. fn: function (){
  8. var self=this;
  9. self['@document']=unescape("%3Cdiv%20class%3D%22person%22%3E%0A%09%09%09%09%3Cul%3E%0A%09%09%09%09%09%3Cli%20class%3D%22firstname%22%3EJames%3C/li%3E%0A%09%09%09%09%09%3Cli%20class%3D%22lastname%22%3EBond%3C/li%3E%0A%09%09%09%09%3C/ul%3E%0A%09%09%09%3C/div%3E");
  10. return self;},
  11. args: [],
  12. source: unescape('setUp%0A%09document%20%3A%3D%20%27%3Cdiv%20class%3D%22person%22%3E%0A%09%09%09%09%3Cul%3E%0A%09%09%09%09%09%3Cli%20class%3D%22firstname%22%3EJames%3C/li%3E%0A%09%09%09%09%09%3Cli%20class%3D%22lastname%22%3EBond%3C/li%3E%0A%09%09%09%09%3C/ul%3E%0A%09%09%09%3C/div%3E%27.'),
  13. messageSends: [],
  14. referencedClasses: []
  15. }),
  16. smalltalk.JQueryTest);
  17. smalltalk.addMethod(
  18. unescape('_testFind'),
  19. smalltalk.method({
  20. selector: unescape('testFind'),
  21. category: 'tests',
  22. fn: function (){
  23. var self=this;
  24. smalltalk.send(self, "_assert_equals_", ["James", smalltalk.send(smalltalk.send(smalltalk.send(self['@document'], "_asJQuery", []), "_find_", ["li.firstname"]), "_html", [])]);
  25. return self;},
  26. args: [],
  27. source: unescape('testFind%0A%09self%20%0A%09%09assert%3A%20%27James%27%20%0A%09%09equals%3A%20%28document%20asJQuery%20find%3A%20%27li.firstname%27%29%20html.'),
  28. messageSends: ["assert:equals:", "html", "find:", "asJQuery"],
  29. referencedClasses: []
  30. }),
  31. smalltalk.JQueryTest);
  32. smalltalk.addMethod(
  33. unescape('_testEach'),
  34. smalltalk.method({
  35. selector: unescape('testEach'),
  36. category: 'tests',
  37. fn: function (){
  38. var self=this;
  39. var classes=nil;
  40. classes=smalltalk.send((smalltalk.Array || Array), "_new", []);
  41. smalltalk.send(smalltalk.send(smalltalk.send(self['@document'], "_asJQuery", []), "_find_", ["li"]), "_each_", [(function(index, element){return smalltalk.send(classes, "_add_", [smalltalk.send(smalltalk.send((smalltalk.JQuery || JQuery), "_fromElement_", [element]), "_attr_", ["class"])]);})]);
  42. smalltalk.send(self, "_assert_equals_", [smalltalk.send(["firstname", "lastname"], "_printString", []), smalltalk.send(classes, "_printString", [])]);
  43. return self;},
  44. args: [],
  45. source: unescape('testEach%0A%09%7Cclasses%7C%0A%09classes%20%3A%3D%20Array%20new.%0A%0A%09%28document%20asJQuery%20find%3A%20%27li%27%29%20each%3A%20%5B%3Aindex%20%3Aelement%7C%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%09%20%20%09classes%20add%3A%20%28%28JQuery%20fromElement%3Aelement%29%20attr%3A%20%27class%27%29%5D.%0A%09self%20%0A%09%09assert%3A%20%23%28%27firstname%27%20%27lastname%27%29%20printString%0A%09%09equals%3A%20classes%20printString'),
  46. messageSends: ["new", "each:", "find:", "asJQuery", "add:", "attr:", "fromElement:", "assert:equals:", "printString"],
  47. referencedClasses: [smalltalk.Array,smalltalk.JQuery]
  48. }),
  49. smalltalk.JQueryTest);