New ThisIdentifier expression
This allows member expressions to use the 'this' keyword.
This commit is contained in:
@@ -92,6 +92,12 @@ describe('ol.expr.parse()', function() {
|
||||
expect(expr.evaluate(scope)).to.be(42);
|
||||
});
|
||||
|
||||
it('parses member expressions in the \'this\' scope', function() {
|
||||
var expr = ol.expr.parse('this.foo');
|
||||
var thisScope = {foo: 'bar'};
|
||||
expect(expr.evaluate(undefined, undefined, thisScope)).to.be('bar');
|
||||
});
|
||||
|
||||
it('consumes whitespace as expected', function() {
|
||||
var expr = ol.expr.parse(' foo . bar . baz ');
|
||||
expect(expr).to.be.a(ol.expr.Member);
|
||||
|
||||
Reference in New Issue
Block a user