Skip to content

Commit

Permalink
Reproduction for frozen params, hash bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mixonic committed Dec 12, 2016
1 parent 77159b1 commit 2f4e846
Showing 1 changed file with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
import { RenderingTest, moduleFor } from '../../utils/test-case';
import { makeBoundHelper } from '../../utils/helpers';
import { runDestroy } from 'internal-test-helpers';
import { set } from 'ember-metal';
import {
HAS_NATIVE_WEAKMAP,
set
} from 'ember-metal';

let assert = QUnit.assert;

Expand Down Expand Up @@ -174,6 +177,30 @@ moduleFor('Helpers test: custom helpers', class extends RenderingTest {
assert.strictEqual(destroyCount, 0, 'destroy is not called on recomputation');
}

['@test helper params can be returned']() {
this.registerHelper('hello-world', values => {
return values;
});

this.render('{{#each (hello-world model) as |item|}}({{item}}){{/each}}', {
model: ['bob']
});

this.assertText('(bob)');
}

['@test helper hash can be returned']() {
this.registerHelper('hello-world', (_, hash) => {
return hash.model;
});

this.render(`{{get (hello-world model=model) 'name'}}`, {
model: { name: 'bob' }
});

this.assertText('bob');
}

['@test simple helper is called for param changes']() {
let computeCount = 0;

Expand Down Expand Up @@ -602,7 +629,7 @@ let addingPropertyToFrozenObjectThrows = (() => {
}
})();

if (!EmberDev.runningProdBuild && (
if (!EmberDev.runningProdBuild && HAS_NATIVE_WEAKMAP && (
pushingIntoFrozenArrayThrows ||
assigningExistingFrozenPropertyThrows ||
addingPropertyToFrozenObjectThrows
Expand Down

0 comments on commit 2f4e846

Please sign in to comment.