Platform-DOM-Tests.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. define(["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  2. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  3. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  4. $core.addPackage("Platform-DOM-Tests");
  5. ($core.packageDescriptors||$core.packages)["Platform-DOM-Tests"].innerEval = function (expr) { return eval(expr); };
  6. ($core.packageDescriptors||$core.packages)["Platform-DOM-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7. $core.addClass("PlatformDomTest", $globals.TestCase, ["fixtureDiv"], "Platform-DOM-Tests");
  8. $core.addMethod(
  9. $core.method({
  10. selector: "testEntityConversion",
  11. protocol: "testing",
  12. fn: function (){
  13. var self=this,$self=this;
  14. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15. return $core.withContext(function($ctx1) {
  16. //>>excludeEnd("ctx");
  17. var $1;
  18. $1=$recv($globals.PlatformDom)._isFeasible();
  19. if($core.assert($1)){
  20. $self._assert_equals_("©"._htmlTextContent(),"©");
  21. }
  22. return self;
  23. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24. }, function($ctx1) {$ctx1.fill(self,"testEntityConversion",{},$globals.PlatformDomTest)});
  25. //>>excludeEnd("ctx");
  26. },
  27. //>>excludeStart("ide", pragmas.excludeIdeData);
  28. args: [],
  29. source: "testEntityConversion\x0a\x09PlatformDom isFeasible ifTrue: [ self assert: '©' htmlTextContent equals: '©' ]",
  30. referencedClasses: ["PlatformDom"],
  31. //>>excludeEnd("ide");
  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",{},$globals.PlatformDomTest)});
  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. messageSends: ["ifTrue:", "isFeasible", "shouldnt:raise:", "htmlTextContent"]
  68. }),
  69. $globals.PlatformDomTest);
  70. });