From db3b72fa3afcab929064da23c55e85c38c78f50e Mon Sep 17 00:00:00 2001 From: Vitaly Tomilov Date: Mon, 4 May 2015 02:09:53 +0100 Subject: [PATCH] adding test for function-parameter context object. --- test/formatSpec.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/formatSpec.js b/test/formatSpec.js index 03dc41de..f83c322f 100644 --- a/test/formatSpec.js +++ b/test/formatSpec.js @@ -283,6 +283,15 @@ describe("Method as.func", function () { }; })).toBe("'one',one"); + // testing function-object context; + expect(pgp.as.format("${summ}", { + val1: 1, + val2: 2, + summ: function () { + return this.val1 + this.val2; // `this` must work here; + } + })).toBe("3"); + ///////////////////////////// // negative tests;