|
@@ -2347,17 +2347,46 @@ smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "jsObject",
|
|
|
category: 'accessing',
|
|
|
-fn: function () {
|
|
|
+fn: function (){
|
|
|
var self=this;
|
|
|
-return smalltalk.withContext(function($ctx1) {
return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null};
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{}, smalltalk.JSObjectProxyTest)});},
|
|
|
+return smalltalk.withContext(function($ctx1) {
return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': undefined};
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{}, smalltalk.JSObjectProxyTest)})},
|
|
|
args: [],
|
|
|
-source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null}>",
|
|
|
+source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': undefined}>",
|
|
|
messageSends: [],
|
|
|
referencedClasses: []
|
|
|
}),
|
|
|
smalltalk.JSObjectProxyTest);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+"_testAtIfAbsent",
|
|
|
+smalltalk.method({
|
|
|
+selector: "testAtIfAbsent",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+var testObject;
|
|
|
+return smalltalk.withContext(function($ctx1) {
testObject=_st(self)._jsObject();
|
|
|
+_st(self)._assert_equals_("Property does not exist",_st(testObject)._at_ifAbsent_("abc",(function(){
|
|
|
+return smalltalk.withContext(function($ctx2) {
return "Property does not exist";
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
|
|
|
+_st(self)._assert_equals_(nil,_st(testObject)._at_ifAbsent_("e",(function(){
|
|
|
+return smalltalk.withContext(function($ctx2) {
return "Property does not exist";
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
|
|
|
+_st(self)._assert_equals_((1),_st(testObject)._at_ifAbsent_("a",(function(){
|
|
|
+return smalltalk.withContext(function($ctx2) {
return "Property does not exist";
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
|
|
|
+_st(self)._assert_equals_(nil,_st(testObject)._at_ifAbsent_("f",(function(){
|
|
|
+return smalltalk.withContext(function($ctx2) {
return "Property does not exist";
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})));
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject}, smalltalk.JSObjectProxyTest)})},
|
|
|
+args: [],
|
|
|
+source: "testAtIfAbsent\x0a\x09| testObject |\x0a testObject := self jsObject.\x0a\x09self assert: 'Property does not exist' equals: (testObject at: 'abc' ifAbsent: ['Property does not exist']).\x0a\x09self assert: nil equals: (testObject at: 'e' ifAbsent: ['Property does not exist']).\x0a self assert: 1 equals: (testObject at: 'a' ifAbsent: ['Property does not exist']).\x0a self assert: nil equals: (testObject at: 'f' ifAbsent: ['Property does not exist']).",
|
|
|
+messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.JSObjectProxyTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
"_testDNU",
|
|
|
smalltalk.method({
|
|
@@ -2467,6 +2496,26 @@ referencedClasses: ["MessageNotUnderstood"]
|
|
|
}),
|
|
|
smalltalk.JSObjectProxyTest);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+"_testValue",
|
|
|
+smalltalk.method({
|
|
|
+selector: "testValue",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+var testObject;
|
|
|
+return smalltalk.withContext(function($ctx1) {
testObject=_st(self)._jsObject();
|
|
|
+_st(self)._assert_equals_("[object Object]",_st(_st(testObject)._value())._printString());
|
|
|
+_st(testObject)._at_put_("value","aValue");
|
|
|
+_st(self)._assert_equals_("aValue",_st(testObject)._value());
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject}, smalltalk.JSObjectProxyTest)})},
|
|
|
+args: [],
|
|
|
+source: "testValue\x0a\x09| testObject |\x0a testObject := self jsObject.\x0a\x09self assert: '[object Object]' equals: testObject value printString.\x0a testObject at: 'value' put: 'aValue'.\x0a\x09self assert: 'aValue' equals: testObject value",
|
|
|
+messageSends: ["jsObject", "assert:equals:", "printString", "value", "at:put:"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.JSObjectProxyTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
"_testYourself",
|
|
|
smalltalk.method({
|