Skip to content

Instantly share code, notes, and snippets.

@nalply
Last active August 29, 2015 13:55
Show Gist options
  • Save nalply/8755615 to your computer and use it in GitHub Desktop.
Save nalply/8755615 to your computer and use it in GitHub Desktop.
<template name="index">
Test 1: Non-enumerable property by prototype in a Handlebars expression.
<br>Expected: «Hello World by prototype»
<br>Actual: «{{hello}}»
<hr>
Test 2: Instance property in a Handlebars expression.
<br>Expected: «Hello World by field»
<br>Actual: «{{directHello}}»
<hr>
Test 3: Same non-enumerable property in a Handlebars helper.
<br>Expected: «Hello World by prototype»
<br>Actual: «{{helperHello}}»
</template>
if (Meteor.isServer) return
function Example() { this.directHello = "Hello World by field" }
Object.defineProperty(Example.prototype, 'hello', {
value: "Hello World by prototype"
})
Router.map(function() {
this.route('index', {path: '/', data: function() { return new Example }})
})
Template.index.helperHello = function() { return (new Example).hello }
Test 1: Non-enumerable property by prototype in a Handlebars expression.
Expected: «Hello World by prototype»
Actual: «»
------------------------------------------------------------------------
Test 2: Instance property in a Handlebars expression.
Expected: «Hello World by field»
Actual: «Hello World by field»
------------------------------------------------------------------------
Test 3: Same non-enumerable property in a Handlebars helper.
Expected: «Hello World by prototype»
Actual: «Hello World by prototype»
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment