Platform-DOM-Tests.js 2.9 KB

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