Skip to content

Commit

Permalink
Add test for the functionality acquired by the glimmer upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Feb 15, 2022
1 parent aa1d0ce commit 1d4c2df
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import {moduleFor, RenderingTestCase, runkTask} from 'internal-test-helpers';
import { Component } from '@ember/-internals/glimmer';


// Initial implementation: https://github.com/glimmerjs/glimmer-vm/pull/1348
moduleFor('Glimmer Features - functions as helpers', class extends RenderingTestCase {
async ['@test plain functions work as helpers'](assert) {
let count = 0;
this.addComponent('demo', {
template: `{{ (this.hello) }}`,
ComponentClass: class Demo extends Component {
hello = () => {
count++;
return 'plain function';
}
},
});

assert.equal(count, 0);

this.render('<Demo />');

assert.equal(count, 1);
}
})

0 comments on commit 1d4c2df

Please sign in to comment.