Skip to content

Commit

Permalink
Add test confirming lexical scope works with await render
Browse files Browse the repository at this point in the history
This requires Ember 3.28.4+
  • Loading branch information
rwjblue committed Oct 24, 2021
1 parent 8f6692d commit 2c9e837
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"ember-load-initializers": "^2.1.2",
"ember-maybe-import-regenerator-for-testing": "^1.0.0",
"ember-resolver": "^8.0.2",
"ember-source": "~3.24.1",
"ember-source": "~3.28.4",
"ember-source-channel-url": "^3.0.0",
"ember-try": "^1.4.0",
"eslint": "^7.32.0",
Expand Down
18 changes: 18 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,20 @@ 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: { add }
}));

assert.equal(this.element.textContent, '4');
});
}
});
});
35 changes: 26 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,13 @@
minimatch "^3.0.4"
strip-json-comments "^3.1.1"

"@glimmer/vm-babel-plugins@0.80.3":
version "0.80.3"
resolved "https://registry.yarnpkg.com/@glimmer/vm-babel-plugins/-/vm-babel-plugins-0.80.3.tgz#434b62172318cac43830d3ac29818cf2c5f111c1"
integrity sha512-9ej6xlm5MzHBJ5am2l0dbbn8Z0wJoYoMpM8FcrGMlUP6SPMLWxvxpMsApgQo8u6dvZRCjR3/bw3fdf7GOy0AFw==
dependencies:
babel-plugin-debug-macros "^0.3.4"

"@humanwhocodes/config-array@^0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.5.0.tgz#1407967d4c6eecd7388f83acf1eaf4d0c6e58ef9"
Expand Down Expand Up @@ -3357,6 +3364,14 @@ broccoli-debug@^0.6.4, broccoli-debug@^0.6.5:
symlink-or-copy "^1.1.8"
tree-sync "^1.2.2"

broccoli-file-creator@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/broccoli-file-creator/-/broccoli-file-creator-2.1.1.tgz#7351dd2496c762cfce7736ce9b49e3fce0c7b7db"
integrity sha512-YpjOExWr92C5vhnK0kmD81kM7U09kdIRZk9w4ZDCDHuHXW+VE/x6AGEOQQW3loBQQ6Jk+k+TSm8dESy4uZsnjw==
dependencies:
broccoli-plugin "^1.1.0"
mkdirp "^0.5.1"

broccoli-funnel-reducer@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/broccoli-funnel-reducer/-/broccoli-funnel-reducer-1.0.0.tgz#11365b2a785aec9b17972a36df87eef24c5cc0ea"
Expand Down Expand Up @@ -3536,7 +3551,7 @@ broccoli-persistent-filter@^3.1.2:
symlink-or-copy "^1.0.1"
sync-disk-cache "^2.0.0"

broccoli-plugin@^1.0.0, broccoli-plugin@^1.2.0, broccoli-plugin@^1.2.1, broccoli-plugin@^1.3.0, broccoli-plugin@^1.3.1:
broccoli-plugin@^1.0.0, broccoli-plugin@^1.1.0, broccoli-plugin@^1.2.0, broccoli-plugin@^1.2.1, broccoli-plugin@^1.3.0, broccoli-plugin@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/broccoli-plugin/-/broccoli-plugin-1.3.1.tgz#a26315732fb99ed2d9fb58f12a1e14e986b4fabd"
integrity sha512-DW8XASZkmorp+q7J4EeDEZz+LoyKLAd2XZULXyD9l4m9/hAKV3vjHmB1kiUshcWAYMgTP1m2i4NnqCE/23h6AQ==
Expand Down Expand Up @@ -5574,19 +5589,21 @@ ember-source-channel-url@^3.0.0:
dependencies:
node-fetch "^2.6.0"

ember-source@~3.24.1:
version "3.24.5"
resolved "https://registry.yarnpkg.com/ember-source/-/ember-source-3.24.5.tgz#7e1da13286f7d1ac63b3d3a547aaeb40bc18a696"
integrity sha512-j39L7C+q9o9qkwrwNtRN1AVGzE8TlxHm0c6xMzFZFaWMyQt3E7ov72fz3oIn17h8H7zZ1i7dl471Rbqx1GZsLw==
ember-source@~3.28.4:
version "3.28.4"
resolved "https://registry.yarnpkg.com/ember-source/-/ember-source-3.28.4.tgz#b6ac2b1e369ef533d05164c65078b4ceafdb6390"
integrity sha512-s7kVy0E08erAHUTI/8SZZvXt3an/xb2g5K+m4Rybvo8Tr/noMk3lIdtyQkSvmgMZ/BbvoW8spS630sO0/JN4Eg==
dependencies:
"@babel/helper-module-imports" "^7.8.3"
"@babel/plugin-transform-block-scoping" "^7.8.3"
"@babel/plugin-transform-object-assign" "^7.8.3"
"@ember/edition-utils" "^1.2.0"
babel-plugin-debug-macros "^0.3.3"
"@glimmer/vm-babel-plugins" "0.80.3"
babel-plugin-debug-macros "^0.3.4"
babel-plugin-filter-imports "^4.0.0"
broccoli-concat "^4.2.4"
broccoli-debug "^0.6.4"
broccoli-file-creator "^2.1.1"
broccoli-funnel "^2.0.2"
broccoli-merge-trees "^4.2.0"
chalk "^4.0.0"
Expand All @@ -5599,9 +5616,9 @@ ember-source@~3.24.1:
ember-cli-version-checker "^5.1.1"
ember-router-generator "^2.0.0"
inflection "^1.12.0"
jquery "^3.5.0"
jquery "^3.5.1"
resolve "^1.17.0"
semver "^6.1.1"
semver "^7.3.4"
silent-error "^1.1.1"

ember-try-config@^3.0.0:
Expand Down Expand Up @@ -8217,7 +8234,7 @@ jest-worker@^27.0.6:
merge-stream "^2.0.0"
supports-color "^8.0.0"

jquery@^3.5.0:
jquery@^3.5.1:
version "3.6.0"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.6.0.tgz#c72a09f15c1bdce142f49dbf1170bdf8adac2470"
integrity sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==
Expand Down

0 comments on commit 2c9e837

Please sign in to comment.