Manage None as value of PYSON In
issue11280 review393771002 (grafted from 579d0ce4a3056c2ec60e4c208c2a8cd7e7824210) --HG-- branch : 6.0
This commit is contained in:
1 parent
e7ded43839
commit
9d78a10cb8
2 files changed
+13
-3
No files matched your search
+7
-3
@@ -682,10 +682,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) {
|
||||
|
||||
@@ -772,6 +772,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