JQuery-Tests.deploy.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. smalltalk.addClass('JQueryTest', smalltalk.TestCase, ['document'], 'JQuery-Tests');
  2. smalltalk.addMethod(
  3. '_testFind',
  4. smalltalk.method({
  5. selector: 'testFind',
  6. fn: function (){
  7. var self=this;
  8. smalltalk.send(self, "_assert_equals_", ["James", smalltalk.send(smalltalk.send(smalltalk.send(self['@document'], "_asJQuery", []), "_find_", ["li.firstname"]), "_html", [])]);
  9. return self;}
  10. ]
  11. }),
  12. smalltalk.JQueryTest);
  13. smalltalk.addMethod(
  14. '_setUp',
  15. smalltalk.method({
  16. selector: 'setUp',
  17. fn: function (){
  18. var self=this;
  19. 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");
  20. return self;}
  21. ]
  22. }),
  23. smalltalk.JQueryTest);
  24. smalltalk.addMethod(
  25. '_testEach',
  26. smalltalk.method({
  27. selector: 'testEach',
  28. fn: function (){
  29. var self=this;
  30. var classes=nil;
  31. classes=smalltalk.send(smalltalk.Array, "_new", []);
  32. 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, "_fromElement_", [element]), "_attr_", ["class"])]);})]);
  33. smalltalk.send(self, "_assert_equals_", [smalltalk.send(["firstname", "lastname"], "_printString", []), smalltalk.send(classes, "_printString", [])]);
  34. return self;}
  35. ]
  36. }),
  37. smalltalk.JQueryTest);