Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test confirming lexical scope works with await render #1149

Merged
merged 1 commit into from
Oct 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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');
});
}
});
});