Manage None as value of PYSON In
issue11280 review393771002
This commit is contained in:
1 parent
ae74845f3e
commit
6c4998db2d
2 files changed
+13
-3
No files matched your search
+7
-3
@@ -693,10 +693,14 @@
|
||||
});
|
||||
|
||||
Sao.PYSON.In.eval_ = function(value, context) {
|
||||
if (value.v.indexOf) {
|
||||
return Boolean(~value.v.indexOf(value.k));
|
||||
if (value.v) {
|
||||
if (value.v.indexOf) {
|
||||
return Boolean(~value.v.indexOf(value.k));
|
||||
} else {
|
||||
return !!value.v[value.k];
|
||||
}
|
||||
} else {
|
||||
return !!value.v[value.k];
|
||||
return false;
|
||||
}
|
||||
};
|
||||
Sao.PYSON.In.init_from_object = function(obj) {
|
||||
|
||||
@@ -782,6 +782,12 @@
|
||||
new Sao.PYSON.In('test', []));
|
||||
QUnit.strictEqual(new Sao.PYSON.Decoder().decode(eval_), false,
|
||||
"decode(In('test', []))");
|
||||
|
||||
eval_ = new Sao.PYSON.Encoder().encode(
|
||||
new Sao.PYSON.In('test', new Sao.PYSON.Eval('foo', [])));
|
||||
QUnit.strictEqual(new Sao.PYSON.Decoder({'foo': null}).decode(eval_),
|
||||
false, "decode(In('test', Eval('foo', [])))");
|
||||
|
||||
QUnit.strictEqual(new Sao.PYSON.In('foo', ['foo', 'bar']).toString(),
|
||||
'In("foo", ["foo", "bar"])');
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user