Getters for comparison expression properties

This commit is contained in:
Tim Schaub
2013-06-11 22:53:04 -06:00
parent be636d7f46
commit 582a52849c
2 changed files with 50 additions and 0 deletions

View File

@@ -213,6 +213,33 @@ ol.expression.Comparison.prototype.evaluate = function(opt_scope, opt_this,
};
/**
* Get the comparison operator.
* @return {string} The comparison operator.
*/
ol.expression.Comparison.prototype.getOperator = function() {
return this.operator_;
};
/**
* Get the left expression.
* @return {ol.expression.Expression} The left expression.
*/
ol.expression.Comparison.prototype.getLeft = function() {
return this.left_;
};
/**
* Get the right expression.
* @return {ol.expression.Expression} The right expression.
*/
ol.expression.Comparison.prototype.getRight = function() {
return this.right_;
};
/**
* An identifier expression (e.g. `foo`).

View File

@@ -211,6 +211,29 @@ describe('ol.expression.Comparison', function() {
});
});
var op = ol.expression.ComparisonOp.LTE;
var left = new ol.expression.Identifier('foo');
var right = new ol.expression.Literal(42);
var expr = new ol.expression.Comparison(op, left, right);
describe('#getOperator()', function() {
it('gets the operator', function() {
expect(expr.getOperator()).to.be(op);
});
});
describe('#getLeft()', function() {
it('gets the left expression', function() {
expect(expr.getLeft()).to.be(left);
});
});
describe('#getRight()', function() {
it('gets the right expression', function() {
expect(expr.getRight()).to.be(right);
});
});
});
describe('ol.expression.Identifier', function() {