Skip to content

Commit

Permalink
more rigorous tests regarding fn expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-brade committed Jan 3, 2016
1 parent bd612b9 commit 962a890
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/expressions.mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ var controller = {
controller.model = {
data: {
key: 'green'
, Math: {
abs: "not a function"
}
, _page: {
colors: {
green: {
Expand Down Expand Up @@ -273,11 +276,19 @@ describe('Expression::get', function() {
expect(expression.get(context)).to.be.a(Error);
});

// None of these are supported yet, but ideally they would be
it('gets method call of the result of an fn expressions', function() {
var expression = create('(_page.date).valueOf()');
expect(expression.get(context)).to.equal(1000);
});

it('gets the correct method even in case of duplicate paths', function() {
var expression = create('Math.abs(-5)');
expect(expression.get(context)).to.equal(5);
expression = create('Math.abs');
expect(expression.get(context)).to.equal('not a function');
});

// None of these are supported yet, but ideally they would be
it.skip('gets method call of the result of an fn expressions', function() {
var expression = create('passThrough(_page.date).valueOf()');
expect(expression.get(context)).to.equal(1000);
Expand Down

0 comments on commit 962a890

Please sign in to comment.