From 6847e002dca0c57cb82e12f5fa905e3bf674dfed Mon Sep 17 00:00:00 2001 From: "saranya.r" Date: Tue, 2 Feb 2016 23:04:17 +0530 Subject: [PATCH] fixes emberjs/ember.js#12506 --- packages/htmlbars-runtime/lib/hooks.js | 7 +++++++ packages/htmlbars-runtime/tests/hooks.js | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/packages/htmlbars-runtime/lib/hooks.js b/packages/htmlbars-runtime/lib/hooks.js index fc3f7c6a..35b46529 100644 --- a/packages/htmlbars-runtime/lib/hooks.js +++ b/packages/htmlbars-runtime/lib/hooks.js @@ -944,6 +944,13 @@ export function subexpr(env, scope, helperName, params, hash) { resolve a path relative to the current scope. */ export function get(env, scope, path) { + if (env.hooks.hasHelper(env, scope, path)) { + var helper = env.hooks.lookupHelper(env, scope, path); + var result = env.hooks.invokeHelper(null, env, scope, null, [], {}, helper, {}); + if (result && 'value' in result) { + return env.hooks.getValue(result.value); + } + } if (path === '') { return scope.self; } diff --git a/packages/htmlbars-runtime/tests/hooks.js b/packages/htmlbars-runtime/tests/hooks.js index 41aae231..28d5f30f 100644 --- a/packages/htmlbars-runtime/tests/hooks.js +++ b/packages/htmlbars-runtime/tests/hooks.js @@ -69,3 +69,22 @@ test("subexr hook correctly handles false-like values", function() { equalTokens(result.fragment, '
'); }); + + +test('parameter less helpers are handled correctly', function() { + registerHelper('app-url', function() { + return 'https://samplewebsite.com'; + }); + + var object = { val: true}; + var template = compile(''); + var result = template.render(object, env); + + equalTokens(result.fragment, ''); + + object.val = false; + + result.rerender(); + + equalTokens(result.fragment, ''); +});