Skip to content

Commit 9c990a1

Browse files
committed
more rigorous tests regarding fn expressions
1 parent d943adc commit 9c990a1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

test/expressions.mocha.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ var controller = {
3535
controller.model = {
3636
data: {
3737
key: 'green'
38+
, Math: {
39+
abs: "not a function"
40+
}
3841
, _page: {
3942
colors: {
4043
green: {
@@ -273,11 +276,19 @@ describe('Expression::get', function() {
273276
expect(expression.get(context)).to.be.a(Error);
274277
});
275278

276-
// None of these are supported yet, but ideally they would be
277279
it('gets method call of the result of an fn expressions', function() {
278280
var expression = create('(_page.date).valueOf()');
279281
expect(expression.get(context)).to.equal(1000);
280282
});
283+
284+
it('gets the correct method even in case of duplicate paths', function() {
285+
var expression = create('Math.abs(-5)');
286+
expect(expression.get(context)).to.equal(5);
287+
expression = create('Math.abs');
288+
expect(expression.get(context)).to.equal('not a function');
289+
});
290+
291+
// None of these are supported yet, but ideally they would be
281292
it.skip('gets method call of the result of an fn expressions', function() {
282293
var expression = create('passThrough(_page.date).valueOf()');
283294
expect(expression.get(context)).to.equal(1000);

0 commit comments

Comments
 (0)