parent
6ec5d5daaf
commit
0ae89ac096
|
@ -67,6 +67,8 @@ export class ChangeDetectionUtil {
|
|||
static operation_remainder(left, right) { return left % right; }
|
||||
static operation_equals(left, right) { return left == right; }
|
||||
static operation_not_equals(left, right) { return left != right; }
|
||||
static operation_identical(left, right) { return left === right; }
|
||||
static operation_not_identical(left, right) { return left !== right; }
|
||||
static operation_less_then(left, right) { return left < right; }
|
||||
static operation_greater_then(left, right) { return left > right; }
|
||||
static operation_less_or_equals_then(left, right) { return left <= right; }
|
||||
|
@ -140,4 +142,4 @@ export class ChangeDetectionUtil {
|
|||
changes[propertyName] = change;
|
||||
return changes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -286,6 +286,10 @@ function _operationToPrimitiveName(operation: string): string {
|
|||
return "operation_equals";
|
||||
case '!=':
|
||||
return "operation_not_equals";
|
||||
case '===':
|
||||
return "operation_identical";
|
||||
case '!==':
|
||||
return "operation_not_identical";
|
||||
case '<':
|
||||
return "operation_less_then";
|
||||
case '>':
|
||||
|
@ -319,6 +323,10 @@ function _operationToFunction(operation: string): Function {
|
|||
return ChangeDetectionUtil.operation_equals;
|
||||
case '!=':
|
||||
return ChangeDetectionUtil.operation_not_equals;
|
||||
case '===':
|
||||
return ChangeDetectionUtil.operation_identical;
|
||||
case '!==':
|
||||
return ChangeDetectionUtil.operation_not_identical;
|
||||
case '<':
|
||||
return ChangeDetectionUtil.operation_less_then;
|
||||
case '>':
|
||||
|
|
|
@ -168,8 +168,17 @@ export function main() {
|
|||
expect(executeWatch('exp', '11 % 2')).toEqual(['exp=1']);
|
||||
|
||||
expect(executeWatch('exp', '1 == 1')).toEqual(['exp=true']);
|
||||
if (IS_DARTIUM) {
|
||||
expect(executeWatch('exp', '1 == "1"')).toEqual(['exp=false']);
|
||||
} else {
|
||||
expect(executeWatch('exp', '1 == "1"')).toEqual(['exp=true']);
|
||||
}
|
||||
expect(executeWatch('exp', '1 != 1')).toEqual(['exp=false']);
|
||||
|
||||
expect(executeWatch('exp', '1 === 1')).toEqual(['exp=true']);
|
||||
expect(executeWatch('exp', '1 !== 1')).toEqual(['exp=false']);
|
||||
expect(executeWatch('exp', '1 === "1"')).toEqual(['exp=false']);
|
||||
|
||||
expect(executeWatch('exp', '1 < 2')).toEqual(['exp=true']);
|
||||
expect(executeWatch('exp', '2 < 1')).toEqual(['exp=false']);
|
||||
|
||||
|
|
Loading…
Reference in New Issue