Skip to content

Commit

Permalink
Merge pull request #1149 from emberjs/add-lexical-scope-test
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue authored Oct 25, 2021
2 parents 6cb7f33 + af323bb commit b0e6c2e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/integration/setup-rendering-context-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Ember from 'ember';
import { module, test } from 'qunit';
import Component from '@ember/component';
import { helper } from '@ember/component/helper';
import {
setupContext,
setupRenderingContext,
Expand All @@ -13,6 +14,7 @@ import {
import hasEmberVersion from '@ember/test-helpers/has-ember-version';
import { setResolverRegistry } from '../helpers/resolver';
import { hbs } from 'ember-cli-htmlbars';
import { precompileTemplate } from '@ember/template-compilation';
import { defer } from 'rsvp';

const PromiseWrapperTemplate = hbs`
Expand Down Expand Up @@ -144,4 +146,24 @@ module('setupRenderingContext "real world"', function (hooks) {
'the rootElement has the correct content after clicking'
);
});

module('lexical scope access', function () {
if (hasEmberVersion(3, 28)) {
test('can render components passed as locals', async function (assert) {
let add = helper(function ([first, second]) {
return first + second;
});

await render(
precompileTemplate('{{add 1 3}}', {
scope() {
return { add };
},
})
);

assert.equal(this.element.textContent, '4');
});
}
});
});

0 comments on commit b0e6c2e

Please sign in to comment.