Platform-DOM-Tests.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. define(["amber/boot", "require", "amber/core/SUnit"], function($boot,requirejs){"use strict";
  2. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. var $pkg = $core.addPackage("Platform-DOM-Tests");
  4. $pkg.innerEval = function (expr) { return eval(expr); };
  5. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  6. $core.addClass("PlatformDomTest", $globals.TestCase, ["fixtureDiv"], "Platform-DOM-Tests");
  7. $core.addMethod(
  8. $core.method({
  9. selector: "testEntityConversion",
  10. protocol: "testing",
  11. fn: function (){
  12. var self=this,$self=this;
  13. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14. return $core.withContext(function($ctx1) {
  15. //>>excludeEnd("ctx");
  16. var $1;
  17. $1=$recv($globals.PlatformDom)._isFeasible();
  18. if($core.assert($1)){
  19. $self._assert_equals_("©"._htmlTextContent(),"©");
  20. }
  21. return self;
  22. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23. }, function($ctx1) {$ctx1.fill(self,"testEntityConversion",{})});
  24. //>>excludeEnd("ctx");
  25. },
  26. //>>excludeStart("ide", pragmas.excludeIdeData);
  27. args: [],
  28. source: "testEntityConversion\x0a\x09PlatformDom isFeasible ifTrue: [ self assert: '©' htmlTextContent equals: '©' ]",
  29. referencedClasses: ["PlatformDom"],
  30. //>>excludeEnd("ide");
  31. pragmas: [],
  32. messageSends: ["ifTrue:", "isFeasible", "assert:equals:", "htmlTextContent"]
  33. }),
  34. $globals.PlatformDomTest);
  35. $core.addMethod(
  36. $core.method({
  37. selector: "testTextContentDoesNotRunScript",
  38. protocol: "testing",
  39. fn: function (){
  40. var self=this,$self=this;
  41. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42. return $core.withContext(function($ctx1) {
  43. //>>excludeEnd("ctx");
  44. var $1;
  45. $1=$recv($globals.PlatformDom)._isFeasible();
  46. if($core.assert($1)){
  47. $self._shouldnt_raise_((function(){
  48. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49. return $core.withContext(function($ctx2) {
  50. //>>excludeEnd("ctx");
  51. return "<script>throw new Error(\x22Intentional\x22)</script>"._htmlTextContent();
  52. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54. //>>excludeEnd("ctx");
  55. }),$globals.Error);
  56. }
  57. return self;
  58. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59. }, function($ctx1) {$ctx1.fill(self,"testTextContentDoesNotRunScript",{})});
  60. //>>excludeEnd("ctx");
  61. },
  62. //>>excludeStart("ide", pragmas.excludeIdeData);
  63. args: [],
  64. source: "testTextContentDoesNotRunScript\x0a\x09PlatformDom isFeasible ifTrue: [\x0a\x09\x09self shouldnt: [ '<script>throw new Error(\x22Intentional\x22)</script>' htmlTextContent ] raise: Error ]",
  65. referencedClasses: ["PlatformDom", "Error"],
  66. //>>excludeEnd("ide");
  67. pragmas: [],
  68. messageSends: ["ifTrue:", "isFeasible", "shouldnt:raise:", "htmlTextContent"]
  69. }),
  70. $globals.PlatformDomTest);
  71. });