JQuery-Tests.deploy.js 1.5 KB

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