language
stringclasses 1
value | owner
stringlengths 2
15
| repo
stringlengths 2
21
| sha
stringlengths 45
45
| message
stringlengths 7
36.3k
| path
stringlengths 1
199
| patch
stringlengths 15
102k
| is_multipart
bool 2
classes |
---|---|---|---|---|---|---|---|
Other
|
emberjs
|
ember.js
|
e00931fbed334dfc043f264ee8312fa11bd16178.json
|
Update README to remove incorrect image link
Removing the img that doesn't work and replacing with just the link to Browserstack, per their instructions.
|
README.md
|
@@ -46,7 +46,4 @@ See [CONTRIBUTING.md](https://github.com/emberjs/ember.js/blob/master/CONTRIBUTI
---
-Cross-browser testing provided by:
-
-
-<a href="http://browserstack.com"><img height="70" src="https://p3.zdusercontent.com/attachment/1015988/PWfFdN71Aung2evRkIVQuKJpE?token=eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0..aUrNFb8clSXsFwgw5BUTcg.IJr5piuCen7PmSSBHSrOnqM9K5YZfxX3lvbp-5LCqoKOi4CjjgdA419iqjofs0nLtm26FMURvZ8JRTuKB4iHer6lGu5f8dXHtIkYAHjP5fXDWkl044Yg2mSdrhF6uPy62GdlBYoYxwvgkNrac8nN_In8GY-qOC7bYmlZyJT7tsTZUTYbNMQiXS86YA5LgdCEWzWreMvc3C6cvZtVXIrcVgpkroIhvsTQPm4vQA-Uq6iCbTPA4oX5cpEtMtrlg4jYBnnAE4BTw5UwU_dY83ep5g.7wpc1IKv0rSRGsvqCG_q3g" alt="BrowserStack"></a>
+Cross-browser testing provided by <a href="http://browserstack.com">Browserstack</a>. Thank you!
| false |
Other
|
emberjs
|
ember.js
|
88027a481c2d35bbbecc0523c0e84f2ce36614e5.json
|
fix typo in readme
|
README.md
|
@@ -19,7 +19,7 @@ With Ember, you get all of these things:
* [**A Welcoming Community**](https://emberjs.com/community/) - Get the help you need, when you need it.
* [**An Enduring Foundation for your Apps**](https://en.wikipedia.org/wiki/Ember.js) - There are apps that used the first version of Ember almost a decade ago, and successfully still use Ember today.
* [**Reliability & Security**](https://emberjs.com/releases/) - With regular LTS Releases and 30 weeks of security fixes, you can rely on Ember.js to care about the stability [and security](https://emberjs.com/security/) of your app.
-* [**Modern JavaScript**](https://guides.emberjs.com/release/upgrading/current-edition/) - Use modern JavaScript features that you're already familiar with like classes, decorators, & generators.
+* [**Modern JavaScript**](https://guides.emberjs.com/release/upgrading/current-edition/) - Use modern JavaScript features that you're already familiar with like classes, decorators and generators.
* [**Documentation**](https://guides.emberjs.com) - Rely on top-notch documentation for each Ember version and a team that is focused on the documentation and learning experience.
* [**HTML-first Components**](https://guides.emberjs.com/release/components/introducing-components/) - Start with valid, semantic HTML in your components, and layer in the functionality that you need, as you need it.
* [**Routing**](https://guides.emberjs.com/release/routing/) - Ember routes respect URLs while layering in extra functionality like rendering templates, loading data models, handling actions, and conditionally redirecting.
| false |
Other
|
emberjs
|
ember.js
|
1cf64e6d8d779e533a424fe4f39139977002acba.json
|
Apply suggestions from code review
|
README.md
|
@@ -27,8 +27,8 @@ With Ember, you get all of these things:
* [**Flexibility**](https://guides.emberjs.com/release/models/customizing-adapters/) Use _**any**_ backend stack with your Ember apps, thanks to the flexibility of adapters and serializers.
* [**Autotracking**](https://guides.emberjs.com/release/in-depth-topics/autotracking-in-depth/) - Ember's reactivity model makes it easier to decide what to automatically update, and when.
* [**Bytecode Templates**](https://yehudakatz.com/2017/04/05/the-glimmer-vm-boots-fast-and-stays-fast/) and other compile-time optimizations.
-* [**Zero config apps**](https://guides.emberjs.com/release/configuring-ember/) - With strong defaults, you may never need to configure anything in your app, but the options are there if you need it!
-* [**Quality addon ecosystem**](https://emberobserver.com/) - high-quality, rated addons with the ability to [search by source code](https://emberobserver.com/code-search?codeQuery=task). Many require no additional configuration, making it easier than ever to supercharge your apps.
+* [**Zero Config Apps**](https://guides.emberjs.com/release/configuring-ember/) - With strong defaults, you may never need to configure anything in your app, but the options are there if you need it!
+* [**Quality Addon Ecosystem**](https://emberobserver.com/) - high-quality, rated addons with the ability to [search by source code](https://emberobserver.com/code-search?codeQuery=task). Many require no additional configuration, making it easier than ever to supercharge your apps.
| false |
Other
|
emberjs
|
ember.js
|
8d945e22fa4ef70305122bd4aff89be0548b493f.json
|
Apply suggestions from code review
|
README.md
|
@@ -12,23 +12,24 @@
</p>
-**Ember** is
+**Ember.js** is a JavaScript framework that greatly reduces the time, effort and resources needed to build any web application. It is focused on making you, the developer, as productive as possible by doing all the common, repetitive, yet essential, tasks involved in most web development projects.
+
+With Ember, you get all of these things:
* [**A Welcoming Community**](https://emberjs.com/community/) - Get the help you need, when you need it.
-* [**Timeless**](https://en.wikipedia.org/wiki/Ember.js) - There are apps that used the first version of Ember almost a decade ago, and have successfully used Ember this entire time.
-* [**Reliable & Secure**](https://emberjs.com/releases/) - With regular LTS Releases and 30 weeks of security fixes, you can rely on Ember.js to care about the stability and security of your app.
-* [**Modern**](https://guides.emberjs.com/release/upgrading/current-edition/) - Use modern JavaScript features that you're already familiar with like classes, decorators, & generators.
-* [**Documented**](https://guides.emberjs.com) - Rely on top-notch documentation for each Ember version and a team that is focused on the documentation and learning experience.
+* [**An Enduring Foundation for your Apps**](https://en.wikipedia.org/wiki/Ember.js) - There are apps that used the first version of Ember almost a decade ago, and successfully still use Ember today.
+* [**Reliability & Security**](https://emberjs.com/releases/) - With regular LTS Releases and 30 weeks of security fixes, you can rely on Ember.js to care about the stability [and security](https://emberjs.com/security/) of your app.
+* [**Modern JavaScript**](https://guides.emberjs.com/release/upgrading/current-edition/) - Use modern JavaScript features that you're already familiar with like classes, decorators, & generators.
+* [**Documentation**](https://guides.emberjs.com) - Rely on top-notch documentation for each Ember version and a team that is focused on the documentation and learning experience.
* [**Component-Based**](https://guides.emberjs.com/release/components/introducing-components/) - Any HTML is a valid component! Start with valid, semantic HTML and layer in the app functionality that you need- giving your team the space for specialized markup experts.
-* [**Routed**](https://guides.emberjs.com/release/routing/) - Ember routes respect URLs while layering in extra functionality like rendering templates, loading data models, handling actions, and conditionally redirecting.
-* [**DSL**](https://guides.emberjs.com/release/models/) - Ember Data is a powerful data management tool.
-* [**Flexible**](https://guides.emberjs.com/release/models/customizing-adapters/) Use _**any**_ backend stack with your Ember apps, thanks to the flexibility of adapters and serializers.
-* [**Autotracked (Ember's reactivity model)**](https://guides.emberjs.com/release/in-depth-topics/autotracking-in-depth/) - Ember makes it easier to decide what to automatically update, and when.
+* [**Routing**](https://guides.emberjs.com/release/routing/) - Ember routes respect URLs while layering in extra functionality like rendering templates, loading data models, handling actions, and conditionally redirecting.
+* [**Data Layer**](https://guides.emberjs.com/release/models/) - Ember Data is a powerful data management tool that comes with Ember apps by default. Want to use something else? We support that, too!
+* [**Flexibility**](https://guides.emberjs.com/release/models/customizing-adapters/) Use _**any**_ backend stack with your Ember apps, thanks to the flexibility of adapters and serializers.
+* [**Autotracking**](https://guides.emberjs.com/release/in-depth-topics/autotracking-in-depth/) - Ember's reactivity model makes it easier to decide what to automatically update, and when.
* [**Bytecode Templates**](https://yehudakatz.com/2017/04/05/the-glimmer-vm-boots-fast-and-stays-fast/) and other compile-time optimizations.
* [**Zero config apps**](https://guides.emberjs.com/release/configuring-ember/) - With strong defaults, you may never need to configure anything in your app, but the options are there if you need it!
* [**Quality addon ecosystem**](https://emberobserver.com/) - high-quality, rated addons with the ability to [search by source code](https://emberobserver.com/code-search?codeQuery=task). Many require no additional configuration, making it easier than ever to supercharge your apps.
-Used By [**Linkedin**](https://engineering.linkedin.com/blog/topic/ember), [**Apple**](http://builtwithember.io/featured/2015/07/04/apple-music/), [**Crowdstrike**](https://www.crowdstrike.com/),[**Hashicorp**](https://github.com/hashicorp/vault), [**Travis CI**](https://github.com/travis-ci/travis-web), [**DigitalOcean**](http://builtwithember.io/2018/02/08/digital-ocean/), [**Percy**](https://github.com/percy/percy-web) and [more](http://builtwithember.io/).
- [Website](https://emberjs.com)
| false |
Other
|
emberjs
|
ember.js
|
0e47aa17097bc515f16e93157aff4e965d89d994.json
|
Add v3.18.0-beta.1 to CHANGELOG
[ci skip]
(cherry picked from commit bf6b8f7dfe03871fcfa28142e35b523e014c0712)
|
CHANGELOG.md
|
@@ -1,5 +1,10 @@
# Ember Changelog
+### v3.18.0-beta.1 (March 5, 2020)
+
+- [#18774](https://github.com/emberjs/ember.js/pull/18774) [BUGFIX] Suspend observer deactivation during property changes
+- [#18785](https://github.com/emberjs/ember.js/pull/18785) Drop Node 8 support.
+
### v3.17.0 (March 4, 2020)
- [#18688](https://github.com/emberjs/ember.js/pull/18688) / [#18621](https://github.com/emberjs/ember.js/pull/18621) / [#18714](https://github.com/emberjs/ember.js/pull/18714) / [#18743](https://github.com/emberjs/ember.js/pull/18743) / [#18762](https://github.com/emberjs/ember.js/pull/18762) Upgrades Glimmer VM to 0.47.9, fixes ignored `checked` attribute on `input`, fixes using `array` and `hash` helper together
| false |
Other
|
emberjs
|
ember.js
|
aa58644915c37fd7cd9e82926e68354fe8bcbaef.json
|
Add v3.17.0 to CHANGELOG
[ci skip]
(cherry picked from commit fdb55d93fc43e339b801aeb7eb359237386721d7)
|
CHANGELOG.md
|
@@ -1,39 +1,21 @@
# Ember Changelog
-### v3.17.0-beta.6 (February 24, 2020)
+### v3.17.0 (March 4, 2020)
+- [#18688](https://github.com/emberjs/ember.js/pull/18688) / [#18621](https://github.com/emberjs/ember.js/pull/18621) / [#18714](https://github.com/emberjs/ember.js/pull/18714) / [#18743](https://github.com/emberjs/ember.js/pull/18743) / [#18762](https://github.com/emberjs/ember.js/pull/18762) Upgrades Glimmer VM to 0.47.9, fixes ignored `checked` attribute on `input`, fixes using `array` and `hash` helper together
+- [#18741](https://github.com/emberjs/ember.js/pull/18741) [BUGFIX] Don't setup mandatory setters on array indexes
+- [#18767](https://github.com/emberjs/ember.js/pull/18767) [BUGFIX] Fix observer leaks
+- [#18770](https://github.com/emberjs/ember.js/pull/18770) [BUGFIX] Make ArrayProxy Lazy
+- [#18780](https://github.com/emberjs/ember.js/pull/18780) [BUGFIX] Fix ownerInjection when used to create services directly
- [#18742](https://github.com/emberjs/ember.js/pull/18742) [BUGFIX] Fix setDiff computed macro used within glimmer component
-- [#18743](https://github.com/emberjs/ember.js/pull/18743) / [#18762](https://github.com/emberjs/ember.js/pull/18762) [BUGFIX] Upgrades Glimmer VM to 0.47.9, fixes ignored `checked` attribute on `input`, fixes using `array` and `hash` helper together
-
-### v3.17.0-beta.5 (February 18, 2020)
-
-- [#18730](https://github.com/emberjs/ember.js/pull/18730) Workaround for the Glimmer VM bug which encodes/decodes integer literals correctly.
-
-### v3.17.0-beta.4 (February 10, 2020)
-
- [#18727](https://github.com/emberjs/ember.js/pull/18727) [BUGFIX] Avoid breaking {{-in-element}} usage
- [#18728](https://github.com/emberjs/ember.js/pull/18728) [BUGFIX] Fix `{{#-in-element}}` double-clearing issue
-- [#18729](https://github.com/emberjs/ember.js/pull/18729) [BUGFIX] Remove deprecation for instantiation of new singleton instances (e.g. a service) during teardown (originally added in 3.16.1 by [#18717](https://github.com/emberjs/ember.js/pull/18717)).
-
-### v3.17.0-beta.3 (February 3, 2020)
-
- [#18703](https://github.com/emberjs/ember.js/pull/18703) [BUGFIX] Correctly links ArrayProxy tags to `arrangedContent`
- [#18707](https://github.com/emberjs/ember.js/pull/18707) [BUGFIX] Fixes tag chaining on Proxy mixins
- [#18708](https://github.com/emberjs/ember.js/pull/18708) [BUGFIX] Ensures the arg proxy works with `get`
-- [#18717](https://github.com/emberjs/ember.js/pull/18717) [BUGFIX] Ensure instantiation cannot happen after destruction.
-- [#18720](https://github.com/emberjs/ember.js/pull/18720) [BUGFIX] Update minimum @ember/edition-utils to 1.2.0.
-- [#18714](https://github.com/emberjs/ember.js/pull/18714) Update glimmer packages to 0.47.4.
-
-### v3.17.0-beta.2 (January 29, 2020)
-
-- [#18691](https://github.com/emberjs/ember.js/pull/18691) [BUGFIX] Updated blueprints for component and helper tests to output the correct hbs import statement
- [#18694](https://github.com/emberjs/ember.js/pull/18694) [BUGFIX] Ensure tag updates are buffered, remove error message
- [#18709](https://github.com/emberjs/ember.js/pull/18709) [BUGFIX] Fix `this` in `@tracked` initializer
-### v3.17.0-beta.1 (January 20, 2020)
-
-- [#18688](https://github.com/emberjs/ember.js/pull/18688) / [#18621](https://github.com/emberjs/ember.js/pull/18621) Updates Glimmer-VM to v0.46
-
### v3.16.3 (February 18, 2020)
- [#18730](https://github.com/emberjs/ember.js/pull/18730) Workaround for the Glimmer VM bug which encodes/decodes integer literals correctly.
| false |
Other
|
emberjs
|
ember.js
|
c75f505e54530e8d3e3b57d6860f54fb0efd0534.json
|
Drop Node 8 support.
Our public API around Node version support says:
> To make it easier for us to deliver on our support promise we have
> adopted a policy that the HEAD of our master branches will be compatible
> with all versions of Node.js currently receiving support. For any Ember
> project on the day we drop support for a Node.js version the following
> things will happen:
>
> * We will update the engines key inside of package.json to specify the
> versions supported by the project.
> * We will update the testing targets to remove the newly-unsupported
> Node.js version from the list.
> * We will begin accepting code without testing it against the
newly-unsupported version of Node.js.
>
> For projects with an unspecified release model we will release one last
> version of the project prior to those steps. The version number change
> will reflect SemVer with respect to the APIs of the project and not take
> into consideration removal of Node.js version support. This means that
> the release may show up as a "patch" version release. For example, if
> we're dropping support for Node.js 0.10 and have a project at version
> 1.3.3 we can drop Node.js 0.10 support when we release version 1.3.4.
(from https://blog.emberjs.com/2016/09/07/ember-node-lts-support.html)
|
.travis.yml
|
@@ -95,13 +95,11 @@ jobs:
- yarn test
- name: Node.js Tests
- node_js: "8"
script:
- yarn ember build -prod
- yarn test:node
- name: Blueprint Tests
- node_js: "8"
script:
- yarn test:blueprints
| true |
Other
|
emberjs
|
ember.js
|
c75f505e54530e8d3e3b57d6860f54fb0efd0534.json
|
Drop Node 8 support.
Our public API around Node version support says:
> To make it easier for us to deliver on our support promise we have
> adopted a policy that the HEAD of our master branches will be compatible
> with all versions of Node.js currently receiving support. For any Ember
> project on the day we drop support for a Node.js version the following
> things will happen:
>
> * We will update the engines key inside of package.json to specify the
> versions supported by the project.
> * We will update the testing targets to remove the newly-unsupported
> Node.js version from the list.
> * We will begin accepting code without testing it against the
newly-unsupported version of Node.js.
>
> For projects with an unspecified release model we will release one last
> version of the project prior to those steps. The version number change
> will reflect SemVer with respect to the APIs of the project and not take
> into consideration removal of Node.js version support. This means that
> the release may show up as a "patch" version release. For example, if
> we're dropping support for Node.js 0.10 and have a project at version
> 1.3.3 we can drop Node.js 0.10 support when we release version 1.3.4.
(from https://blog.emberjs.com/2016/09/07/ember-node-lts-support.html)
|
package.json
|
@@ -146,7 +146,7 @@
"tslint": "^5.20.1"
},
"engines": {
- "node": "8.* || 10.* || >= 12.*"
+ "node": "10.* || >= 12.*"
},
"ember-addon": {
"after": "ember-cli-legacy-blueprints"
| true |
Other
|
emberjs
|
ember.js
|
3898afa44f8a3d8e57c10c3d3c9a4d86d11517b9.json
|
Add v3.17.0-beta.6 to CHANGELOG
[ci skip]
(cherry picked from commit f5960fcbcd2562a1d719eb94acb8cb17247c4eb0)
|
CHANGELOG.md
|
@@ -1,5 +1,10 @@
# Ember Changelog
+### v3.17.0-beta.6 (February 24, 2020)
+
+- [#18742](https://github.com/emberjs/ember.js/pull/18742) [BUGFIX] Fix setDiff computed macro used within glimmer component
+- [#18743](https://github.com/emberjs/ember.js/pull/18743) / [#18762](https://github.com/emberjs/ember.js/pull/18762) [BUGFIX] Upgrades Glimmer VM to 0.47.9, fixes ignored `checked` attribute on `input`, fixes using `array` and `hash` helper together
+
### v3.17.0-beta.5 (February 18, 2020)
- [#18730](https://github.com/emberjs/ember.js/pull/18730) Workaround for the Glimmer VM bug which encodes/decodes integer literals correctly.
| false |
Other
|
emberjs
|
ember.js
|
426a814b302a192bee68724a0b596d11765067fa.json
|
Add v3.16.3 to CHANGELOG
[ci skip]
(cherry picked from commit 2cfb76023a5f1e80ca50b7a0512cb08f0bef9c7f)
|
CHANGELOG.md
|
@@ -29,6 +29,10 @@
- [#18688](https://github.com/emberjs/ember.js/pull/18688) / [#18621](https://github.com/emberjs/ember.js/pull/18621) Updates Glimmer-VM to v0.46
+### v3.16.3 (February 18, 2020)
+
+- [#18730](https://github.com/emberjs/ember.js/pull/18730) Workaround for the Glimmer VM bug which encodes/decodes integer literals correctly.
+
### v3.16.2 (February 10, 2020)
- [#18721](https://github.com/emberjs/ember.js/pull/18721) [BUGFIX] Backport autotracking bugfixes
| false |
Other
|
emberjs
|
ember.js
|
9fe5a6b5a86adb163b02a200bf7562aca87c53e0.json
|
Fix lint issues.
|
packages/@ember/-internals/glimmer/tests/integration/input-test.js
|
@@ -202,22 +202,30 @@ moduleFor(
}
['@test GH18211 input checked attribute, without a value, works with the action helper']() {
- this.render(`<input type="checkbox" checked {{action "someAction"}}>`, { actions: { someAction() {} } });
+ this.render(`<input type="checkbox" checked {{action "someAction"}}>`, {
+ actions: { someAction() {} },
+ });
this.assertPropertyHasValue('checked', true);
}
['@test GH18211 input checked attribute, with a value, works with the action helper']() {
- this.render(`<input type="checkbox" checked={{true}} {{action "someAction"}}>`, { actions: { someAction() {} } });
+ this.render(`<input type="checkbox" checked={{true}} {{action "someAction"}}>`, {
+ actions: { someAction() {} },
+ });
this.assertPropertyHasValue('checked', true);
}
-
+
['@test GH18211 input checked attribute, without a value, works with attributes with values']() {
- this.render(`<input type="checkbox" checked click={{action "someAction"}}>`, { actions: { someAction() {} } });
+ this.render(`<input type="checkbox" checked click={{action "someAction"}}>`, {
+ actions: { someAction() {} },
+ });
this.assertPropertyHasValue('checked', true);
}
['@test GH18211 input checked attribute, without a value, works with event attributes']() {
- this.render(`<input type="checkbox" checked onclick={{action "someAction"}}>`, { actions: { someAction() {} } });
+ this.render(`<input type="checkbox" checked onclick={{action "someAction"}}>`, {
+ actions: { someAction() {} },
+ });
this.assertPropertyHasValue('checked', true);
}
| false |
Other
|
emberjs
|
ember.js
|
dae92959f448f5d3f22659b5ecc124420ef0c6ad.json
|
Update documentation for redirect() hook
|
packages/@ember/-internals/routing/lib/system/route.ts
|
@@ -1053,17 +1053,14 @@ class Route extends EmberObject implements IRoute {
`redirect` and `afterModel` behave very similarly and are
called almost at the same time, but they have an important
- distinction in the case that, from one of these hooks, a
- redirect into a child route of this route occurs: redirects
- from `afterModel` essentially invalidate the current attempt
- to enter this route, and will result in this route's `beforeModel`,
- `model`, and `afterModel` hooks being fired again within
- the new, redirecting transition. Redirects that occur within
- the `redirect` hook, on the other hand, will _not_ cause
- these hooks to be fired again the second time around; in
- other words, by the time the `redirect` hook has been called,
- both the resolved model and attempted entry into this route
- are considered to be fully validated.
+ distinction when calling `this.transitionTo` to a child route
+ of the current route. From `afterModel`, this new transition
+ invalidates the current transition, causing `beforeModel`,
+ `model`, and `afterModel` hooks to be called again. But the
+ same transition started from `redirect` does _not_ invalidate
+ the current transition. In other words, by the time the `redirect`
+ hook has been called, both the resolved model and the attempted
+ entry into this route are considered fully validated.
@method redirect
@param {Object} model the model for this route
| false |
Other
|
emberjs
|
ember.js
|
230050945f50ad36aff3d05263b688870aff474b.json
|
Add v3.17.0-beta.5 to CHANGELOG
[ci skip]
(cherry picked from commit b5bfd50fe2572bb6d7aa522c73a11d6740429711)
|
CHANGELOG.md
|
@@ -1,5 +1,9 @@
# Ember Changelog
+### v3.17.0-beta.5 (February 18, 2020)
+
+- [#18730](https://github.com/emberjs/ember.js/pull/18730) Workaround for the Glimmer VM bug which encodes/decodes integer literals correctly.
+
### v3.17.0-beta.4 (February 10, 2020)
- [#18727](https://github.com/emberjs/ember.js/pull/18727) [BUGFIX] Avoid breaking {{-in-element}} usage
| false |
Other
|
emberjs
|
ember.js
|
b14380eb0200ea194cc4fa80211f78cc2806fce1.json
|
Add v3.17.0-beta.4 to CHANGELOG
[ci skip]
(cherry picked from commit 94dd76c11b6b2ec01bf5a8155379ab9a5b854f7a)
|
CHANGELOG.md
|
@@ -1,5 +1,11 @@
# Ember Changelog
+### v3.17.0-beta.4 (February 10, 2020)
+
+- [#18727](https://github.com/emberjs/ember.js/pull/18727) [BUGFIX] Avoid breaking {{-in-element}} usage
+- [#18728](https://github.com/emberjs/ember.js/pull/18728) [BUGFIX] Fix `{{#-in-element}}` double-clearing issue
+- [#18729](https://github.com/emberjs/ember.js/pull/18729) [BUGFIX] Remove deprecation for instantiation of new singleton instances (e.g. a service) during teardown (originally added in 3.16.1 by [#18717](https://github.com/emberjs/ember.js/pull/18717)).
+
### v3.17.0-beta.3 (February 3, 2020)
- [#18703](https://github.com/emberjs/ember.js/pull/18703) [BUGFIX] Correctly links ArrayProxy tags to `arrangedContent`
| false |
Other
|
emberjs
|
ember.js
|
c279c7a794779349396ef46bb30ba302b1142b04.json
|
Add v3.16.2 to CHANGELOG.md.
[ci skip]
(cherry picked from commit 83410de19a7080cb5f2641762243b97e5c709614)
|
CHANGELOG.md
|
@@ -19,6 +19,11 @@
- [#18688](https://github.com/emberjs/ember.js/pull/18688) / [#18621](https://github.com/emberjs/ember.js/pull/18621) Updates Glimmer-VM to v0.46
+### v3.16.2 (February 10, 2020)
+
+- [#18721](https://github.com/emberjs/ember.js/pull/18721) [BUGFIX release] Backport autotracking bugfixes
+- [#18729](https://github.com/emberjs/ember.js/pull/18729) [BUGFIX] Remove deprecation for instantiation of new singleton instances (e.g. a service) during teardown (originally added in 3.16.1 by [#18717](https://github.com/emberjs/ember.js/pull/18717)).
+
### v3.16.1 (January 31, 2020)
- [#18691](https://github.com/emberjs/ember.js/pull/18691) [BUGFIX] Updated `component` and `helper` blueprints to use `import { hbs } from 'ember-cli-htmlbars'`.
| false |
Other
|
emberjs
|
ember.js
|
e3b272e01914c8149a66dd06f83e8122fe82daa4.json
|
Add v3.16.1 to CHANGELOG.md.
(cherry picked from commit a9e90422d1cdab636f6f0c1c78c48505eb732cee)
|
CHANGELOG.md
|
@@ -19,6 +19,14 @@
- [#18688](https://github.com/emberjs/ember.js/pull/18688) / [#18621](https://github.com/emberjs/ember.js/pull/18621) Updates Glimmer-VM to v0.46
+### v3.16.1 (January 31, 2020)
+
+- [#18691](https://github.com/emberjs/ember.js/pull/18691) [BUGFIX] Updated `component` and `helper` blueprints to use `import { hbs } from 'ember-cli-htmlbars'`.
+- [#18698](https://github.com/emberjs/ember.js/pull/18698) [BUGFIX] Ensure tag updates are buffered
+- [#18713](https://github.com/emberjs/ember.js/pull/18713) [BUGFIX] Update `@glimmer/syntax` to ensure that using `<Title />`, `<Script />`, and `<Style />` does not error.
+- [#18717](https://github.com/emberjs/ember.js/pull/18717) [BUGFIX] Ensure instantiation cannot happen after destruction.
+- [#18720](https://github.com/emberjs/ember.js/pull/18720) [BUGFIX] Ensure correct `@ember/edition-utils` is used (1.2.0).
+
### v3.16.0 (January 20, 2020)
- [#18436](https://github.com/emberjs/ember.js/pull/18436) [DEPRECATION] Deprecate globals resolver per [RFC #331](https://github.com/emberjs/rfcs/blob/master/text/0331-deprecate-globals-resolver.md).
| false |
Other
|
emberjs
|
ember.js
|
30a6b17646d04174acb55c81e0090ec051cf7ab1.json
|
Add v3.17.0-beta.3 to CHANGELOG
[ci skip]
(cherry picked from commit 253187f5b165172fa1314f59dc888542d7a6baf7)
|
CHANGELOG.md
|
@@ -1,5 +1,14 @@
# Ember Changelog
+### v3.17.0-beta.3 (February 3, 2020)
+
+- [#18703](https://github.com/emberjs/ember.js/pull/18703) [BUGFIX] Correctly links ArrayProxy tags to `arrangedContent`
+- [#18707](https://github.com/emberjs/ember.js/pull/18707) [BUGFIX] Fixes tag chaining on Proxy mixins
+- [#18708](https://github.com/emberjs/ember.js/pull/18708) [BUGFIX] Ensures the arg proxy works with `get`
+- [#18717](https://github.com/emberjs/ember.js/pull/18717) [BUGFIX] Ensure instantiation cannot happen after destruction.
+- [#18720](https://github.com/emberjs/ember.js/pull/18720) [BUGFIX] Update minimum @ember/edition-utils to 1.2.0.
+- [#18714](https://github.com/emberjs/ember.js/pull/18714) Update glimmer packages to 0.47.4.
+
### v3.17.0-beta.2 (January 29, 2020)
- [#18691](https://github.com/emberjs/ember.js/pull/18691) [BUGFIX] Updated blueprints for component and helper tests to output the correct hbs import statement
| false |
Other
|
emberjs
|
ember.js
|
98b073b31700abe76b56f6a81feb9862b0b6e429.json
|
move template rendering related tests
|
packages/ember/tests/routing/decoupled_basic_test.js
|
@@ -4,7 +4,7 @@ import RSVP from 'rsvp';
import { compile } from 'ember-template-compiler';
import { Route, NoneLocation, HistoryLocation } from '@ember/-internals/routing';
import Controller from '@ember/controller';
-import { Object as EmberObject, A as emberA } from '@ember/-internals/runtime';
+import { Object as EmberObject } from '@ember/-internals/runtime';
import {
moduleFor,
ApplicationTestCase,
@@ -15,7 +15,6 @@ import {
} from 'internal-test-helpers';
import { run } from '@ember/runloop';
import { Mixin, set, addObserver } from '@ember/-internals/metal';
-import { Component } from '@ember/-internals/glimmer';
import Engine from '@ember/engine';
import { InternalTransition as Transition } from 'router_js';
@@ -125,264 +124,6 @@ moduleFor(
});
}
- [`@test The Homepage with explicit template name in renderTemplate`](assert) {
- this.add(
- 'route:home',
- Route.extend({
- renderTemplate() {
- this.render('homepage');
- },
- })
- );
-
- return this.visit('/').then(() => {
- let text = this.$('#troll').text();
- assert.equal(text, 'Megatroll', 'the homepage template was rendered');
- });
- }
-
- async [`@test an alternate template will pull in an alternate controller`](assert) {
- this.add(
- 'route:home',
- Route.extend({
- renderTemplate() {
- this.render('homepage');
- },
- })
- );
- this.add(
- 'controller:homepage',
- Controller.extend({
- init() {
- this._super(...arguments);
- this.name = 'Comes from homepage';
- },
- })
- );
-
- await this.visit('/');
-
- assert.equal(this.$('p').text(), 'Comes from homepage', 'the homepage template was rendered');
- }
-
- async [`@test An alternate template will pull in an alternate controller instead of controllerName`](
- assert
- ) {
- this.add(
- 'route:home',
- Route.extend({
- controllerName: 'foo',
- renderTemplate() {
- this.render('homepage');
- },
- })
- );
- this.add(
- 'controller:foo',
- Controller.extend({
- init() {
- this._super(...arguments);
- this.name = 'Comes from foo';
- },
- })
- );
- this.add(
- 'controller:homepage',
- Controller.extend({
- init() {
- this._super(...arguments);
- this.name = 'Comes from homepage';
- },
- })
- );
-
- await this.visit('/');
-
- assert.equal(this.$('p').text(), 'Comes from homepage', 'the homepage template was rendered');
- }
-
- async [`@test The template will pull in an alternate controller via key/value`](assert) {
- this.router.map(function() {
- this.route('homepage', { path: '/' });
- });
-
- this.add(
- 'route:homepage',
- Route.extend({
- renderTemplate() {
- this.render({ controller: 'home' });
- },
- })
- );
- this.add(
- 'controller:home',
- Controller.extend({
- init() {
- this._super(...arguments);
- this.name = 'Comes from home.';
- },
- })
- );
-
- await this.visit('/');
-
- assert.equal(
- this.$('p').text(),
- 'Comes from home.',
- 'the homepage template was rendered from data from the HomeController'
- );
- }
-
- async [`@test The Homepage with explicit template name in renderTemplate and controller`](
- assert
- ) {
- this.add(
- 'controller:home',
- Controller.extend({
- init() {
- this._super(...arguments);
- this.name = 'YES I AM HOME';
- },
- })
- );
- this.add(
- 'route:home',
- Route.extend({
- renderTemplate() {
- this.render('homepage');
- },
- })
- );
-
- await this.visit('/');
-
- assert.equal(this.$('p').text(), 'YES I AM HOME', 'The homepage template was rendered');
- }
-
- [`@feature(!EMBER_ROUTING_MODEL_ARG) Model passed via renderTemplate model is set as controller's model`](
- assert
- ) {
- this.addTemplate('bio', '<p>{{this.model.name}}</p>');
- this.add(
- 'route:home',
- Route.extend({
- renderTemplate() {
- this.render('bio', {
- model: { name: 'emberjs' },
- });
- },
- })
- );
-
- return this.visit('/').then(() => {
- let text = this.$('p').text();
-
- assert.equal(text, 'emberjs', `Passed model was set as controller's model`);
- });
- }
-
- async [`@feature(EMBER_ROUTING_MODEL_ARG) Model passed via renderTemplate model is set as controller's model`](
- assert
- ) {
- this.addTemplate(
- 'bio',
- '<p>Model: {{@model.name}}</p><p>Controller: {{this.model.name}}</p>'
- );
- this.add(
- 'route:home',
- Route.extend({
- renderTemplate() {
- this.render('bio', {
- model: { name: 'emberjs' },
- });
- },
- })
- );
-
- await this.visit('/');
-
- let text = this.$('p').text();
-
- assert.ok(
- text.indexOf('Model: emberjs') > -1,
- 'Passed model was available as the `@model` argument'
- );
-
- assert.ok(
- text.indexOf('Controller: emberjs') > -1,
- "Passed model was set as controller's `model` property"
- );
- }
-
- ['@test render uses templateName from route'](assert) {
- this.addTemplate('the_real_home_template', '<p>THIS IS THE REAL HOME</p>');
- this.add(
- 'route:home',
- Route.extend({
- templateName: 'the_real_home_template',
- })
- );
-
- return this.visit('/').then(() => {
- let text = this.$('p').text();
-
- assert.equal(text, 'THIS IS THE REAL HOME', 'the homepage template was rendered');
- });
- }
-
- ['@test defining templateName allows other templates to be rendered'](assert) {
- this.addTemplate('alert', `<div class='alert-box'>Invader!</div>`);
- this.addTemplate('the_real_home_template', `<p>THIS IS THE REAL HOME</p>{{outlet 'alert'}}`);
- this.add(
- 'route:home',
- Route.extend({
- templateName: 'the_real_home_template',
- actions: {
- showAlert() {
- this.render('alert', {
- into: 'home',
- outlet: 'alert',
- });
- },
- },
- })
- );
-
- return this.visit('/')
- .then(() => {
- let text = this.$('p').text();
- assert.equal(text, 'THIS IS THE REAL HOME', 'the homepage template was rendered');
-
- return runTask(() => this.appRouter.send('showAlert'));
- })
- .then(() => {
- let text = this.$('.alert-box').text();
-
- assert.equal(text, 'Invader!', 'Template for alert was rendered into the outlet');
- });
- }
-
- ['@test templateName is still used when calling render with no name and options'](assert) {
- this.addTemplate('alert', `<div class='alert-box'>Invader!</div>`);
- this.addTemplate('home', `<p>THIS IS THE REAL HOME</p>{{outlet 'alert'}}`);
-
- this.add(
- 'route:home',
- Route.extend({
- templateName: 'alert',
- renderTemplate() {
- this.render({});
- },
- })
- );
-
- return this.visit('/').then(() => {
- let text = this.$('.alert-box').text();
-
- assert.equal(text, 'Invader!', 'default templateName was rendered into outlet');
- });
- }
-
['@feature(!EMBER_ROUTING_MODEL_ARG) The Special Page returning a promise puts the app into a loading state until the promise is resolved']() {
this.router.map(function() {
this.route('home', { path: '/' });
@@ -612,9 +353,7 @@ moduleFor(
})
);
- let promise = runTask(() =>
- handleURLRejectsWith(this, assert, '/specials/1', 'Setup error')
- );
+ let promise = runTask(() => handleURLRejectsWith(this, assert, '/specials/1', 'Setup error'));
resolve(menuItem);
@@ -1440,216 +1179,60 @@ moduleFor(
});
}
- ['@test Generated names can be customized when providing routes with dot notation'](assert) {
- assert.expect(4);
+ ['@test Router accounts for rootURL on page load when using history location'](assert) {
+ let rootURL = window.location.pathname + '/app';
+ let postsTemplateRendered = false;
+ let setHistory;
- this.addTemplate('index', '<div>Index</div>');
- this.addTemplate('application', "<h1>Home</h1><div class='main'>{{outlet}}</div>");
- this.addTemplate('foo', "<div class='middle'>{{outlet}}</div>");
- this.addTemplate('bar', "<div class='bottom'>{{outlet}}</div>");
- this.addTemplate('bar.baz', '<p>{{name}}Bottom!</p>');
+ setHistory = function(obj, path) {
+ obj.set('history', { state: { path: path } });
+ };
- this.router.map(function() {
- this.route('foo', { path: '/top' }, function() {
- this.route('bar', { path: '/middle', resetNamespace: true }, function() {
- this.route('baz', { path: '/bottom' });
+ let location = HistoryLocation.create({
+ initState() {
+ let path = rootURL + '/posts';
+
+ setHistory(this, path);
+ this.set('location', {
+ pathname: path,
+ href: 'http://localhost/' + path,
});
- });
+ },
+
+ replaceState(path) {
+ setHistory(this, path);
+ },
+
+ pushState(path) {
+ setHistory(this, path);
+ },
});
- this.add(
- 'route:foo',
- Route.extend({
- renderTemplate() {
- assert.ok(true, 'FooBarRoute was called');
- return this._super(...arguments);
- },
- })
- );
+ this.router.reopen({
+ // location: 'historyTest',
+ location,
+ rootURL: rootURL,
+ });
+
+ this.router.map(function() {
+ this.route('posts', { path: '/posts' });
+ });
this.add(
- 'route:bar.baz',
+ 'route:posts',
Route.extend({
+ model() {},
renderTemplate() {
- assert.ok(true, 'BarBazRoute was called');
- return this._super(...arguments);
+ postsTemplateRendered = true;
},
})
);
- this.add(
- 'controller:bar',
- Controller.extend({
- name: 'Bar',
- })
- );
-
- this.add(
- 'controller:bar.baz',
- Controller.extend({
- name: 'BarBaz',
- })
- );
+ return this.visit('/').then(() => {
+ assert.ok(postsTemplateRendered, 'Posts route successfully stripped from rootURL');
- return this.visit('/top/middle/bottom').then(() => {
- assert.ok(true, '/top/middle/bottom has been handled');
- let rootElement = document.getElementById('qunit-fixture');
- assert.equal(
- getTextOf(rootElement.querySelector('.main .middle .bottom p')),
- 'BarBazBottom!',
- 'The templates were rendered into their appropriate parents'
- );
- });
- }
-
- ["@test Child routes render into their parent route's template by default"](assert) {
- this.addTemplate('index', '<div>Index</div>');
- this.addTemplate('application', "<h1>Home</h1><div class='main'>{{outlet}}</div>");
- this.addTemplate('top', "<div class='middle'>{{outlet}}</div>");
- this.addTemplate('middle', "<div class='bottom'>{{outlet}}</div>");
- this.addTemplate('middle.bottom', '<p>Bottom!</p>');
-
- this.router.map(function() {
- this.route('top', function() {
- this.route('middle', { resetNamespace: true }, function() {
- this.route('bottom');
- });
- });
- });
-
- return this.visit('/top/middle/bottom').then(() => {
- assert.ok(true, '/top/middle/bottom has been handled');
- let rootElement = document.getElementById('qunit-fixture');
- assert.equal(
- getTextOf(rootElement.querySelector('.main .middle .bottom p')),
- 'Bottom!',
- 'The templates were rendered into their appropriate parents'
- );
- });
- }
-
- ['@test Child routes render into specified template'](assert) {
- this.addTemplate('index', '<div>Index</div>');
- this.addTemplate('application', "<h1>Home</h1><div class='main'>{{outlet}}</div>");
- this.addTemplate('top', "<div class='middle'>{{outlet}}</div>");
- this.addTemplate('middle', "<div class='bottom'>{{outlet}}</div>");
- this.addTemplate('middle.bottom', '<p>Bottom!</p>');
-
- this.router.map(function() {
- this.route('top', function() {
- this.route('middle', { resetNamespace: true }, function() {
- this.route('bottom');
- });
- });
- });
-
- this.add(
- 'route:middle.bottom',
- Route.extend({
- renderTemplate() {
- this.render('middle/bottom', { into: 'top' });
- },
- })
- );
-
- return this.visit('/top/middle/bottom').then(() => {
- assert.ok(true, '/top/middle/bottom has been handled');
- let rootElement = document.getElementById('qunit-fixture');
- assert.equal(
- rootElement.querySelectorAll('.main .middle .bottom p').length,
- 0,
- 'should not render into the middle template'
- );
- assert.equal(
- getTextOf(rootElement.querySelector('.main .middle > p')),
- 'Bottom!',
- 'The template was rendered into the top template'
- );
- });
- }
-
- ['@test Rendering into specified template with slash notation'](assert) {
- this.addTemplate('person.profile', 'profile {{outlet}}');
- this.addTemplate('person.details', 'details!');
-
- this.router.map(function() {
- this.route('home', { path: '/' });
- });
-
- this.add(
- 'route:home',
- Route.extend({
- renderTemplate() {
- this.render('person/profile');
- this.render('person/details', { into: 'person/profile' });
- },
- })
- );
-
- return this.visit('/').then(() => {
- let rootElement = document.getElementById('qunit-fixture');
- assert.equal(
- rootElement.textContent.trim(),
- 'profile details!',
- 'The templates were rendered'
- );
- });
- }
-
- ['@test Router accounts for rootURL on page load when using history location'](assert) {
- let rootURL = window.location.pathname + '/app';
- let postsTemplateRendered = false;
- let setHistory;
-
- setHistory = function(obj, path) {
- obj.set('history', { state: { path: path } });
- };
-
- let location = HistoryLocation.create({
- initState() {
- let path = rootURL + '/posts';
-
- setHistory(this, path);
- this.set('location', {
- pathname: path,
- href: 'http://localhost/' + path,
- });
- },
-
- replaceState(path) {
- setHistory(this, path);
- },
-
- pushState(path) {
- setHistory(this, path);
- },
- });
-
- this.router.reopen({
- // location: 'historyTest',
- location,
- rootURL: rootURL,
- });
-
- this.router.map(function() {
- this.route('posts', { path: '/posts' });
- });
-
- this.add(
- 'route:posts',
- Route.extend({
- model() {},
- renderTemplate() {
- postsTemplateRendered = true;
- },
- })
- );
-
- return this.visit('/').then(() => {
- assert.ok(postsTemplateRendered, 'Posts route successfully stripped from rootURL');
-
- runDestroy(location);
- location = null;
+ runDestroy(location);
+ location = null;
});
}
@@ -1682,45 +1265,6 @@ moduleFor(
return this.visit('/');
}
- ['@test Only use route rendered into main outlet for default into property on child'](assert) {
- this.addTemplate('application', "{{outlet 'menu'}}{{outlet}}");
- this.addTemplate('posts', '{{outlet}}');
- this.addTemplate('posts.index', '<p class="posts-index">postsIndex</p>');
- this.addTemplate('posts.menu', '<div class="posts-menu">postsMenu</div>');
-
- this.router.map(function() {
- this.route('posts', function() {});
- });
-
- this.add(
- 'route:posts',
- Route.extend({
- renderTemplate() {
- this.render();
- this.render('posts/menu', {
- into: 'application',
- outlet: 'menu',
- });
- },
- })
- );
-
- return this.visit('/posts').then(() => {
- assert.ok(true, '/posts has been handled');
- let rootElement = document.getElementById('qunit-fixture');
- assert.equal(
- getTextOf(rootElement.querySelector('div.posts-menu')),
- 'postsMenu',
- 'The posts/menu template was rendered'
- );
- assert.equal(
- getTextOf(rootElement.querySelector('p.posts-index')),
- 'postsIndex',
- 'The posts/index template was rendered'
- );
- });
- }
-
['@test Generating a URL should not affect currentModel'](assert) {
this.router.map(function() {
this.route('post', { path: '/posts/:post_id' });
@@ -1770,1743 +1314,767 @@ moduleFor(
});
}
- ['@test Application template does not duplicate when re-rendered'](assert) {
- this.addTemplate('application', '<h3 class="render-once">I render once</h3>{{outlet}}');
+ ['@test Promises encountered on app load put app into loading state until resolved'](assert) {
+ assert.expect(2);
+ let deferred = RSVP.defer();
this.router.map(function() {
- this.route('posts');
+ this.route('index', { path: '/' });
});
this.add(
- 'route:application',
+ 'route:index',
Route.extend({
model() {
- return emberA();
+ return deferred.promise;
},
})
);
- return this.visit('/posts').then(() => {
- assert.ok(true, '/posts has been handled');
- let rootElement = document.getElementById('qunit-fixture');
- assert.equal(getTextOf(rootElement.querySelector('h3.render-once')), 'I render once');
- });
+ this.addTemplate('index', '<p>INDEX</p>');
+ this.addTemplate('loading', '<p>LOADING</p>');
+
+ run(() => this.visit('/'));
+ let rootElement = document.getElementById('qunit-fixture');
+ assert.equal(
+ getTextOf(rootElement.querySelector('p')),
+ 'LOADING',
+ 'The loading state is displaying.'
+ );
+ run(deferred.resolve);
+ assert.equal(
+ getTextOf(rootElement.querySelector('p')),
+ 'INDEX',
+ 'The index route is display.'
+ );
}
- ['@test Child routes should render inside the application template if the application template causes a redirect'](
- assert
- ) {
- this.addTemplate('application', '<h3>App</h3> {{outlet}}');
- this.addTemplate('posts', 'posts');
+ ['@test Router `willTransition` hook passes in cancellable transition'](assert) {
+ assert.expect(8);
+ this.router.reopen({
+ willTransition(_, _2, transition) {
+ assert.ok(true, 'willTransition was called');
+ if (transition.intent.url !== '/') {
+ transition.abort();
+ }
+ },
+ });
this.router.map(function() {
- this.route('posts');
- this.route('photos');
+ this.route('nork');
+ this.route('about');
});
this.add(
- 'route:application',
+ 'route:loading',
Route.extend({
- afterModel() {
- this.transitionTo('posts');
+ activate() {
+ assert.ok(false, 'LoadingRoute was not entered');
},
})
);
- return this.visit('/posts').then(() => {
- let rootElement = document.getElementById('qunit-fixture');
- assert.equal(rootElement.textContent.trim(), 'App posts');
- });
- }
-
- ["@feature(!EMBER_ROUTING_MODEL_ARG) The template is not re-rendered when the route's context changes"](
- assert
- ) {
- this.router.map(function() {
- this.route('page', { path: '/page/:name' });
- });
-
this.add(
- 'route:page',
+ 'route:nork',
Route.extend({
- model(params) {
- return EmberObject.create({ name: params.name });
+ activate() {
+ assert.ok(false, 'NorkRoute was not entered');
},
})
);
- let insertionCount = 0;
this.add(
- 'component:foo-bar',
- Component.extend({
- didInsertElement() {
- insertionCount += 1;
+ 'route:about',
+ Route.extend({
+ activate() {
+ assert.ok(false, 'AboutRoute was not entered');
},
})
);
- this.addTemplate('page', '<p>{{this.model.name}}{{foo-bar}}</p>');
+ let deprecation = /You attempted to override the "willTransition" method which is deprecated\./;
- let rootElement = document.getElementById('qunit-fixture');
- return this.visit('/page/first')
- .then(() => {
- assert.ok(true, '/page/first has been handled');
- assert.equal(getTextOf(rootElement.querySelector('p')), 'first');
- assert.equal(insertionCount, 1);
- return this.visit('/page/second');
- })
- .then(() => {
- assert.ok(true, '/page/second has been handled');
- assert.equal(getTextOf(rootElement.querySelector('p')), 'second');
- assert.equal(insertionCount, 1, 'view should have inserted only once');
- let router = this.applicationInstance.lookup('router:main');
- return run(() => router.transitionTo('page', EmberObject.create({ name: 'third' })));
- })
- .then(() => {
- assert.equal(getTextOf(rootElement.querySelector('p')), 'third');
- assert.equal(insertionCount, 1, 'view should still have inserted only once');
+ return expectDeprecationAsync(() => {
+ return this.visit('/').then(() => {
+ this.handleURLAborts(assert, '/nork', deprecation);
+ this.handleURLAborts(assert, '/about', deprecation);
});
+ }, deprecation);
}
- async ["@feature(EMBER_ROUTING_MODEL_ARG) The template is not re-rendered when the route's model changes"](
+ ['@test Aborting/redirecting the transition in `willTransition` prevents LoadingRoute from being entered'](
assert
) {
+ assert.expect(5);
+
this.router.map(function() {
- this.route('page', { path: '/page/:name' });
+ this.route('index');
+ this.route('nork');
+ this.route('about');
});
+ let redirect = false;
+
this.add(
- 'route:page',
+ 'route:index',
Route.extend({
- model(params) {
- return EmberObject.create({ name: params.name });
+ actions: {
+ willTransition(transition) {
+ assert.ok(true, 'willTransition was called');
+ if (redirect) {
+ // router.js won't refire `willTransition` for this redirect
+ this.transitionTo('about');
+ } else {
+ transition.abort();
+ }
+ },
},
})
);
- let insertionCount = 0;
+ let deferred = null;
+
this.add(
- 'component:foo-bar',
- Component.extend({
- didInsertElement() {
- insertionCount += 1;
+ 'route:loading',
+ Route.extend({
+ activate() {
+ assert.ok(deferred, 'LoadingRoute should be entered at this time');
+ },
+ deactivate() {
+ assert.ok(true, 'LoadingRoute was exited');
},
})
);
- this.addTemplate('page', '<p>{{@model.name}}{{foo-bar}}</p>');
-
- let rootElement = document.getElementById('qunit-fixture');
-
- await this.visit('/page/first');
-
- assert.ok(true, '/page/first has been handled');
- assert.equal(getTextOf(rootElement.querySelector('p')), 'first');
- assert.equal(insertionCount, 1);
-
- await this.visit('/page/second');
-
- assert.ok(true, '/page/second has been handled');
- assert.equal(getTextOf(rootElement.querySelector('p')), 'second');
- assert.equal(insertionCount, 1, 'view should have inserted only once');
- let router = this.applicationInstance.lookup('router:main');
-
- await run(() => router.transitionTo('page', EmberObject.create({ name: 'third' })));
-
- assert.equal(getTextOf(rootElement.querySelector('p')), 'third');
- assert.equal(insertionCount, 1, 'view should still have inserted only once');
- }
-
- ['@test The template is not re-rendered when two routes present the exact same template & controller'](
- assert
- ) {
- this.router.map(function() {
- this.route('first');
- this.route('second');
- this.route('third');
- this.route('fourth');
- });
-
- // Note add a component to test insertion
-
- let insertionCount = 0;
this.add(
- 'component:x-input',
- Component.extend({
- didInsertElement() {
- insertionCount += 1;
- },
+ 'route:nork',
+ Route.extend({
+ activate() {
+ assert.ok(true, 'NorkRoute was entered');
+ },
})
);
- let SharedRoute = Route.extend({
- setupController() {
- this.controllerFor('shared').set('message', 'This is the ' + this.routeName + ' message');
- },
-
- renderTemplate() {
- this.render('shared', { controller: 'shared' });
- },
- });
-
- this.add('route:shared', SharedRoute);
- this.add('route:first', SharedRoute.extend());
- this.add('route:second', SharedRoute.extend());
- this.add('route:third', SharedRoute.extend());
- this.add('route:fourth', SharedRoute.extend());
+ this.add(
+ 'route:about',
+ Route.extend({
+ activate() {
+ assert.ok(true, 'AboutRoute was entered');
+ },
+ model() {
+ if (deferred) {
+ return deferred.promise;
+ }
+ },
+ })
+ );
- this.add('controller:shared', Controller.extend());
+ return this.visit('/').then(() => {
+ let router = this.applicationInstance.lookup('router:main');
+ // Attempted transitions out of index should abort.
+ run(router, 'transitionTo', 'nork');
+ run(router, 'handleURL', '/nork');
- this.addTemplate('shared', '<p>{{message}}{{x-input}}</p>');
+ // Attempted transitions out of index should redirect to about
+ redirect = true;
+ run(router, 'transitionTo', 'nork');
+ run(router, 'transitionTo', 'index');
- let rootElement = document.getElementById('qunit-fixture');
- return this.visit('/first')
- .then(() => {
- assert.ok(true, '/first has been handled');
- assert.equal(getTextOf(rootElement.querySelector('p')), 'This is the first message');
- assert.equal(insertionCount, 1, 'expected one assertion');
- return this.visit('/second');
- })
- .then(() => {
- assert.ok(true, '/second has been handled');
- assert.equal(getTextOf(rootElement.querySelector('p')), 'This is the second message');
- assert.equal(insertionCount, 1, 'expected one assertion');
- return run(() => {
- this.applicationInstance
- .lookup('router:main')
- .transitionTo('third')
- .then(
- function() {
- assert.ok(true, 'expected transition');
- },
- function(reason) {
- assert.ok(false, 'unexpected transition failure: ', QUnit.jsDump.parse(reason));
- }
- );
- });
- })
- .then(() => {
- assert.equal(getTextOf(rootElement.querySelector('p')), 'This is the third message');
- assert.equal(insertionCount, 1, 'expected one assertion');
- return this.visit('fourth');
- })
- .then(() => {
- assert.ok(true, '/fourth has been handled');
- assert.equal(insertionCount, 1, 'expected one assertion');
- assert.equal(getTextOf(rootElement.querySelector('p')), 'This is the fourth message');
- });
+ // Redirected transitions out of index to a route with a
+ // promise model should pause the transition and
+ // activate LoadingRoute
+ deferred = RSVP.defer();
+ run(router, 'transitionTo', 'nork');
+ run(deferred.resolve);
+ });
}
- ['@test Promises encountered on app load put app into loading state until resolved'](assert) {
- assert.expect(2);
+ async ['@test `didTransition` event fires on the router'](assert) {
+ assert.expect(3);
- let deferred = RSVP.defer();
this.router.map(function() {
- this.route('index', { path: '/' });
+ this.route('nork');
});
- this.add(
- 'route:index',
- Route.extend({
- model() {
- return deferred.promise;
- },
- })
- );
+ await this.visit('/');
- this.addTemplate('index', '<p>INDEX</p>');
- this.addTemplate('loading', '<p>LOADING</p>');
+ let router = this.applicationInstance.lookup('router:main');
+ router.one('didTransition', function() {
+ assert.ok(true, 'didTransition fired on initial routing');
+ });
- run(() => this.visit('/'));
- let rootElement = document.getElementById('qunit-fixture');
- assert.equal(
- getTextOf(rootElement.querySelector('p')),
- 'LOADING',
- 'The loading state is displaying.'
- );
- run(deferred.resolve);
- assert.equal(
- getTextOf(rootElement.querySelector('p')),
- 'INDEX',
- 'The index route is display.'
- );
+ await this.visit('/');
+
+ router.one('didTransition', function() {
+ assert.ok(true, 'didTransition fired on the router');
+ assert.equal(
+ router.get('url'),
+ '/nork',
+ 'The url property is updated by the time didTransition fires'
+ );
+ });
+
+ await this.visit('/nork');
}
- ['@test Route should tear down multiple outlets'](assert) {
- this.addTemplate('application', "{{outlet 'menu'}}{{outlet}}{{outlet 'footer'}}");
- this.addTemplate('posts', '{{outlet}}');
- this.addTemplate('users', 'users');
- this.addTemplate('posts.index', '<p class="posts-index">postsIndex</p>');
- this.addTemplate('posts.menu', '<div class="posts-menu">postsMenu</div>');
- this.addTemplate('posts.footer', '<div class="posts-footer">postsFooter</div>');
+ ['@test `activate` event fires on the route'](assert) {
+ assert.expect(2);
+
+ let eventFired = 0;
this.router.map(function() {
- this.route('posts', function() {});
- this.route('users', function() {});
+ this.route('nork');
});
this.add(
- 'route:posts',
+ 'route:nork',
Route.extend({
- renderTemplate() {
- this.render('posts/menu', {
- into: 'application',
- outlet: 'menu',
- });
-
- this.render();
+ init() {
+ this._super(...arguments);
- this.render('posts/footer', {
- into: 'application',
- outlet: 'footer',
+ this.on('activate', function() {
+ assert.equal(++eventFired, 1, 'activate event is fired once');
});
},
+
+ activate() {
+ assert.ok(true, 'activate hook is called');
+ },
})
);
- let rootElement = document.getElementById('qunit-fixture');
- return this.visit('/posts')
- .then(() => {
- assert.ok(true, '/posts has been handled');
- assert.equal(
- getTextOf(rootElement.querySelector('div.posts-menu')),
- 'postsMenu',
- 'The posts/menu template was rendered'
- );
- assert.equal(
- getTextOf(rootElement.querySelector('p.posts-index')),
- 'postsIndex',
- 'The posts/index template was rendered'
- );
- assert.equal(
- getTextOf(rootElement.querySelector('div.posts-footer')),
- 'postsFooter',
- 'The posts/footer template was rendered'
- );
-
- return this.visit('/users');
- })
- .then(() => {
- assert.ok(true, '/users has been handled');
- assert.equal(
- rootElement.querySelector('div.posts-menu'),
- null,
- 'The posts/menu template was removed'
- );
- assert.equal(
- rootElement.querySelector('p.posts-index'),
- null,
- 'The posts/index template was removed'
- );
- assert.equal(
- rootElement.querySelector('div.posts-footer'),
- null,
- 'The posts/footer template was removed'
- );
- });
+ return this.visit('/nork');
}
- ['@test Route supports clearing outlet explicitly'](assert) {
- this.addTemplate('application', "{{outlet}}{{outlet 'modal'}}");
- this.addTemplate('posts', '{{outlet}}');
- this.addTemplate('users', 'users');
- this.addTemplate('posts.index', '<div class="posts-index">postsIndex {{outlet}}</div>');
- this.addTemplate('posts.modal', '<div class="posts-modal">postsModal</div>');
- this.addTemplate('posts.extra', '<div class="posts-extra">postsExtra</div>');
+ ['@test `deactivate` event fires on the route'](assert) {
+ assert.expect(2);
+
+ let eventFired = 0;
this.router.map(function() {
- this.route('posts', function() {});
- this.route('users', function() {});
+ this.route('nork');
+ this.route('dork');
});
this.add(
- 'route:posts',
+ 'route:nork',
Route.extend({
- actions: {
- showModal() {
- this.render('posts/modal', {
- into: 'application',
- outlet: 'modal',
- });
- },
- hideModal() {
- this.disconnectOutlet({
- outlet: 'modal',
- parentView: 'application',
- });
- },
+ init() {
+ this._super(...arguments);
+
+ this.on('deactivate', function() {
+ assert.equal(++eventFired, 1, 'deactivate event is fired once');
+ });
},
- })
- );
- this.add(
- 'route:posts.index',
- Route.extend({
- actions: {
- showExtra() {
- this.render('posts/extra', {
- into: 'posts/index',
- });
- },
- hideExtra() {
- this.disconnectOutlet({ parentView: 'posts/index' });
- },
+ deactivate() {
+ assert.ok(true, 'deactivate hook is called');
},
})
);
- let rootElement = document.getElementById('qunit-fixture');
-
- return this.visit('/posts')
- .then(() => {
- let router = this.applicationInstance.lookup('router:main');
-
- assert.equal(
- getTextOf(rootElement.querySelector('div.posts-index')),
- 'postsIndex',
- 'The posts/index template was rendered'
- );
- run(() => router.send('showModal'));
- assert.equal(
- getTextOf(rootElement.querySelector('div.posts-modal')),
- 'postsModal',
- 'The posts/modal template was rendered'
- );
- run(() => router.send('showExtra'));
-
- assert.equal(
- getTextOf(rootElement.querySelector('div.posts-extra')),
- 'postsExtra',
- 'The posts/extra template was rendered'
- );
- run(() => router.send('hideModal'));
-
- assert.equal(
- rootElement.querySelector('div.posts-modal'),
- null,
- 'The posts/modal template was removed'
- );
- run(() => router.send('hideExtra'));
-
- assert.equal(
- rootElement.querySelector('div.posts-extra'),
- null,
- 'The posts/extra template was removed'
- );
- run(function() {
- router.send('showModal');
- });
- assert.equal(
- getTextOf(rootElement.querySelector('div.posts-modal')),
- 'postsModal',
- 'The posts/modal template was rendered'
- );
- run(function() {
- router.send('showExtra');
- });
- assert.equal(
- getTextOf(rootElement.querySelector('div.posts-extra')),
- 'postsExtra',
- 'The posts/extra template was rendered'
- );
- return this.visit('/users');
- })
- .then(() => {
- assert.equal(
- rootElement.querySelector('div.posts-index'),
- null,
- 'The posts/index template was removed'
- );
- assert.equal(
- rootElement.querySelector('div.posts-modal'),
- null,
- 'The posts/modal template was removed'
- );
- assert.equal(
- rootElement.querySelector('div.posts-extra'),
- null,
- 'The posts/extra template was removed'
- );
- });
+ return this.visit('/nork').then(() => this.visit('/dork'));
}
- ['@test Route supports clearing outlet using string parameter'](assert) {
- this.addTemplate('application', "{{outlet}}{{outlet 'modal'}}");
- this.addTemplate('posts', '{{outlet}}');
- this.addTemplate('users', 'users');
- this.addTemplate('posts.index', '<div class="posts-index">postsIndex {{outlet}}</div>');
- this.addTemplate('posts.modal', '<div class="posts-modal">postsModal</div>');
+ ['@test Actions can be handled by inherited action handlers'](assert) {
+ assert.expect(4);
- this.router.map(function() {
- this.route('posts', function() {});
- this.route('users', function() {});
+ let SuperRoute = Route.extend({
+ actions: {
+ foo() {
+ assert.ok(true, 'foo');
+ },
+ bar(msg) {
+ assert.equal(msg, 'HELLO');
+ },
+ },
+ });
+
+ let RouteMixin = Mixin.create({
+ actions: {
+ bar(msg) {
+ assert.equal(msg, 'HELLO');
+ this._super(msg);
+ },
+ },
});
this.add(
- 'route:posts',
- Route.extend({
+ 'route:home',
+ SuperRoute.extend(RouteMixin, {
actions: {
- showModal() {
- this.render('posts/modal', {
- into: 'application',
- outlet: 'modal',
- });
- },
- hideModal() {
- this.disconnectOutlet('modal');
+ baz() {
+ assert.ok(true, 'baz');
},
},
})
);
- let rootElement = document.getElementById('qunit-fixture');
- return this.visit('/posts')
- .then(() => {
- let router = this.applicationInstance.lookup('router:main');
- assert.equal(
- getTextOf(rootElement.querySelector('div.posts-index')),
- 'postsIndex',
- 'The posts/index template was rendered'
- );
- run(() => router.send('showModal'));
- assert.equal(
- getTextOf(rootElement.querySelector('div.posts-modal')),
- 'postsModal',
- 'The posts/modal template was rendered'
- );
- run(() => router.send('hideModal'));
- assert.equal(
- rootElement.querySelector('div.posts-modal'),
- null,
- 'The posts/modal template was removed'
- );
- return this.visit('/users');
- })
- .then(() => {
- assert.equal(
- rootElement.querySelector('div.posts-index'),
- null,
- 'The posts/index template was removed'
- );
- assert.equal(
- rootElement.querySelector('div.posts-modal'),
- null,
- 'The posts/modal template was removed'
- );
- });
- }
+ this.addTemplate(
+ 'home',
+ `
+ <a class="do-foo" {{action "foo"}}>Do foo</a>
+ <a class="do-bar-with-arg" {{action "bar" "HELLO"}}>Do bar with arg</a>
+ <a class="do-baz" {{action "baz"}}>Do bar</a>
+ `
+ );
- ['@test Route silently fails when cleaning an outlet from an inactive view'](assert) {
- assert.expect(1); // handleURL
+ return this.visit('/').then(() => {
+ let rootElement = document.getElementById('qunit-fixture');
+ rootElement.querySelector('.do-foo').click();
+ rootElement.querySelector('.do-bar-with-arg').click();
+ rootElement.querySelector('.do-baz').click();
+ });
+ }
- this.addTemplate('application', '{{outlet}}');
- this.addTemplate('posts', "{{outlet 'modal'}}");
- this.addTemplate('modal', 'A Yo.');
+ ['@test transitionTo returns Transition when passed a route name'](assert) {
+ assert.expect(1);
this.router.map(function() {
- this.route('posts');
+ this.route('root', { path: '/' });
+ this.route('bar');
});
- this.add(
- 'route:posts',
- Route.extend({
- actions: {
- hideSelf() {
- this.disconnectOutlet({
- outlet: 'main',
- parentView: 'application',
- });
- },
- showModal() {
- this.render('modal', { into: 'posts', outlet: 'modal' });
- },
- hideModal() {
- this.disconnectOutlet({ outlet: 'modal', parentView: 'posts' });
- },
- },
- })
- );
-
- return this.visit('/posts').then(() => {
- assert.ok(true, '/posts has been handled');
+ return this.visit('/').then(() => {
let router = this.applicationInstance.lookup('router:main');
- run(() => router.send('showModal'));
- run(() => router.send('hideSelf'));
- run(() => router.send('hideModal'));
+ let transition = run(() => router.transitionTo('bar'));
+ assert.equal(transition instanceof Transition, true);
});
}
- ['@test Router `willTransition` hook passes in cancellable transition'](assert) {
- assert.expect(8);
- this.router.reopen({
- willTransition(_, _2, transition) {
- assert.ok(true, 'willTransition was called');
- if (transition.intent.url !== '/') {
- transition.abort();
- }
- },
- });
+ ['@test transitionTo returns Transition when passed a url'](assert) {
+ assert.expect(1);
this.router.map(function() {
- this.route('nork');
- this.route('about');
+ this.route('root', { path: '/' });
+ this.route('bar', function() {
+ this.route('baz');
+ });
});
- this.add(
- 'route:loading',
- Route.extend({
- activate() {
- assert.ok(false, 'LoadingRoute was not entered');
- },
- })
- );
-
- this.add(
- 'route:nork',
- Route.extend({
- activate() {
- assert.ok(false, 'NorkRoute was not entered');
- },
- })
- );
-
- this.add(
- 'route:about',
- Route.extend({
- activate() {
- assert.ok(false, 'AboutRoute was not entered');
- },
- })
- );
-
- let deprecation = /You attempted to override the "willTransition" method which is deprecated\./;
-
- return expectDeprecationAsync(() => {
- return this.visit('/').then(() => {
- this.handleURLAborts(assert, '/nork', deprecation);
- this.handleURLAborts(assert, '/about', deprecation);
- });
- }, deprecation);
- }
-
- ['@test Aborting/redirecting the transition in `willTransition` prevents LoadingRoute from being entered'](
- assert
- ) {
- assert.expect(5);
-
- this.router.map(function() {
- this.route('index');
- this.route('nork');
- this.route('about');
- });
-
- let redirect = false;
-
- this.add(
- 'route:index',
- Route.extend({
- actions: {
- willTransition(transition) {
- assert.ok(true, 'willTransition was called');
- if (redirect) {
- // router.js won't refire `willTransition` for this redirect
- this.transitionTo('about');
- } else {
- transition.abort();
- }
- },
- },
- })
- );
-
- let deferred = null;
-
- this.add(
- 'route:loading',
- Route.extend({
- activate() {
- assert.ok(deferred, 'LoadingRoute should be entered at this time');
- },
- deactivate() {
- assert.ok(true, 'LoadingRoute was exited');
- },
- })
- );
-
- this.add(
- 'route:nork',
- Route.extend({
- activate() {
- assert.ok(true, 'NorkRoute was entered');
- },
- })
- );
-
- this.add(
- 'route:about',
- Route.extend({
- activate() {
- assert.ok(true, 'AboutRoute was entered');
- },
- model() {
- if (deferred) {
- return deferred.promise;
- }
- },
- })
- );
-
- return this.visit('/').then(() => {
- let router = this.applicationInstance.lookup('router:main');
- // Attempted transitions out of index should abort.
- run(router, 'transitionTo', 'nork');
- run(router, 'handleURL', '/nork');
-
- // Attempted transitions out of index should redirect to about
- redirect = true;
- run(router, 'transitionTo', 'nork');
- run(router, 'transitionTo', 'index');
-
- // Redirected transitions out of index to a route with a
- // promise model should pause the transition and
- // activate LoadingRoute
- deferred = RSVP.defer();
- run(router, 'transitionTo', 'nork');
- run(deferred.resolve);
- });
- }
-
- async ['@test `didTransition` event fires on the router'](assert) {
- assert.expect(3);
-
- this.router.map(function() {
- this.route('nork');
- });
-
- await this.visit('/');
-
- let router = this.applicationInstance.lookup('router:main');
- router.one('didTransition', function() {
- assert.ok(true, 'didTransition fired on initial routing');
- });
-
- await this.visit('/');
-
- router.one('didTransition', function() {
- assert.ok(true, 'didTransition fired on the router');
- assert.equal(
- router.get('url'),
- '/nork',
- 'The url property is updated by the time didTransition fires'
- );
- });
-
- await this.visit('/nork');
- }
-
- ['@test `activate` event fires on the route'](assert) {
- assert.expect(2);
-
- let eventFired = 0;
-
- this.router.map(function() {
- this.route('nork');
- });
-
- this.add(
- 'route:nork',
- Route.extend({
- init() {
- this._super(...arguments);
-
- this.on('activate', function() {
- assert.equal(++eventFired, 1, 'activate event is fired once');
- });
- },
-
- activate() {
- assert.ok(true, 'activate hook is called');
- },
- })
- );
-
- return this.visit('/nork');
- }
-
- ['@test `deactivate` event fires on the route'](assert) {
- assert.expect(2);
-
- let eventFired = 0;
-
- this.router.map(function() {
- this.route('nork');
- this.route('dork');
- });
-
- this.add(
- 'route:nork',
- Route.extend({
- init() {
- this._super(...arguments);
-
- this.on('deactivate', function() {
- assert.equal(++eventFired, 1, 'deactivate event is fired once');
- });
- },
-
- deactivate() {
- assert.ok(true, 'deactivate hook is called');
- },
- })
- );
-
- return this.visit('/nork').then(() => this.visit('/dork'));
- }
-
- ['@test Actions can be handled by inherited action handlers'](assert) {
- assert.expect(4);
-
- let SuperRoute = Route.extend({
- actions: {
- foo() {
- assert.ok(true, 'foo');
- },
- bar(msg) {
- assert.equal(msg, 'HELLO');
- },
- },
- });
-
- let RouteMixin = Mixin.create({
- actions: {
- bar(msg) {
- assert.equal(msg, 'HELLO');
- this._super(msg);
- },
- },
- });
-
- this.add(
- 'route:home',
- SuperRoute.extend(RouteMixin, {
- actions: {
- baz() {
- assert.ok(true, 'baz');
- },
- },
- })
- );
-
- this.addTemplate(
- 'home',
- `
- <a class="do-foo" {{action "foo"}}>Do foo</a>
- <a class="do-bar-with-arg" {{action "bar" "HELLO"}}>Do bar with arg</a>
- <a class="do-baz" {{action "baz"}}>Do bar</a>
- `
- );
-
- return this.visit('/').then(() => {
- let rootElement = document.getElementById('qunit-fixture');
- rootElement.querySelector('.do-foo').click();
- rootElement.querySelector('.do-bar-with-arg').click();
- rootElement.querySelector('.do-baz').click();
- });
- }
-
- ['@test transitionTo returns Transition when passed a route name'](assert) {
- assert.expect(1);
-
- this.router.map(function() {
- this.route('root', { path: '/' });
- this.route('bar');
- });
-
- return this.visit('/').then(() => {
- let router = this.applicationInstance.lookup('router:main');
- let transition = run(() => router.transitionTo('bar'));
- assert.equal(transition instanceof Transition, true);
- });
- }
-
- ['@test transitionTo returns Transition when passed a url'](assert) {
- assert.expect(1);
-
- this.router.map(function() {
- this.route('root', { path: '/' });
- this.route('bar', function() {
- this.route('baz');
- });
- });
-
- return this.visit('/').then(() => {
- let router = this.applicationInstance.lookup('router:main');
- let transition = run(() => router.transitionTo('/bar/baz'));
- assert.equal(transition instanceof Transition, true);
- });
- }
-
- ['@test currentRouteName is a property installed on ApplicationController that can be used in transitionTo'](
- assert
- ) {
- assert.expect(36);
-
- this.router.map(function() {
- this.route('index', { path: '/' });
- this.route('be', function() {
- this.route('excellent', { resetNamespace: true }, function() {
- this.route('to', { resetNamespace: true }, function() {
- this.route('each', { resetNamespace: true }, function() {
- this.route('other');
- });
- });
- });
- });
- });
-
- return this.visit('/').then(() => {
- let appController = this.applicationInstance.lookup('controller:application');
- let router = this.applicationInstance.lookup('router:main');
-
- function transitionAndCheck(path, expectedPath, expectedRouteName) {
- if (path) {
- run(router, 'transitionTo', path);
- }
- expectDeprecation(() => {
- assert.equal(appController.get('currentPath'), expectedPath);
- assert.equal(appController.get('currentRouteName'), expectedRouteName);
- }, 'Accessing `currentPath` on `controller:application` is deprecated, use the `currentPath` property on `service:router` instead.');
- }
-
- transitionAndCheck(null, 'index', 'index');
- transitionAndCheck('/be', 'be.index', 'be.index');
- transitionAndCheck('/be/excellent', 'be.excellent.index', 'excellent.index');
- transitionAndCheck('/be/excellent/to', 'be.excellent.to.index', 'to.index');
- transitionAndCheck('/be/excellent/to/each', 'be.excellent.to.each.index', 'each.index');
- transitionAndCheck(
- '/be/excellent/to/each/other',
- 'be.excellent.to.each.other',
- 'each.other'
- );
-
- transitionAndCheck('index', 'index', 'index');
- transitionAndCheck('be', 'be.index', 'be.index');
- transitionAndCheck('excellent', 'be.excellent.index', 'excellent.index');
- transitionAndCheck('to.index', 'be.excellent.to.index', 'to.index');
- transitionAndCheck('each', 'be.excellent.to.each.index', 'each.index');
- transitionAndCheck('each.other', 'be.excellent.to.each.other', 'each.other');
- });
- }
-
- ['@test Specifying non-existent controller name in route#render throws'](assert) {
- assert.expect(1);
-
- this.router.map(function() {
- this.route('home', { path: '/' });
- });
-
- this.add(
- 'route:home',
- Route.extend({
- renderTemplate() {
- expectAssertion(() => {
- this.render('homepage', {
- controller: 'stefanpenneristhemanforme',
- });
- }, "You passed `controller: 'stefanpenneristhemanforme'` into the `render` method, but no such controller could be found.");
- },
- })
- );
-
- return this.visit('/');
- }
-
- ["@test Redirecting with null model doesn't error out"](assert) {
- this.router.map(function() {
- this.route('home', { path: '/' });
- this.route('about', { path: '/about/:hurhurhur' });
- });
-
- this.add(
- 'route:about',
- Route.extend({
- serialize: function(model) {
- if (model === null) {
- return { hurhurhur: 'TreeklesMcGeekles' };
- }
- },
- })
- );
-
- this.add(
- 'route:home',
- Route.extend({
- beforeModel() {
- this.transitionTo('about', null);
- },
- })
- );
-
- return this.visit('/').then(() => {
- let router = this.applicationInstance.lookup('router:main');
- assert.equal(router.get('location.path'), '/about/TreeklesMcGeekles');
- });
- }
-
- async ['@test rejecting the model hooks promise with a non-error prints the `message` property'](
- assert
- ) {
- assert.expect(5);
-
- let rejectedMessage = 'OMG!! SOOOOOO BAD!!!!';
- let rejectedStack = 'Yeah, buddy: stack gets printed too.';
-
- this.router.map(function() {
- this.route('yippie', { path: '/' });
- });
-
- console.error = function(initialMessage, errorMessage, errorStack) {
- assert.equal(
- initialMessage,
- 'Error while processing route: yippie',
- 'a message with the current route name is printed'
- );
- assert.equal(
- errorMessage,
- rejectedMessage,
- "the rejected reason's message property is logged"
- );
- assert.equal(errorStack, rejectedStack, "the rejected reason's stack property is logged");
- };
-
- this.add(
- 'route:yippie',
- Route.extend({
- model() {
- return RSVP.reject({
- message: rejectedMessage,
- stack: rejectedStack,
- });
- },
- })
- );
-
- await assert.rejects(
- this.visit('/'),
- function(err) {
- assert.equal(err.message, rejectedMessage);
- return true;
- },
- 'expected an exception'
- );
- }
-
- async ['@test rejecting the model hooks promise with an error with `errorThrown` property prints `errorThrown.message` property'](
- assert
- ) {
- assert.expect(5);
- let rejectedMessage = 'OMG!! SOOOOOO BAD!!!!';
- let rejectedStack = 'Yeah, buddy: stack gets printed too.';
-
- this.router.map(function() {
- this.route('yippie', { path: '/' });
- });
-
- console.error = function(initialMessage, errorMessage, errorStack) {
- assert.equal(
- initialMessage,
- 'Error while processing route: yippie',
- 'a message with the current route name is printed'
- );
- assert.equal(
- errorMessage,
- rejectedMessage,
- "the rejected reason's message property is logged"
- );
- assert.equal(errorStack, rejectedStack, "the rejected reason's stack property is logged");
- };
-
- this.add(
- 'route:yippie',
- Route.extend({
- model() {
- return RSVP.reject({
- errorThrown: { message: rejectedMessage, stack: rejectedStack },
- });
- },
- })
- );
-
- await assert.rejects(
- this.visit('/'),
- function({ errorThrown: err }) {
- assert.equal(err.message, rejectedMessage);
- return true;
- },
- 'expected an exception'
- );
- }
-
- async ['@test rejecting the model hooks promise with no reason still logs error'](assert) {
- assert.expect(2);
- this.router.map(function() {
- this.route('wowzers', { path: '/' });
- });
-
- console.error = function(initialMessage) {
- assert.equal(
- initialMessage,
- 'Error while processing route: wowzers',
- 'a message with the current route name is printed'
- );
- };
-
- this.add(
- 'route:wowzers',
- Route.extend({
- model() {
- return RSVP.reject();
- },
- })
- );
-
- await assert.rejects(this.visit('/'));
- }
-
- async ['@test rejecting the model hooks promise with a string shows a good error'](assert) {
- assert.expect(3);
- let rejectedMessage = 'Supercalifragilisticexpialidocious';
-
- this.router.map(function() {
- this.route('yondo', { path: '/' });
- });
-
- console.error = function(initialMessage, errorMessage) {
- assert.equal(
- initialMessage,
- 'Error while processing route: yondo',
- 'a message with the current route name is printed'
- );
- assert.equal(
- errorMessage,
- rejectedMessage,
- "the rejected reason's message property is logged"
- );
- };
-
- this.add(
- 'route:yondo',
- Route.extend({
- model() {
- return RSVP.reject(rejectedMessage);
- },
- })
- );
-
- await assert.rejects(this.visit('/'), new RegExp(rejectedMessage), 'expected an exception');
- }
-
- ["@test willLeave, willChangeContext, willChangeModel actions don't fire unless feature flag enabled"](
- assert
- ) {
- assert.expect(1);
-
- this.router.map(function() {
- this.route('about');
- });
-
- function shouldNotFire() {
- assert.ok(false, "this action shouldn't have been received");
- }
-
- this.add(
- 'route:index',
- Route.extend({
- actions: {
- willChangeModel: shouldNotFire,
- willChangeContext: shouldNotFire,
- willLeave: shouldNotFire,
- },
- })
- );
-
- this.add(
- 'route:about',
- Route.extend({
- setupController() {
- assert.ok(true, 'about route was entered');
- },
- })
- );
-
- return this.visit('/about');
- }
-
- async ['@test Errors in transitionTo within redirect hook are logged'](assert) {
- assert.expect(4);
- let actual = [];
-
- this.router.map(function() {
- this.route('yondo', { path: '/' });
- this.route('stink-bomb');
- });
-
- this.add(
- 'route:yondo',
- Route.extend({
- redirect() {
- this.transitionTo('stink-bomb', { something: 'goes boom' });
- },
- })
- );
-
- console.error = function() {
- // push the arguments onto an array so we can detect if the error gets logged twice
- actual.push(arguments);
- };
-
- await assert.rejects(this.visit('/'), /More context objects were passed/);
-
- assert.equal(actual.length, 1, 'the error is only logged once');
- assert.equal(actual[0][0], 'Error while processing route: yondo', 'source route is printed');
- assert.ok(
- actual[0][1].match(
- /More context objects were passed than there are dynamic segments for the route: stink-bomb/
- ),
- 'the error is printed'
- );
- }
-
- ['@test Errors in transition show error template if available'](assert) {
- this.addTemplate('error', "<div id='error'>Error!</div>");
-
- this.router.map(function() {
- this.route('yondo', { path: '/' });
- this.route('stink-bomb');
- });
-
- this.add(
- 'route:yondo',
- Route.extend({
- redirect() {
- this.transitionTo('stink-bomb', { something: 'goes boom' });
- },
- })
- );
- console.error = () => {};
-
return this.visit('/').then(() => {
- let rootElement = document.querySelector('#qunit-fixture');
- assert.equal(
- rootElement.querySelectorAll('#error').length,
- 1,
- 'Error template was rendered.'
- );
+ let router = this.applicationInstance.lookup('router:main');
+ let transition = run(() => router.transitionTo('/bar/baz'));
+ assert.equal(transition instanceof Transition, true);
});
}
- ['@test Route#resetController gets fired when changing models and exiting routes'](assert) {
- assert.expect(4);
+ ['@test currentRouteName is a property installed on ApplicationController that can be used in transitionTo'](
+ assert
+ ) {
+ assert.expect(36);
this.router.map(function() {
- this.route('a', function() {
- this.route('b', { path: '/b/:id', resetNamespace: true }, function() {});
- this.route('c', { path: '/c/:id', resetNamespace: true }, function() {});
+ this.route('index', { path: '/' });
+ this.route('be', function() {
+ this.route('excellent', { resetNamespace: true }, function() {
+ this.route('to', { resetNamespace: true }, function() {
+ this.route('each', { resetNamespace: true }, function() {
+ this.route('other');
+ });
+ });
+ });
});
- this.route('out');
});
- let calls = [];
-
- let SpyRoute = Route.extend({
- setupController(/* controller, model, transition */) {
- calls.push(['setup', this.routeName]);
- },
+ return this.visit('/').then(() => {
+ let appController = this.applicationInstance.lookup('controller:application');
+ let router = this.applicationInstance.lookup('router:main');
- resetController(/* controller */) {
- calls.push(['reset', this.routeName]);
- },
- });
+ function transitionAndCheck(path, expectedPath, expectedRouteName) {
+ if (path) {
+ run(router, 'transitionTo', path);
+ }
+ expectDeprecation(() => {
+ assert.equal(appController.get('currentPath'), expectedPath);
+ assert.equal(appController.get('currentRouteName'), expectedRouteName);
+ }, 'Accessing `currentPath` on `controller:application` is deprecated, use the `currentPath` property on `service:router` instead.');
+ }
- this.add('route:a', SpyRoute.extend());
- this.add('route:b', SpyRoute.extend());
- this.add('route:c', SpyRoute.extend());
- this.add('route:out', SpyRoute.extend());
+ transitionAndCheck(null, 'index', 'index');
+ transitionAndCheck('/be', 'be.index', 'be.index');
+ transitionAndCheck('/be/excellent', 'be.excellent.index', 'excellent.index');
+ transitionAndCheck('/be/excellent/to', 'be.excellent.to.index', 'to.index');
+ transitionAndCheck('/be/excellent/to/each', 'be.excellent.to.each.index', 'each.index');
+ transitionAndCheck(
+ '/be/excellent/to/each/other',
+ 'be.excellent.to.each.other',
+ 'each.other'
+ );
- let router;
- return this.visit('/')
- .then(() => {
- router = this.applicationInstance.lookup('router:main');
- assert.deepEqual(calls, []);
- return run(router, 'transitionTo', 'b', 'b-1');
- })
- .then(() => {
- assert.deepEqual(calls, [['setup', 'a'], ['setup', 'b']]);
- calls.length = 0;
- return run(router, 'transitionTo', 'c', 'c-1');
- })
- .then(() => {
- assert.deepEqual(calls, [['reset', 'b'], ['setup', 'c']]);
- calls.length = 0;
- return run(router, 'transitionTo', 'out');
- })
- .then(() => {
- assert.deepEqual(calls, [['reset', 'c'], ['reset', 'a'], ['setup', 'out']]);
- });
+ transitionAndCheck('index', 'index', 'index');
+ transitionAndCheck('be', 'be.index', 'be.index');
+ transitionAndCheck('excellent', 'be.excellent.index', 'excellent.index');
+ transitionAndCheck('to.index', 'be.excellent.to.index', 'to.index');
+ transitionAndCheck('each', 'be.excellent.to.each.index', 'each.index');
+ transitionAndCheck('each.other', 'be.excellent.to.each.other', 'each.other');
+ });
}
- async ['@test Exception during initialization of non-initial route is not swallowed'](assert) {
+ ["@test Redirecting with null model doesn't error out"](assert) {
this.router.map(function() {
- this.route('boom');
+ this.route('home', { path: '/' });
+ this.route('about', { path: '/about/:hurhurhur' });
});
+
this.add(
- 'route:boom',
+ 'route:about',
Route.extend({
- init() {
- throw new Error('boom!');
+ serialize: function(model) {
+ if (model === null) {
+ return { hurhurhur: 'TreeklesMcGeekles' };
+ }
},
})
);
- await assert.rejects(this.visit('/boom'), /\bboom\b/);
- }
-
- async ['@test Exception during initialization of initial route is not swallowed'](assert) {
- this.router.map(function() {
- this.route('boom', { path: '/' });
- });
this.add(
- 'route:boom',
+ 'route:home',
Route.extend({
- init() {
- throw new Error('boom!');
+ beforeModel() {
+ this.transitionTo('about', null);
},
})
);
- await assert.rejects(this.visit('/'), /\bboom\b/);
- }
-
- ['@test {{outlet}} works when created after initial render'](assert) {
- this.addTemplate('sample', 'Hi{{#if showTheThing}}{{outlet}}{{/if}}Bye');
- this.addTemplate('sample.inner', 'Yay');
- this.addTemplate('sample.inner2', 'Boo');
- this.router.map(function() {
- this.route('sample', { path: '/' }, function() {
- this.route('inner', { path: '/' });
- this.route('inner2', { path: '/2' });
- });
+ return this.visit('/').then(() => {
+ let router = this.applicationInstance.lookup('router:main');
+ assert.equal(router.get('location.path'), '/about/TreeklesMcGeekles');
});
+ }
- let rootElement;
- return this.visit('/')
- .then(() => {
- rootElement = document.getElementById('qunit-fixture');
- assert.equal(rootElement.textContent.trim(), 'HiBye', 'initial render');
-
- run(() => this.applicationInstance.lookup('controller:sample').set('showTheThing', true));
+ async ['@test rejecting the model hooks promise with a non-error prints the `message` property'](
+ assert
+ ) {
+ assert.expect(5);
- assert.equal(rootElement.textContent.trim(), 'HiYayBye', 'second render');
- return this.visit('/2');
- })
- .then(() => {
- assert.equal(rootElement.textContent.trim(), 'HiBooBye', 'third render');
- });
- }
+ let rejectedMessage = 'OMG!! SOOOOOO BAD!!!!';
+ let rejectedStack = 'Yeah, buddy: stack gets printed too.';
- ['@test Can render into a named outlet at the top level'](assert) {
- this.addTemplate('application', 'A-{{outlet}}-B-{{outlet "other"}}-C');
- this.addTemplate('modal', 'Hello world');
- this.addTemplate('index', 'The index');
this.router.map(function() {
- this.route('index', { path: '/' });
+ this.route('yippie', { path: '/' });
});
+
+ console.error = function(initialMessage, errorMessage, errorStack) {
+ assert.equal(
+ initialMessage,
+ 'Error while processing route: yippie',
+ 'a message with the current route name is printed'
+ );
+ assert.equal(
+ errorMessage,
+ rejectedMessage,
+ "the rejected reason's message property is logged"
+ );
+ assert.equal(errorStack, rejectedStack, "the rejected reason's stack property is logged");
+ };
+
this.add(
- 'route:application',
+ 'route:yippie',
Route.extend({
- renderTemplate() {
- this.render();
- this.render('modal', {
- into: 'application',
- outlet: 'other',
+ model() {
+ return RSVP.reject({
+ message: rejectedMessage,
+ stack: rejectedStack,
});
},
})
);
- return this.visit('/').then(() => {
- let rootElement = document.getElementById('qunit-fixture');
- assert.equal(
- rootElement.textContent.trim(),
- 'A-The index-B-Hello world-C',
- 'initial render'
- );
- });
+ await assert.rejects(
+ this.visit('/'),
+ function(err) {
+ assert.equal(err.message, rejectedMessage);
+ return true;
+ },
+ 'expected an exception'
+ );
}
- ['@test Can disconnect a named outlet at the top level'](assert) {
- this.addTemplate('application', 'A-{{outlet}}-B-{{outlet "other"}}-C');
- this.addTemplate('modal', 'Hello world');
- this.addTemplate('index', 'The index');
+ async ['@test rejecting the model hooks promise with an error with `errorThrown` property prints `errorThrown.message` property'](
+ assert
+ ) {
+ assert.expect(5);
+ let rejectedMessage = 'OMG!! SOOOOOO BAD!!!!';
+ let rejectedStack = 'Yeah, buddy: stack gets printed too.';
+
this.router.map(function() {
- this.route('index', { path: '/' });
+ this.route('yippie', { path: '/' });
});
+
+ console.error = function(initialMessage, errorMessage, errorStack) {
+ assert.equal(
+ initialMessage,
+ 'Error while processing route: yippie',
+ 'a message with the current route name is printed'
+ );
+ assert.equal(
+ errorMessage,
+ rejectedMessage,
+ "the rejected reason's message property is logged"
+ );
+ assert.equal(errorStack, rejectedStack, "the rejected reason's stack property is logged");
+ };
+
this.add(
- 'route:application',
+ 'route:yippie',
Route.extend({
- renderTemplate() {
- this.render();
- this.render('modal', {
- into: 'application',
- outlet: 'other',
+ model() {
+ return RSVP.reject({
+ errorThrown: { message: rejectedMessage, stack: rejectedStack },
});
},
- actions: {
- banish() {
- this.disconnectOutlet({
- parentView: 'application',
- outlet: 'other',
- });
- },
- },
})
);
- return this.visit('/').then(() => {
- let rootElement = document.getElementById('qunit-fixture');
- assert.equal(
- rootElement.textContent.trim(),
- 'A-The index-B-Hello world-C',
- 'initial render'
- );
-
- run(this.applicationInstance.lookup('router:main'), 'send', 'banish');
-
- assert.equal(rootElement.textContent.trim(), 'A-The index-B--C', 'second render');
- });
+ await assert.rejects(
+ this.visit('/'),
+ function({ errorThrown: err }) {
+ assert.equal(err.message, rejectedMessage);
+ return true;
+ },
+ 'expected an exception'
+ );
}
- ['@test Can render into a named outlet at the top level, with empty main outlet'](assert) {
- this.addTemplate('application', 'A-{{outlet}}-B-{{outlet "other"}}-C');
- this.addTemplate('modal', 'Hello world');
-
+ async ['@test rejecting the model hooks promise with no reason still logs error'](assert) {
+ assert.expect(2);
this.router.map(function() {
- this.route('hasNoTemplate', { path: '/' });
+ this.route('wowzers', { path: '/' });
});
+ console.error = function(initialMessage) {
+ assert.equal(
+ initialMessage,
+ 'Error while processing route: wowzers',
+ 'a message with the current route name is printed'
+ );
+ };
+
this.add(
- 'route:application',
+ 'route:wowzers',
Route.extend({
- renderTemplate() {
- this.render();
- this.render('modal', {
- into: 'application',
- outlet: 'other',
- });
+ model() {
+ return RSVP.reject();
},
})
);
- return this.visit('/').then(() => {
- let rootElement = document.getElementById('qunit-fixture');
- assert.equal(rootElement.textContent.trim(), 'A--B-Hello world-C', 'initial render');
- });
+ await assert.rejects(this.visit('/'));
}
- ['@test Can render into a named outlet at the top level, later'](assert) {
- this.addTemplate('application', 'A-{{outlet}}-B-{{outlet "other"}}-C');
- this.addTemplate('modal', 'Hello world');
- this.addTemplate('index', 'The index');
+ async ['@test rejecting the model hooks promise with a string shows a good error'](assert) {
+ assert.expect(3);
+ let rejectedMessage = 'Supercalifragilisticexpialidocious';
+
this.router.map(function() {
- this.route('index', { path: '/' });
+ this.route('yondo', { path: '/' });
});
+
+ console.error = function(initialMessage, errorMessage) {
+ assert.equal(
+ initialMessage,
+ 'Error while processing route: yondo',
+ 'a message with the current route name is printed'
+ );
+ assert.equal(
+ errorMessage,
+ rejectedMessage,
+ "the rejected reason's message property is logged"
+ );
+ };
+
this.add(
- 'route:application',
+ 'route:yondo',
Route.extend({
- actions: {
- launch() {
- this.render('modal', {
- into: 'application',
- outlet: 'other',
- });
- },
+ model() {
+ return RSVP.reject(rejectedMessage);
},
})
);
- return this.visit('/').then(() => {
- let rootElement = document.getElementById('qunit-fixture');
- assert.equal(rootElement.textContent.trim(), 'A-The index-B--C', 'initial render');
- run(this.applicationInstance.lookup('router:main'), 'send', 'launch');
- assert.equal(
- rootElement.textContent.trim(),
- 'A-The index-B-Hello world-C',
- 'second render'
- );
- });
+ await assert.rejects(this.visit('/'), new RegExp(rejectedMessage), 'expected an exception');
}
- ["@test Can render routes with no 'main' outlet and their children"](assert) {
- this.addTemplate('application', '<div id="application">{{outlet "app"}}</div>');
- this.addTemplate(
- 'app',
- '<div id="app-common">{{outlet "common"}}</div><div id="app-sub">{{outlet "sub"}}</div>'
- );
- this.addTemplate('common', '<div id="common"></div>');
- this.addTemplate('sub', '<div id="sub"></div>');
+ ["@test willLeave, willChangeContext, willChangeModel actions don't fire unless feature flag enabled"](
+ assert
+ ) {
+ assert.expect(1);
this.router.map(function() {
- this.route('app', { path: '/app' }, function() {
- this.route('sub', { path: '/sub', resetNamespace: true });
- });
+ this.route('about');
});
- this.add(
- 'route:app',
- Route.extend({
- renderTemplate() {
- this.render('app', {
- outlet: 'app',
- into: 'application',
- });
- this.render('common', {
- outlet: 'common',
- into: 'app',
- });
- },
- })
- );
+ function shouldNotFire() {
+ assert.ok(false, "this action shouldn't have been received");
+ }
this.add(
- 'route:sub',
+ 'route:index',
Route.extend({
- renderTemplate() {
- this.render('sub', {
- outlet: 'sub',
- into: 'app',
- });
+ actions: {
+ willChangeModel: shouldNotFire,
+ willChangeContext: shouldNotFire,
+ willLeave: shouldNotFire,
},
})
);
- let rootElement;
- return this.visit('/app')
- .then(() => {
- rootElement = document.getElementById('qunit-fixture');
- assert.equal(
- rootElement.querySelectorAll('#app-common #common').length,
- 1,
- 'Finds common while viewing /app'
- );
- return this.visit('/app/sub');
- })
- .then(() => {
- assert.equal(
- rootElement.querySelectorAll('#app-common #common').length,
- 1,
- 'Finds common while viewing /app/sub'
- );
- assert.equal(
- rootElement.querySelectorAll('#app-sub #sub').length,
- 1,
- 'Finds sub while viewing /app/sub'
- );
- });
- }
-
- ['@test Tolerates stacked renders'](assert) {
- this.addTemplate('application', '{{outlet}}{{outlet "modal"}}');
- this.addTemplate('index', 'hi');
- this.addTemplate('layer', 'layer');
- this.router.map(function() {
- this.route('index', { path: '/' });
- });
this.add(
- 'route:application',
+ 'route:about',
Route.extend({
- actions: {
- openLayer() {
- this.render('layer', {
- into: 'application',
- outlet: 'modal',
- });
- },
- close() {
- this.disconnectOutlet({
- outlet: 'modal',
- parentView: 'application',
- });
- },
+ setupController() {
+ assert.ok(true, 'about route was entered');
},
})
);
- return this.visit('/').then(() => {
- let rootElement = document.getElementById('qunit-fixture');
- let router = this.applicationInstance.lookup('router:main');
- assert.equal(rootElement.textContent.trim(), 'hi');
- run(router, 'send', 'openLayer');
- assert.equal(rootElement.textContent.trim(), 'hilayer');
- run(router, 'send', 'openLayer');
- assert.equal(rootElement.textContent.trim(), 'hilayer');
- run(router, 'send', 'close');
- assert.equal(rootElement.textContent.trim(), 'hi');
- });
+ return this.visit('/about');
}
- ['@test Renders child into parent with non-default template name'](assert) {
- this.addTemplate('application', '<div class="a">{{outlet}}</div>');
- this.addTemplate('exports.root', '<div class="b">{{outlet}}</div>');
- this.addTemplate('exports.index', '<div class="c"></div>');
+ async ['@test Errors in transitionTo within redirect hook are logged'](assert) {
+ assert.expect(4);
+ let actual = [];
this.router.map(function() {
- this.route('root', function() {});
+ this.route('yondo', { path: '/' });
+ this.route('stink-bomb');
});
this.add(
- 'route:root',
+ 'route:yondo',
Route.extend({
- renderTemplate() {
- this.render('exports/root');
+ redirect() {
+ this.transitionTo('stink-bomb', { something: 'goes boom' });
},
})
);
- this.add(
- 'route:root.index',
- Route.extend({
- renderTemplate() {
- this.render('exports/index');
- },
- })
- );
+ console.error = function() {
+ // push the arguments onto an array so we can detect if the error gets logged twice
+ actual.push(arguments);
+ };
- return this.visit('/root').then(() => {
- let rootElement = document.getElementById('qunit-fixture');
- assert.equal(rootElement.querySelectorAll('.a .b .c').length, 1);
- });
+ await assert.rejects(this.visit('/'), /More context objects were passed/);
+
+ assert.equal(actual.length, 1, 'the error is only logged once');
+ assert.equal(actual[0][0], 'Error while processing route: yondo', 'source route is printed');
+ assert.ok(
+ actual[0][1].match(
+ /More context objects were passed than there are dynamic segments for the route: stink-bomb/
+ ),
+ 'the error is printed'
+ );
}
- ["@test Allows any route to disconnectOutlet another route's templates"](assert) {
- this.addTemplate('application', '{{outlet}}{{outlet "modal"}}');
- this.addTemplate('index', 'hi');
- this.addTemplate('layer', 'layer');
+ ['@test Errors in transition show error template if available'](assert) {
+ this.addTemplate('error', "<div id='error'>Error!</div>");
+
this.router.map(function() {
- this.route('index', { path: '/' });
+ this.route('yondo', { path: '/' });
+ this.route('stink-bomb');
});
+
this.add(
- 'route:application',
- Route.extend({
- actions: {
- openLayer() {
- this.render('layer', {
- into: 'application',
- outlet: 'modal',
- });
- },
- },
- })
- );
- this.add(
- 'route:index',
+ 'route:yondo',
Route.extend({
- actions: {
- close() {
- this.disconnectOutlet({
- parentView: 'application',
- outlet: 'modal',
- });
- },
+ redirect() {
+ this.transitionTo('stink-bomb', { something: 'goes boom' });
},
})
);
+ console.error = () => {};
return this.visit('/').then(() => {
- let rootElement = document.getElementById('qunit-fixture');
- let router = this.applicationInstance.lookup('router:main');
- assert.equal(rootElement.textContent.trim(), 'hi');
- run(router, 'send', 'openLayer');
- assert.equal(rootElement.textContent.trim(), 'hilayer');
- run(router, 'send', 'close');
- assert.equal(rootElement.textContent.trim(), 'hi');
+ let rootElement = document.querySelector('#qunit-fixture');
+ assert.equal(
+ rootElement.querySelectorAll('#error').length,
+ 1,
+ 'Error template was rendered.'
+ );
});
}
- ['@test Components inside an outlet have their didInsertElement hook invoked when the route is displayed'](
- assert
- ) {
- this.addTemplate(
- 'index',
- '{{#if showFirst}}{{my-component}}{{else}}{{other-component}}{{/if}}'
- );
-
- let myComponentCounter = 0;
- let otherComponentCounter = 0;
- let indexController;
+ ['@test Route#resetController gets fired when changing models and exiting routes'](assert) {
+ assert.expect(4);
this.router.map(function() {
- this.route('index', { path: '/' });
+ this.route('a', function() {
+ this.route('b', { path: '/b/:id', resetNamespace: true }, function() {});
+ this.route('c', { path: '/c/:id', resetNamespace: true }, function() {});
+ });
+ this.route('out');
});
- this.add(
- 'controller:index',
- Controller.extend({
- showFirst: true,
+ let calls = [];
+
+ let SpyRoute = Route.extend({
+ setupController(/* controller, model, transition */) {
+ calls.push(['setup', this.routeName]);
+ },
+
+ resetController(/* controller */) {
+ calls.push(['reset', this.routeName]);
+ },
+ });
+
+ this.add('route:a', SpyRoute.extend());
+ this.add('route:b', SpyRoute.extend());
+ this.add('route:c', SpyRoute.extend());
+ this.add('route:out', SpyRoute.extend());
+
+ let router;
+ return this.visit('/')
+ .then(() => {
+ router = this.applicationInstance.lookup('router:main');
+ assert.deepEqual(calls, []);
+ return run(router, 'transitionTo', 'b', 'b-1');
})
- );
+ .then(() => {
+ assert.deepEqual(calls, [['setup', 'a'], ['setup', 'b']]);
+ calls.length = 0;
+ return run(router, 'transitionTo', 'c', 'c-1');
+ })
+ .then(() => {
+ assert.deepEqual(calls, [['reset', 'b'], ['setup', 'c']]);
+ calls.length = 0;
+ return run(router, 'transitionTo', 'out');
+ })
+ .then(() => {
+ assert.deepEqual(calls, [['reset', 'c'], ['reset', 'a'], ['setup', 'out']]);
+ });
+ }
+ async ['@test Exception during initialization of non-initial route is not swallowed'](assert) {
+ this.router.map(function() {
+ this.route('boom');
+ });
this.add(
- 'route:index',
+ 'route:boom',
Route.extend({
- setupController(controller) {
- indexController = controller;
+ init() {
+ throw new Error('boom!');
},
})
);
- this.add(
- 'component:my-component',
- Component.extend({
- didInsertElement() {
- myComponentCounter++;
- },
- })
- );
+ await assert.rejects(this.visit('/boom'), /\bboom\b/);
+ }
+ async ['@test Exception during initialization of initial route is not swallowed'](assert) {
+ this.router.map(function() {
+ this.route('boom', { path: '/' });
+ });
this.add(
- 'component:other-component',
- Component.extend({
- didInsertElement() {
- otherComponentCounter++;
+ 'route:boom',
+ Route.extend({
+ init() {
+ throw new Error('boom!');
},
})
);
- return this.visit('/').then(() => {
- assert.strictEqual(
- myComponentCounter,
- 1,
- 'didInsertElement invoked on displayed component'
- );
- assert.strictEqual(
- otherComponentCounter,
- 0,
- 'didInsertElement not invoked on displayed component'
- );
-
- run(() => indexController.set('showFirst', false));
-
- assert.strictEqual(
- myComponentCounter,
- 1,
- 'didInsertElement not invoked on displayed component'
- );
- assert.strictEqual(
- otherComponentCounter,
- 1,
- 'didInsertElement invoked on displayed component'
- );
- });
+ await assert.rejects(this.visit('/'), /\bboom\b/);
}
async ['@test Doesnt swallow exception thrown from willTransition'](assert) {
@@ -3539,39 +2107,6 @@ moduleFor(
);
}
- ['@test Exception if outlet name is undefined in render and disconnectOutlet']() {
- this.add(
- 'route:application',
- Route.extend({
- actions: {
- showModal() {
- this.render({
- outlet: undefined,
- parentView: 'application',
- });
- },
- hideModal() {
- this.disconnectOutlet({
- outlet: undefined,
- parentView: 'application',
- });
- },
- },
- })
- );
-
- return this.visit('/').then(() => {
- let router = this.applicationInstance.lookup('router:main');
- expectAssertion(() => {
- run(() => router.send('showModal'));
- }, /You passed undefined as the outlet name/);
-
- expectAssertion(() => {
- run(() => router.send('hideModal'));
- }, /You passed undefined as the outlet name/);
- });
- }
-
['@test Route serializers work for Engines'](assert) {
assert.expect(2);
| true |
Other
|
emberjs
|
ember.js
|
98b073b31700abe76b56f6a81feb9862b0b6e429.json
|
move template rendering related tests
|
packages/ember/tests/routing/model_loading_test.js
|
@@ -2,11 +2,7 @@
import { Route } from '@ember/-internals/routing';
import Controller from '@ember/controller';
import { Object as EmberObject, A as emberA } from '@ember/-internals/runtime';
-import {
- moduleFor,
- ApplicationTestCase,
- getTextOf,
-} from 'internal-test-helpers';
+import { moduleFor, ApplicationTestCase, getTextOf } from 'internal-test-helpers';
import { run } from '@ember/runloop';
import { computed, set } from '@ember/-internals/metal';
| true |
Other
|
emberjs
|
ember.js
|
98b073b31700abe76b56f6a81feb9862b0b6e429.json
|
move template rendering related tests
|
packages/ember/tests/routing/template_rendering_test.js
|
@@ -0,0 +1,1535 @@
+/* eslint-disable no-console */
+import { Route } from '@ember/-internals/routing';
+import Controller from '@ember/controller';
+import { Object as EmberObject, A as emberA } from '@ember/-internals/runtime';
+import { moduleFor, ApplicationTestCase, getTextOf, runTask } from 'internal-test-helpers';
+import { run } from '@ember/runloop';
+import { Component } from '@ember/-internals/glimmer';
+
+let originalConsoleError;
+
+moduleFor(
+ 'Route - template rendering',
+ class extends ApplicationTestCase {
+ constructor() {
+ super(...arguments);
+ this.addTemplate('home', '<h3 class="hours">Hours</h3>');
+ this.addTemplate('camelot', '<section id="camelot"><h3>Is a silly place</h3></section>');
+ this.addTemplate('homepage', '<h3 id="troll">Megatroll</h3><p>{{this.name}}</p>');
+
+ this.router.map(function() {
+ this.route('home', { path: '/' });
+ });
+
+ originalConsoleError = console.error;
+ }
+
+ teardown() {
+ super.teardown();
+ console.error = originalConsoleError;
+ }
+
+ handleURLAborts(assert, path, deprecated) {
+ run(() => {
+ let router = this.applicationInstance.lookup('router:main');
+ let result;
+
+ if (deprecated !== undefined) {
+ expectDeprecation(() => {
+ result = router.handleURL(path);
+ });
+ } else {
+ result = router.handleURL(path);
+ }
+
+ result.then(
+ function() {
+ assert.ok(false, 'url: `' + path + '` was NOT to be handled');
+ },
+ function(reason) {
+ assert.ok(
+ reason && reason.message === 'TransitionAborted',
+ 'url: `' + path + '` was to be aborted'
+ );
+ }
+ );
+ });
+ }
+
+ get currentPath() {
+ let currentPath;
+ expectDeprecation(() => {
+ currentPath = this.applicationInstance.lookup('controller:application').get('currentPath');
+ }, 'Accessing `currentPath` on `controller:application` is deprecated, use the `currentPath` property on `service:router` instead.');
+ return currentPath;
+ }
+
+ async ['@test warn on URLs not included in the route set'](assert) {
+ await this.visit('/');
+
+ await assert.rejects(this.visit('/what-is-this-i-dont-even'), /\/what-is-this-i-dont-even/);
+ }
+
+ [`@test The Homepage with explicit template name in renderTemplate`](assert) {
+ this.add(
+ 'route:home',
+ Route.extend({
+ renderTemplate() {
+ this.render('homepage');
+ },
+ })
+ );
+
+ return this.visit('/').then(() => {
+ let text = this.$('#troll').text();
+ assert.equal(text, 'Megatroll', 'the homepage template was rendered');
+ });
+ }
+
+ async [`@test an alternate template will pull in an alternate controller`](assert) {
+ this.add(
+ 'route:home',
+ Route.extend({
+ renderTemplate() {
+ this.render('homepage');
+ },
+ })
+ );
+ this.add(
+ 'controller:homepage',
+ Controller.extend({
+ init() {
+ this._super(...arguments);
+ this.name = 'Comes from homepage';
+ },
+ })
+ );
+
+ await this.visit('/');
+
+ assert.equal(this.$('p').text(), 'Comes from homepage', 'the homepage template was rendered');
+ }
+
+ async [`@test An alternate template will pull in an alternate controller instead of controllerName`](
+ assert
+ ) {
+ this.add(
+ 'route:home',
+ Route.extend({
+ controllerName: 'foo',
+ renderTemplate() {
+ this.render('homepage');
+ },
+ })
+ );
+ this.add(
+ 'controller:foo',
+ Controller.extend({
+ init() {
+ this._super(...arguments);
+ this.name = 'Comes from foo';
+ },
+ })
+ );
+ this.add(
+ 'controller:homepage',
+ Controller.extend({
+ init() {
+ this._super(...arguments);
+ this.name = 'Comes from homepage';
+ },
+ })
+ );
+
+ await this.visit('/');
+
+ assert.equal(this.$('p').text(), 'Comes from homepage', 'the homepage template was rendered');
+ }
+
+ async [`@test The template will pull in an alternate controller via key/value`](assert) {
+ this.router.map(function() {
+ this.route('homepage', { path: '/' });
+ });
+
+ this.add(
+ 'route:homepage',
+ Route.extend({
+ renderTemplate() {
+ this.render({ controller: 'home' });
+ },
+ })
+ );
+ this.add(
+ 'controller:home',
+ Controller.extend({
+ init() {
+ this._super(...arguments);
+ this.name = 'Comes from home.';
+ },
+ })
+ );
+
+ await this.visit('/');
+
+ assert.equal(
+ this.$('p').text(),
+ 'Comes from home.',
+ 'the homepage template was rendered from data from the HomeController'
+ );
+ }
+
+ async [`@test The Homepage with explicit template name in renderTemplate and controller`](
+ assert
+ ) {
+ this.add(
+ 'controller:home',
+ Controller.extend({
+ init() {
+ this._super(...arguments);
+ this.name = 'YES I AM HOME';
+ },
+ })
+ );
+ this.add(
+ 'route:home',
+ Route.extend({
+ renderTemplate() {
+ this.render('homepage');
+ },
+ })
+ );
+
+ await this.visit('/');
+
+ assert.equal(this.$('p').text(), 'YES I AM HOME', 'The homepage template was rendered');
+ }
+
+ [`@feature(!EMBER_ROUTING_MODEL_ARG) Model passed via renderTemplate model is set as controller's model`](
+ assert
+ ) {
+ this.addTemplate('bio', '<p>{{this.model.name}}</p>');
+ this.add(
+ 'route:home',
+ Route.extend({
+ renderTemplate() {
+ this.render('bio', {
+ model: { name: 'emberjs' },
+ });
+ },
+ })
+ );
+
+ return this.visit('/').then(() => {
+ let text = this.$('p').text();
+
+ assert.equal(text, 'emberjs', `Passed model was set as controller's model`);
+ });
+ }
+
+ async [`@feature(EMBER_ROUTING_MODEL_ARG) Model passed via renderTemplate model is set as controller's model`](
+ assert
+ ) {
+ this.addTemplate(
+ 'bio',
+ '<p>Model: {{@model.name}}</p><p>Controller: {{this.model.name}}</p>'
+ );
+ this.add(
+ 'route:home',
+ Route.extend({
+ renderTemplate() {
+ this.render('bio', {
+ model: { name: 'emberjs' },
+ });
+ },
+ })
+ );
+
+ await this.visit('/');
+
+ let text = this.$('p').text();
+
+ assert.ok(
+ text.indexOf('Model: emberjs') > -1,
+ 'Passed model was available as the `@model` argument'
+ );
+
+ assert.ok(
+ text.indexOf('Controller: emberjs') > -1,
+ "Passed model was set as controller's `model` property"
+ );
+ }
+
+ ['@test render uses templateName from route'](assert) {
+ this.addTemplate('the_real_home_template', '<p>THIS IS THE REAL HOME</p>');
+ this.add(
+ 'route:home',
+ Route.extend({
+ templateName: 'the_real_home_template',
+ })
+ );
+
+ return this.visit('/').then(() => {
+ let text = this.$('p').text();
+
+ assert.equal(text, 'THIS IS THE REAL HOME', 'the homepage template was rendered');
+ });
+ }
+
+ ['@test defining templateName allows other templates to be rendered'](assert) {
+ this.addTemplate('alert', `<div class='alert-box'>Invader!</div>`);
+ this.addTemplate('the_real_home_template', `<p>THIS IS THE REAL HOME</p>{{outlet 'alert'}}`);
+ this.add(
+ 'route:home',
+ Route.extend({
+ templateName: 'the_real_home_template',
+ actions: {
+ showAlert() {
+ this.render('alert', {
+ into: 'home',
+ outlet: 'alert',
+ });
+ },
+ },
+ })
+ );
+
+ return this.visit('/')
+ .then(() => {
+ let text = this.$('p').text();
+ assert.equal(text, 'THIS IS THE REAL HOME', 'the homepage template was rendered');
+
+ return runTask(() => this.appRouter.send('showAlert'));
+ })
+ .then(() => {
+ let text = this.$('.alert-box').text();
+
+ assert.equal(text, 'Invader!', 'Template for alert was rendered into the outlet');
+ });
+ }
+
+ ['@test templateName is still used when calling render with no name and options'](assert) {
+ this.addTemplate('alert', `<div class='alert-box'>Invader!</div>`);
+ this.addTemplate('home', `<p>THIS IS THE REAL HOME</p>{{outlet 'alert'}}`);
+
+ this.add(
+ 'route:home',
+ Route.extend({
+ templateName: 'alert',
+ renderTemplate() {
+ this.render({});
+ },
+ })
+ );
+
+ return this.visit('/').then(() => {
+ let text = this.$('.alert-box').text();
+
+ assert.equal(text, 'Invader!', 'default templateName was rendered into outlet');
+ });
+ }
+
+ ['@test Generated names can be customized when providing routes with dot notation'](assert) {
+ assert.expect(4);
+
+ this.addTemplate('index', '<div>Index</div>');
+ this.addTemplate('application', "<h1>Home</h1><div class='main'>{{outlet}}</div>");
+ this.addTemplate('foo', "<div class='middle'>{{outlet}}</div>");
+ this.addTemplate('bar', "<div class='bottom'>{{outlet}}</div>");
+ this.addTemplate('bar.baz', '<p>{{name}}Bottom!</p>');
+
+ this.router.map(function() {
+ this.route('foo', { path: '/top' }, function() {
+ this.route('bar', { path: '/middle', resetNamespace: true }, function() {
+ this.route('baz', { path: '/bottom' });
+ });
+ });
+ });
+
+ this.add(
+ 'route:foo',
+ Route.extend({
+ renderTemplate() {
+ assert.ok(true, 'FooBarRoute was called');
+ return this._super(...arguments);
+ },
+ })
+ );
+
+ this.add(
+ 'route:bar.baz',
+ Route.extend({
+ renderTemplate() {
+ assert.ok(true, 'BarBazRoute was called');
+ return this._super(...arguments);
+ },
+ })
+ );
+
+ this.add(
+ 'controller:bar',
+ Controller.extend({
+ name: 'Bar',
+ })
+ );
+
+ this.add(
+ 'controller:bar.baz',
+ Controller.extend({
+ name: 'BarBaz',
+ })
+ );
+
+ return this.visit('/top/middle/bottom').then(() => {
+ assert.ok(true, '/top/middle/bottom has been handled');
+ let rootElement = document.getElementById('qunit-fixture');
+ assert.equal(
+ getTextOf(rootElement.querySelector('.main .middle .bottom p')),
+ 'BarBazBottom!',
+ 'The templates were rendered into their appropriate parents'
+ );
+ });
+ }
+
+ ["@test Child routes render into their parent route's template by default"](assert) {
+ this.addTemplate('index', '<div>Index</div>');
+ this.addTemplate('application', "<h1>Home</h1><div class='main'>{{outlet}}</div>");
+ this.addTemplate('top', "<div class='middle'>{{outlet}}</div>");
+ this.addTemplate('middle', "<div class='bottom'>{{outlet}}</div>");
+ this.addTemplate('middle.bottom', '<p>Bottom!</p>');
+
+ this.router.map(function() {
+ this.route('top', function() {
+ this.route('middle', { resetNamespace: true }, function() {
+ this.route('bottom');
+ });
+ });
+ });
+
+ return this.visit('/top/middle/bottom').then(() => {
+ assert.ok(true, '/top/middle/bottom has been handled');
+ let rootElement = document.getElementById('qunit-fixture');
+ assert.equal(
+ getTextOf(rootElement.querySelector('.main .middle .bottom p')),
+ 'Bottom!',
+ 'The templates were rendered into their appropriate parents'
+ );
+ });
+ }
+
+ ['@test Child routes render into specified template'](assert) {
+ this.addTemplate('index', '<div>Index</div>');
+ this.addTemplate('application', "<h1>Home</h1><div class='main'>{{outlet}}</div>");
+ this.addTemplate('top', "<div class='middle'>{{outlet}}</div>");
+ this.addTemplate('middle', "<div class='bottom'>{{outlet}}</div>");
+ this.addTemplate('middle.bottom', '<p>Bottom!</p>');
+
+ this.router.map(function() {
+ this.route('top', function() {
+ this.route('middle', { resetNamespace: true }, function() {
+ this.route('bottom');
+ });
+ });
+ });
+
+ this.add(
+ 'route:middle.bottom',
+ Route.extend({
+ renderTemplate() {
+ this.render('middle/bottom', { into: 'top' });
+ },
+ })
+ );
+
+ return this.visit('/top/middle/bottom').then(() => {
+ assert.ok(true, '/top/middle/bottom has been handled');
+ let rootElement = document.getElementById('qunit-fixture');
+ assert.equal(
+ rootElement.querySelectorAll('.main .middle .bottom p').length,
+ 0,
+ 'should not render into the middle template'
+ );
+ assert.equal(
+ getTextOf(rootElement.querySelector('.main .middle > p')),
+ 'Bottom!',
+ 'The template was rendered into the top template'
+ );
+ });
+ }
+
+ ['@test Rendering into specified template with slash notation'](assert) {
+ this.addTemplate('person.profile', 'profile {{outlet}}');
+ this.addTemplate('person.details', 'details!');
+
+ this.router.map(function() {
+ this.route('home', { path: '/' });
+ });
+
+ this.add(
+ 'route:home',
+ Route.extend({
+ renderTemplate() {
+ this.render('person/profile');
+ this.render('person/details', { into: 'person/profile' });
+ },
+ })
+ );
+
+ return this.visit('/').then(() => {
+ let rootElement = document.getElementById('qunit-fixture');
+ assert.equal(
+ rootElement.textContent.trim(),
+ 'profile details!',
+ 'The templates were rendered'
+ );
+ });
+ }
+
+ ['@test Only use route rendered into main outlet for default into property on child'](assert) {
+ this.addTemplate('application', "{{outlet 'menu'}}{{outlet}}");
+ this.addTemplate('posts', '{{outlet}}');
+ this.addTemplate('posts.index', '<p class="posts-index">postsIndex</p>');
+ this.addTemplate('posts.menu', '<div class="posts-menu">postsMenu</div>');
+
+ this.router.map(function() {
+ this.route('posts', function() {});
+ });
+
+ this.add(
+ 'route:posts',
+ Route.extend({
+ renderTemplate() {
+ this.render();
+ this.render('posts/menu', {
+ into: 'application',
+ outlet: 'menu',
+ });
+ },
+ })
+ );
+
+ return this.visit('/posts').then(() => {
+ assert.ok(true, '/posts has been handled');
+ let rootElement = document.getElementById('qunit-fixture');
+ assert.equal(
+ getTextOf(rootElement.querySelector('div.posts-menu')),
+ 'postsMenu',
+ 'The posts/menu template was rendered'
+ );
+ assert.equal(
+ getTextOf(rootElement.querySelector('p.posts-index')),
+ 'postsIndex',
+ 'The posts/index template was rendered'
+ );
+ });
+ }
+
+ ['@test Application template does not duplicate when re-rendered'](assert) {
+ this.addTemplate('application', '<h3 class="render-once">I render once</h3>{{outlet}}');
+
+ this.router.map(function() {
+ this.route('posts');
+ });
+
+ this.add(
+ 'route:application',
+ Route.extend({
+ model() {
+ return emberA();
+ },
+ })
+ );
+
+ return this.visit('/posts').then(() => {
+ assert.ok(true, '/posts has been handled');
+ let rootElement = document.getElementById('qunit-fixture');
+ assert.equal(getTextOf(rootElement.querySelector('h3.render-once')), 'I render once');
+ });
+ }
+
+ ['@test Child routes should render inside the application template if the application template causes a redirect'](
+ assert
+ ) {
+ this.addTemplate('application', '<h3>App</h3> {{outlet}}');
+ this.addTemplate('posts', 'posts');
+
+ this.router.map(function() {
+ this.route('posts');
+ this.route('photos');
+ });
+
+ this.add(
+ 'route:application',
+ Route.extend({
+ afterModel() {
+ this.transitionTo('posts');
+ },
+ })
+ );
+
+ return this.visit('/posts').then(() => {
+ let rootElement = document.getElementById('qunit-fixture');
+ assert.equal(rootElement.textContent.trim(), 'App posts');
+ });
+ }
+
+ ["@feature(!EMBER_ROUTING_MODEL_ARG) The template is not re-rendered when the route's context changes"](
+ assert
+ ) {
+ this.router.map(function() {
+ this.route('page', { path: '/page/:name' });
+ });
+
+ this.add(
+ 'route:page',
+ Route.extend({
+ model(params) {
+ return EmberObject.create({ name: params.name });
+ },
+ })
+ );
+
+ let insertionCount = 0;
+ this.add(
+ 'component:foo-bar',
+ Component.extend({
+ didInsertElement() {
+ insertionCount += 1;
+ },
+ })
+ );
+
+ this.addTemplate('page', '<p>{{this.model.name}}{{foo-bar}}</p>');
+
+ let rootElement = document.getElementById('qunit-fixture');
+ return this.visit('/page/first')
+ .then(() => {
+ assert.ok(true, '/page/first has been handled');
+ assert.equal(getTextOf(rootElement.querySelector('p')), 'first');
+ assert.equal(insertionCount, 1);
+ return this.visit('/page/second');
+ })
+ .then(() => {
+ assert.ok(true, '/page/second has been handled');
+ assert.equal(getTextOf(rootElement.querySelector('p')), 'second');
+ assert.equal(insertionCount, 1, 'view should have inserted only once');
+ let router = this.applicationInstance.lookup('router:main');
+ return run(() => router.transitionTo('page', EmberObject.create({ name: 'third' })));
+ })
+ .then(() => {
+ assert.equal(getTextOf(rootElement.querySelector('p')), 'third');
+ assert.equal(insertionCount, 1, 'view should still have inserted only once');
+ });
+ }
+
+ async ["@feature(EMBER_ROUTING_MODEL_ARG) The template is not re-rendered when the route's model changes"](
+ assert
+ ) {
+ this.router.map(function() {
+ this.route('page', { path: '/page/:name' });
+ });
+
+ this.add(
+ 'route:page',
+ Route.extend({
+ model(params) {
+ return EmberObject.create({ name: params.name });
+ },
+ })
+ );
+
+ let insertionCount = 0;
+ this.add(
+ 'component:foo-bar',
+ Component.extend({
+ didInsertElement() {
+ insertionCount += 1;
+ },
+ })
+ );
+
+ this.addTemplate('page', '<p>{{@model.name}}{{foo-bar}}</p>');
+
+ let rootElement = document.getElementById('qunit-fixture');
+
+ await this.visit('/page/first');
+
+ assert.ok(true, '/page/first has been handled');
+ assert.equal(getTextOf(rootElement.querySelector('p')), 'first');
+ assert.equal(insertionCount, 1);
+
+ await this.visit('/page/second');
+
+ assert.ok(true, '/page/second has been handled');
+ assert.equal(getTextOf(rootElement.querySelector('p')), 'second');
+ assert.equal(insertionCount, 1, 'view should have inserted only once');
+ let router = this.applicationInstance.lookup('router:main');
+
+ await run(() => router.transitionTo('page', EmberObject.create({ name: 'third' })));
+
+ assert.equal(getTextOf(rootElement.querySelector('p')), 'third');
+ assert.equal(insertionCount, 1, 'view should still have inserted only once');
+ }
+
+ ['@test The template is not re-rendered when two routes present the exact same template & controller'](
+ assert
+ ) {
+ this.router.map(function() {
+ this.route('first');
+ this.route('second');
+ this.route('third');
+ this.route('fourth');
+ });
+
+ // Note add a component to test insertion
+
+ let insertionCount = 0;
+ this.add(
+ 'component:x-input',
+ Component.extend({
+ didInsertElement() {
+ insertionCount += 1;
+ },
+ })
+ );
+
+ let SharedRoute = Route.extend({
+ setupController() {
+ this.controllerFor('shared').set('message', 'This is the ' + this.routeName + ' message');
+ },
+
+ renderTemplate() {
+ this.render('shared', { controller: 'shared' });
+ },
+ });
+
+ this.add('route:shared', SharedRoute);
+ this.add('route:first', SharedRoute.extend());
+ this.add('route:second', SharedRoute.extend());
+ this.add('route:third', SharedRoute.extend());
+ this.add('route:fourth', SharedRoute.extend());
+
+ this.add('controller:shared', Controller.extend());
+
+ this.addTemplate('shared', '<p>{{message}}{{x-input}}</p>');
+
+ let rootElement = document.getElementById('qunit-fixture');
+ return this.visit('/first')
+ .then(() => {
+ assert.ok(true, '/first has been handled');
+ assert.equal(getTextOf(rootElement.querySelector('p')), 'This is the first message');
+ assert.equal(insertionCount, 1, 'expected one assertion');
+ return this.visit('/second');
+ })
+ .then(() => {
+ assert.ok(true, '/second has been handled');
+ assert.equal(getTextOf(rootElement.querySelector('p')), 'This is the second message');
+ assert.equal(insertionCount, 1, 'expected one assertion');
+ return run(() => {
+ this.applicationInstance
+ .lookup('router:main')
+ .transitionTo('third')
+ .then(
+ function() {
+ assert.ok(true, 'expected transition');
+ },
+ function(reason) {
+ assert.ok(false, 'unexpected transition failure: ', QUnit.jsDump.parse(reason));
+ }
+ );
+ });
+ })
+ .then(() => {
+ assert.equal(getTextOf(rootElement.querySelector('p')), 'This is the third message');
+ assert.equal(insertionCount, 1, 'expected one assertion');
+ return this.visit('fourth');
+ })
+ .then(() => {
+ assert.ok(true, '/fourth has been handled');
+ assert.equal(insertionCount, 1, 'expected one assertion');
+ assert.equal(getTextOf(rootElement.querySelector('p')), 'This is the fourth message');
+ });
+ }
+
+ ['@test Route should tear down multiple outlets'](assert) {
+ this.addTemplate('application', "{{outlet 'menu'}}{{outlet}}{{outlet 'footer'}}");
+ this.addTemplate('posts', '{{outlet}}');
+ this.addTemplate('users', 'users');
+ this.addTemplate('posts.index', '<p class="posts-index">postsIndex</p>');
+ this.addTemplate('posts.menu', '<div class="posts-menu">postsMenu</div>');
+ this.addTemplate('posts.footer', '<div class="posts-footer">postsFooter</div>');
+
+ this.router.map(function() {
+ this.route('posts', function() {});
+ this.route('users', function() {});
+ });
+
+ this.add(
+ 'route:posts',
+ Route.extend({
+ renderTemplate() {
+ this.render('posts/menu', {
+ into: 'application',
+ outlet: 'menu',
+ });
+
+ this.render();
+
+ this.render('posts/footer', {
+ into: 'application',
+ outlet: 'footer',
+ });
+ },
+ })
+ );
+
+ let rootElement = document.getElementById('qunit-fixture');
+ return this.visit('/posts')
+ .then(() => {
+ assert.ok(true, '/posts has been handled');
+ assert.equal(
+ getTextOf(rootElement.querySelector('div.posts-menu')),
+ 'postsMenu',
+ 'The posts/menu template was rendered'
+ );
+ assert.equal(
+ getTextOf(rootElement.querySelector('p.posts-index')),
+ 'postsIndex',
+ 'The posts/index template was rendered'
+ );
+ assert.equal(
+ getTextOf(rootElement.querySelector('div.posts-footer')),
+ 'postsFooter',
+ 'The posts/footer template was rendered'
+ );
+
+ return this.visit('/users');
+ })
+ .then(() => {
+ assert.ok(true, '/users has been handled');
+ assert.equal(
+ rootElement.querySelector('div.posts-menu'),
+ null,
+ 'The posts/menu template was removed'
+ );
+ assert.equal(
+ rootElement.querySelector('p.posts-index'),
+ null,
+ 'The posts/index template was removed'
+ );
+ assert.equal(
+ rootElement.querySelector('div.posts-footer'),
+ null,
+ 'The posts/footer template was removed'
+ );
+ });
+ }
+
+ ['@test Route supports clearing outlet explicitly'](assert) {
+ this.addTemplate('application', "{{outlet}}{{outlet 'modal'}}");
+ this.addTemplate('posts', '{{outlet}}');
+ this.addTemplate('users', 'users');
+ this.addTemplate('posts.index', '<div class="posts-index">postsIndex {{outlet}}</div>');
+ this.addTemplate('posts.modal', '<div class="posts-modal">postsModal</div>');
+ this.addTemplate('posts.extra', '<div class="posts-extra">postsExtra</div>');
+
+ this.router.map(function() {
+ this.route('posts', function() {});
+ this.route('users', function() {});
+ });
+
+ this.add(
+ 'route:posts',
+ Route.extend({
+ actions: {
+ showModal() {
+ this.render('posts/modal', {
+ into: 'application',
+ outlet: 'modal',
+ });
+ },
+ hideModal() {
+ this.disconnectOutlet({
+ outlet: 'modal',
+ parentView: 'application',
+ });
+ },
+ },
+ })
+ );
+
+ this.add(
+ 'route:posts.index',
+ Route.extend({
+ actions: {
+ showExtra() {
+ this.render('posts/extra', {
+ into: 'posts/index',
+ });
+ },
+ hideExtra() {
+ this.disconnectOutlet({ parentView: 'posts/index' });
+ },
+ },
+ })
+ );
+
+ let rootElement = document.getElementById('qunit-fixture');
+
+ return this.visit('/posts')
+ .then(() => {
+ let router = this.applicationInstance.lookup('router:main');
+
+ assert.equal(
+ getTextOf(rootElement.querySelector('div.posts-index')),
+ 'postsIndex',
+ 'The posts/index template was rendered'
+ );
+ run(() => router.send('showModal'));
+ assert.equal(
+ getTextOf(rootElement.querySelector('div.posts-modal')),
+ 'postsModal',
+ 'The posts/modal template was rendered'
+ );
+ run(() => router.send('showExtra'));
+
+ assert.equal(
+ getTextOf(rootElement.querySelector('div.posts-extra')),
+ 'postsExtra',
+ 'The posts/extra template was rendered'
+ );
+ run(() => router.send('hideModal'));
+
+ assert.equal(
+ rootElement.querySelector('div.posts-modal'),
+ null,
+ 'The posts/modal template was removed'
+ );
+ run(() => router.send('hideExtra'));
+
+ assert.equal(
+ rootElement.querySelector('div.posts-extra'),
+ null,
+ 'The posts/extra template was removed'
+ );
+ run(function() {
+ router.send('showModal');
+ });
+ assert.equal(
+ getTextOf(rootElement.querySelector('div.posts-modal')),
+ 'postsModal',
+ 'The posts/modal template was rendered'
+ );
+ run(function() {
+ router.send('showExtra');
+ });
+ assert.equal(
+ getTextOf(rootElement.querySelector('div.posts-extra')),
+ 'postsExtra',
+ 'The posts/extra template was rendered'
+ );
+ return this.visit('/users');
+ })
+ .then(() => {
+ assert.equal(
+ rootElement.querySelector('div.posts-index'),
+ null,
+ 'The posts/index template was removed'
+ );
+ assert.equal(
+ rootElement.querySelector('div.posts-modal'),
+ null,
+ 'The posts/modal template was removed'
+ );
+ assert.equal(
+ rootElement.querySelector('div.posts-extra'),
+ null,
+ 'The posts/extra template was removed'
+ );
+ });
+ }
+
+ ['@test Route supports clearing outlet using string parameter'](assert) {
+ this.addTemplate('application', "{{outlet}}{{outlet 'modal'}}");
+ this.addTemplate('posts', '{{outlet}}');
+ this.addTemplate('users', 'users');
+ this.addTemplate('posts.index', '<div class="posts-index">postsIndex {{outlet}}</div>');
+ this.addTemplate('posts.modal', '<div class="posts-modal">postsModal</div>');
+
+ this.router.map(function() {
+ this.route('posts', function() {});
+ this.route('users', function() {});
+ });
+
+ this.add(
+ 'route:posts',
+ Route.extend({
+ actions: {
+ showModal() {
+ this.render('posts/modal', {
+ into: 'application',
+ outlet: 'modal',
+ });
+ },
+ hideModal() {
+ this.disconnectOutlet('modal');
+ },
+ },
+ })
+ );
+
+ let rootElement = document.getElementById('qunit-fixture');
+ return this.visit('/posts')
+ .then(() => {
+ let router = this.applicationInstance.lookup('router:main');
+ assert.equal(
+ getTextOf(rootElement.querySelector('div.posts-index')),
+ 'postsIndex',
+ 'The posts/index template was rendered'
+ );
+ run(() => router.send('showModal'));
+ assert.equal(
+ getTextOf(rootElement.querySelector('div.posts-modal')),
+ 'postsModal',
+ 'The posts/modal template was rendered'
+ );
+ run(() => router.send('hideModal'));
+ assert.equal(
+ rootElement.querySelector('div.posts-modal'),
+ null,
+ 'The posts/modal template was removed'
+ );
+ return this.visit('/users');
+ })
+ .then(() => {
+ assert.equal(
+ rootElement.querySelector('div.posts-index'),
+ null,
+ 'The posts/index template was removed'
+ );
+ assert.equal(
+ rootElement.querySelector('div.posts-modal'),
+ null,
+ 'The posts/modal template was removed'
+ );
+ });
+ }
+
+ ['@test Route silently fails when cleaning an outlet from an inactive view'](assert) {
+ assert.expect(1); // handleURL
+
+ this.addTemplate('application', '{{outlet}}');
+ this.addTemplate('posts', "{{outlet 'modal'}}");
+ this.addTemplate('modal', 'A Yo.');
+
+ this.router.map(function() {
+ this.route('posts');
+ });
+
+ this.add(
+ 'route:posts',
+ Route.extend({
+ actions: {
+ hideSelf() {
+ this.disconnectOutlet({
+ outlet: 'main',
+ parentView: 'application',
+ });
+ },
+ showModal() {
+ this.render('modal', { into: 'posts', outlet: 'modal' });
+ },
+ hideModal() {
+ this.disconnectOutlet({ outlet: 'modal', parentView: 'posts' });
+ },
+ },
+ })
+ );
+
+ return this.visit('/posts').then(() => {
+ assert.ok(true, '/posts has been handled');
+ let router = this.applicationInstance.lookup('router:main');
+ run(() => router.send('showModal'));
+ run(() => router.send('hideSelf'));
+ run(() => router.send('hideModal'));
+ });
+ }
+
+ ['@test Specifying non-existent controller name in route#render throws'](assert) {
+ assert.expect(1);
+
+ this.router.map(function() {
+ this.route('home', { path: '/' });
+ });
+
+ this.add(
+ 'route:home',
+ Route.extend({
+ renderTemplate() {
+ expectAssertion(() => {
+ this.render('homepage', {
+ controller: 'stefanpenneristhemanforme',
+ });
+ }, "You passed `controller: 'stefanpenneristhemanforme'` into the `render` method, but no such controller could be found.");
+ },
+ })
+ );
+
+ return this.visit('/');
+ }
+
+ ['@test {{outlet}} works when created after initial render'](assert) {
+ this.addTemplate('sample', 'Hi{{#if showTheThing}}{{outlet}}{{/if}}Bye');
+ this.addTemplate('sample.inner', 'Yay');
+ this.addTemplate('sample.inner2', 'Boo');
+ this.router.map(function() {
+ this.route('sample', { path: '/' }, function() {
+ this.route('inner', { path: '/' });
+ this.route('inner2', { path: '/2' });
+ });
+ });
+
+ let rootElement;
+ return this.visit('/')
+ .then(() => {
+ rootElement = document.getElementById('qunit-fixture');
+ assert.equal(rootElement.textContent.trim(), 'HiBye', 'initial render');
+
+ run(() => this.applicationInstance.lookup('controller:sample').set('showTheThing', true));
+
+ assert.equal(rootElement.textContent.trim(), 'HiYayBye', 'second render');
+ return this.visit('/2');
+ })
+ .then(() => {
+ assert.equal(rootElement.textContent.trim(), 'HiBooBye', 'third render');
+ });
+ }
+
+ ['@test Can render into a named outlet at the top level'](assert) {
+ this.addTemplate('application', 'A-{{outlet}}-B-{{outlet "other"}}-C');
+ this.addTemplate('modal', 'Hello world');
+ this.addTemplate('index', 'The index');
+ this.router.map(function() {
+ this.route('index', { path: '/' });
+ });
+ this.add(
+ 'route:application',
+ Route.extend({
+ renderTemplate() {
+ this.render();
+ this.render('modal', {
+ into: 'application',
+ outlet: 'other',
+ });
+ },
+ })
+ );
+
+ return this.visit('/').then(() => {
+ let rootElement = document.getElementById('qunit-fixture');
+ assert.equal(
+ rootElement.textContent.trim(),
+ 'A-The index-B-Hello world-C',
+ 'initial render'
+ );
+ });
+ }
+
+ ['@test Can disconnect a named outlet at the top level'](assert) {
+ this.addTemplate('application', 'A-{{outlet}}-B-{{outlet "other"}}-C');
+ this.addTemplate('modal', 'Hello world');
+ this.addTemplate('index', 'The index');
+ this.router.map(function() {
+ this.route('index', { path: '/' });
+ });
+ this.add(
+ 'route:application',
+ Route.extend({
+ renderTemplate() {
+ this.render();
+ this.render('modal', {
+ into: 'application',
+ outlet: 'other',
+ });
+ },
+ actions: {
+ banish() {
+ this.disconnectOutlet({
+ parentView: 'application',
+ outlet: 'other',
+ });
+ },
+ },
+ })
+ );
+
+ return this.visit('/').then(() => {
+ let rootElement = document.getElementById('qunit-fixture');
+ assert.equal(
+ rootElement.textContent.trim(),
+ 'A-The index-B-Hello world-C',
+ 'initial render'
+ );
+
+ run(this.applicationInstance.lookup('router:main'), 'send', 'banish');
+
+ assert.equal(rootElement.textContent.trim(), 'A-The index-B--C', 'second render');
+ });
+ }
+
+ ['@test Can render into a named outlet at the top level, with empty main outlet'](assert) {
+ this.addTemplate('application', 'A-{{outlet}}-B-{{outlet "other"}}-C');
+ this.addTemplate('modal', 'Hello world');
+
+ this.router.map(function() {
+ this.route('hasNoTemplate', { path: '/' });
+ });
+
+ this.add(
+ 'route:application',
+ Route.extend({
+ renderTemplate() {
+ this.render();
+ this.render('modal', {
+ into: 'application',
+ outlet: 'other',
+ });
+ },
+ })
+ );
+
+ return this.visit('/').then(() => {
+ let rootElement = document.getElementById('qunit-fixture');
+ assert.equal(rootElement.textContent.trim(), 'A--B-Hello world-C', 'initial render');
+ });
+ }
+
+ ['@test Can render into a named outlet at the top level, later'](assert) {
+ this.addTemplate('application', 'A-{{outlet}}-B-{{outlet "other"}}-C');
+ this.addTemplate('modal', 'Hello world');
+ this.addTemplate('index', 'The index');
+ this.router.map(function() {
+ this.route('index', { path: '/' });
+ });
+ this.add(
+ 'route:application',
+ Route.extend({
+ actions: {
+ launch() {
+ this.render('modal', {
+ into: 'application',
+ outlet: 'other',
+ });
+ },
+ },
+ })
+ );
+
+ return this.visit('/').then(() => {
+ let rootElement = document.getElementById('qunit-fixture');
+ assert.equal(rootElement.textContent.trim(), 'A-The index-B--C', 'initial render');
+ run(this.applicationInstance.lookup('router:main'), 'send', 'launch');
+ assert.equal(
+ rootElement.textContent.trim(),
+ 'A-The index-B-Hello world-C',
+ 'second render'
+ );
+ });
+ }
+
+ ["@test Can render routes with no 'main' outlet and their children"](assert) {
+ this.addTemplate('application', '<div id="application">{{outlet "app"}}</div>');
+ this.addTemplate(
+ 'app',
+ '<div id="app-common">{{outlet "common"}}</div><div id="app-sub">{{outlet "sub"}}</div>'
+ );
+ this.addTemplate('common', '<div id="common"></div>');
+ this.addTemplate('sub', '<div id="sub"></div>');
+
+ this.router.map(function() {
+ this.route('app', { path: '/app' }, function() {
+ this.route('sub', { path: '/sub', resetNamespace: true });
+ });
+ });
+
+ this.add(
+ 'route:app',
+ Route.extend({
+ renderTemplate() {
+ this.render('app', {
+ outlet: 'app',
+ into: 'application',
+ });
+ this.render('common', {
+ outlet: 'common',
+ into: 'app',
+ });
+ },
+ })
+ );
+
+ this.add(
+ 'route:sub',
+ Route.extend({
+ renderTemplate() {
+ this.render('sub', {
+ outlet: 'sub',
+ into: 'app',
+ });
+ },
+ })
+ );
+
+ let rootElement;
+ return this.visit('/app')
+ .then(() => {
+ rootElement = document.getElementById('qunit-fixture');
+ assert.equal(
+ rootElement.querySelectorAll('#app-common #common').length,
+ 1,
+ 'Finds common while viewing /app'
+ );
+ return this.visit('/app/sub');
+ })
+ .then(() => {
+ assert.equal(
+ rootElement.querySelectorAll('#app-common #common').length,
+ 1,
+ 'Finds common while viewing /app/sub'
+ );
+ assert.equal(
+ rootElement.querySelectorAll('#app-sub #sub').length,
+ 1,
+ 'Finds sub while viewing /app/sub'
+ );
+ });
+ }
+
+ ['@test Tolerates stacked renders'](assert) {
+ this.addTemplate('application', '{{outlet}}{{outlet "modal"}}');
+ this.addTemplate('index', 'hi');
+ this.addTemplate('layer', 'layer');
+ this.router.map(function() {
+ this.route('index', { path: '/' });
+ });
+ this.add(
+ 'route:application',
+ Route.extend({
+ actions: {
+ openLayer() {
+ this.render('layer', {
+ into: 'application',
+ outlet: 'modal',
+ });
+ },
+ close() {
+ this.disconnectOutlet({
+ outlet: 'modal',
+ parentView: 'application',
+ });
+ },
+ },
+ })
+ );
+
+ return this.visit('/').then(() => {
+ let rootElement = document.getElementById('qunit-fixture');
+ let router = this.applicationInstance.lookup('router:main');
+ assert.equal(rootElement.textContent.trim(), 'hi');
+ run(router, 'send', 'openLayer');
+ assert.equal(rootElement.textContent.trim(), 'hilayer');
+ run(router, 'send', 'openLayer');
+ assert.equal(rootElement.textContent.trim(), 'hilayer');
+ run(router, 'send', 'close');
+ assert.equal(rootElement.textContent.trim(), 'hi');
+ });
+ }
+
+ ['@test Renders child into parent with non-default template name'](assert) {
+ this.addTemplate('application', '<div class="a">{{outlet}}</div>');
+ this.addTemplate('exports.root', '<div class="b">{{outlet}}</div>');
+ this.addTemplate('exports.index', '<div class="c"></div>');
+
+ this.router.map(function() {
+ this.route('root', function() {});
+ });
+
+ this.add(
+ 'route:root',
+ Route.extend({
+ renderTemplate() {
+ this.render('exports/root');
+ },
+ })
+ );
+
+ this.add(
+ 'route:root.index',
+ Route.extend({
+ renderTemplate() {
+ this.render('exports/index');
+ },
+ })
+ );
+
+ return this.visit('/root').then(() => {
+ let rootElement = document.getElementById('qunit-fixture');
+ assert.equal(rootElement.querySelectorAll('.a .b .c').length, 1);
+ });
+ }
+
+ ["@test Allows any route to disconnectOutlet another route's templates"](assert) {
+ this.addTemplate('application', '{{outlet}}{{outlet "modal"}}');
+ this.addTemplate('index', 'hi');
+ this.addTemplate('layer', 'layer');
+ this.router.map(function() {
+ this.route('index', { path: '/' });
+ });
+ this.add(
+ 'route:application',
+ Route.extend({
+ actions: {
+ openLayer() {
+ this.render('layer', {
+ into: 'application',
+ outlet: 'modal',
+ });
+ },
+ },
+ })
+ );
+ this.add(
+ 'route:index',
+ Route.extend({
+ actions: {
+ close() {
+ this.disconnectOutlet({
+ parentView: 'application',
+ outlet: 'modal',
+ });
+ },
+ },
+ })
+ );
+
+ return this.visit('/').then(() => {
+ let rootElement = document.getElementById('qunit-fixture');
+ let router = this.applicationInstance.lookup('router:main');
+ assert.equal(rootElement.textContent.trim(), 'hi');
+ run(router, 'send', 'openLayer');
+ assert.equal(rootElement.textContent.trim(), 'hilayer');
+ run(router, 'send', 'close');
+ assert.equal(rootElement.textContent.trim(), 'hi');
+ });
+ }
+
+ ['@test Components inside an outlet have their didInsertElement hook invoked when the route is displayed'](
+ assert
+ ) {
+ this.addTemplate(
+ 'index',
+ '{{#if showFirst}}{{my-component}}{{else}}{{other-component}}{{/if}}'
+ );
+
+ let myComponentCounter = 0;
+ let otherComponentCounter = 0;
+ let indexController;
+
+ this.router.map(function() {
+ this.route('index', { path: '/' });
+ });
+
+ this.add(
+ 'controller:index',
+ Controller.extend({
+ showFirst: true,
+ })
+ );
+
+ this.add(
+ 'route:index',
+ Route.extend({
+ setupController(controller) {
+ indexController = controller;
+ },
+ })
+ );
+
+ this.add(
+ 'component:my-component',
+ Component.extend({
+ didInsertElement() {
+ myComponentCounter++;
+ },
+ })
+ );
+
+ this.add(
+ 'component:other-component',
+ Component.extend({
+ didInsertElement() {
+ otherComponentCounter++;
+ },
+ })
+ );
+
+ return this.visit('/').then(() => {
+ assert.strictEqual(
+ myComponentCounter,
+ 1,
+ 'didInsertElement invoked on displayed component'
+ );
+ assert.strictEqual(
+ otherComponentCounter,
+ 0,
+ 'didInsertElement not invoked on displayed component'
+ );
+
+ run(() => indexController.set('showFirst', false));
+
+ assert.strictEqual(
+ myComponentCounter,
+ 1,
+ 'didInsertElement not invoked on displayed component'
+ );
+ assert.strictEqual(
+ otherComponentCounter,
+ 1,
+ 'didInsertElement invoked on displayed component'
+ );
+ });
+ }
+
+ ['@test Exception if outlet name is undefined in render and disconnectOutlet']() {
+ this.add(
+ 'route:application',
+ Route.extend({
+ actions: {
+ showModal() {
+ this.render({
+ outlet: undefined,
+ parentView: 'application',
+ });
+ },
+ hideModal() {
+ this.disconnectOutlet({
+ outlet: undefined,
+ parentView: 'application',
+ });
+ },
+ },
+ })
+ );
+
+ return this.visit('/').then(() => {
+ let router = this.applicationInstance.lookup('router:main');
+ expectAssertion(() => {
+ run(() => router.send('showModal'));
+ }, /You passed undefined as the outlet name/);
+
+ expectAssertion(() => {
+ run(() => router.send('hideModal'));
+ }, /You passed undefined as the outlet name/);
+ });
+ }
+ }
+);
| true |
Other
|
emberjs
|
ember.js
|
6b68df8ae7e016d2cb2834efd79769c4a8f1705b.json
|
move methods off test class
|
packages/ember/tests/routing/decoupled_basic_test.js
|
@@ -21,6 +21,17 @@ import { InternalTransition as Transition } from 'router_js';
let originalConsoleError;
+function handleURLRejectsWith(context, assert, path, expectedReason) {
+ return context
+ .visit(path)
+ .then(() => {
+ assert.ok(false, 'expected handleURLing: `' + path + '` to fail');
+ })
+ .catch(reason => {
+ assert.equal(reason.message, expectedReason);
+ });
+}
+
moduleFor(
'Basic Routing - Decoupled from global resolver',
class extends ApplicationTestCase {
@@ -42,10 +53,6 @@ moduleFor(
console.error = originalConsoleError;
}
- getController(name) {
- return this.applicationInstance.lookup(`controller:${name}`);
- }
-
handleURLAborts(assert, path, deprecated) {
run(() => {
let router = this.applicationInstance.lookup('router:main');
@@ -76,22 +83,11 @@ moduleFor(
get currentPath() {
let currentPath;
expectDeprecation(() => {
- currentPath = this.getController('application').get('currentPath');
+ currentPath = this.applicationInstance.lookup('controller:application').get('currentPath');
}, 'Accessing `currentPath` on `controller:application` is deprecated, use the `currentPath` property on `service:router` instead.');
return currentPath;
}
- handleURLRejectsWith(context, assert, path, expectedReason) {
- return context
- .visit(path)
- .then(() => {
- assert.ok(false, 'expected handleURLing: `' + path + '` to fail');
- })
- .catch(reason => {
- assert.equal(reason.message, expectedReason);
- });
- }
-
async ['@test warn on URLs not included in the route set'](assert) {
await this.visit('/');
@@ -949,7 +945,7 @@ moduleFor(
})
);
- runTask(() => this.handleURLRejectsWith(this, assert, 'specials/1', 'Setup error'));
+ runTask(() => handleURLRejectsWith(this, assert, 'specials/1', 'Setup error'));
resolve(menuItem);
}
@@ -1000,7 +996,7 @@ moduleFor(
);
let promise = runTask(() =>
- this.handleURLRejectsWith(this, assert, '/specials/1', 'Setup error')
+ handleURLRejectsWith(this, assert, '/specials/1', 'Setup error')
);
resolve(menuItem);
| false |
Other
|
emberjs
|
ember.js
|
0a75c9e631f67da06a87a2050140eba4958be518.json
|
[DOCS] Route, setupController: add missing transition param (#18596)
[DOCS] Route, setupController: add missing transition param
|
packages/@ember/-internals/routing/lib/system/route.ts
|
@@ -1282,6 +1282,7 @@ class Route extends EmberObject implements IRoute {
@method setupController
@param {Controller} controller instance
@param {Object} model
+ @param {Object} transition
@since 1.0.0
@public
*/
| false |
Other
|
emberjs
|
ember.js
|
30b324ba23a559894c182529b953a1557c0f4831.json
|
Update glimmer packages to 0.47.4.
The only change here is an update to simple-html-tokenizer which fixes
compilation errors for `<Title></Title>` (having a custom title
component).
|
package.json
|
@@ -74,15 +74,15 @@
},
"devDependencies": {
"@babel/preset-env": "^7.7.7",
- "@glimmer/compiler": "0.47.3",
+ "@glimmer/compiler": "0.47.4",
"@glimmer/env": "^0.1.7",
- "@glimmer/interfaces": "0.47.3",
- "@glimmer/node": "0.47.3",
- "@glimmer/opcode-compiler": "0.47.3",
- "@glimmer/program": "0.47.3",
- "@glimmer/reference": "0.47.3",
- "@glimmer/runtime": "0.47.3",
- "@glimmer/validator": "0.47.3",
+ "@glimmer/interfaces": "0.47.4",
+ "@glimmer/node": "0.47.4",
+ "@glimmer/opcode-compiler": "0.47.4",
+ "@glimmer/program": "0.47.4",
+ "@glimmer/reference": "0.47.4",
+ "@glimmer/runtime": "0.47.4",
+ "@glimmer/validator": "0.47.4",
"@simple-dom/document": "^1.4.0",
"@types/qunit": "^2.5.4",
"@types/rsvp": "^4.0.3",
| true |
Other
|
emberjs
|
ember.js
|
30b324ba23a559894c182529b953a1557c0f4831.json
|
Update glimmer packages to 0.47.4.
The only change here is an update to simple-html-tokenizer which fixes
compilation errors for `<Title></Title>` (having a custom title
component).
|
yarn.lock
|
@@ -801,138 +801,138 @@
resolved "https://registry.yarnpkg.com/@ember/edition-utils/-/edition-utils-1.1.1.tgz#d5732c3da593f202e6e1ac6dbee56a758242403f"
integrity sha512-GEhri78jdQp/xxPpM6z08KlB0wrHfnfrJ9dmQk7JeQ4XCiMzXsJci7yooQgg/IcTKCM/PxE/IkGCQAo80adMkw==
-"@glimmer/[email protected]":
- version "0.47.3"
- resolved "https://registry.yarnpkg.com/@glimmer/compiler/-/compiler-0.47.3.tgz#6017f00d64cb8a665067ba86a38e95dde5952ea6"
- integrity sha512-I43J+1fUIgLCGOjZ0BllNDcgiCkwCFkVK2pV3znhWD0l2zxWyNWAxu0S1XLc8iw9yhm3H0NfzIeADWhBDAw2eg==
- dependencies:
- "@glimmer/interfaces" "^0.47.3"
- "@glimmer/syntax" "^0.47.3"
- "@glimmer/util" "^0.47.3"
- "@glimmer/wire-format" "^0.47.3"
+"@glimmer/[email protected]":
+ version "0.47.4"
+ resolved "https://registry.yarnpkg.com/@glimmer/compiler/-/compiler-0.47.4.tgz#53c024ea66457be20f80b2c95845ec9ae838f4ee"
+ integrity sha512-YuNJR22gN7TYevenRlQIRLxys7d3i2hHX/qZdhy/VDCgXacf0AMm87LQAKM4k1sjHG8NtveSUEzAughLOBm7GQ==
+ dependencies:
+ "@glimmer/interfaces" "^0.47.4"
+ "@glimmer/syntax" "^0.47.4"
+ "@glimmer/util" "^0.47.4"
+ "@glimmer/wire-format" "^0.47.4"
"@simple-dom/interface" "^1.4.0"
-"@glimmer/encoder@^0.47.3":
- version "0.47.3"
- resolved "https://registry.yarnpkg.com/@glimmer/encoder/-/encoder-0.47.3.tgz#52c4920310b6a641d2622bc64f751c93b69172b5"
- integrity sha512-WxFHveKXaVOPWJha10QrQItZNkHmtQDWovAImvOJ1tVJP0n1lApxDPmHWm8JxHAAz3rAXdWP7BE+cXpADWAGCw==
+"@glimmer/encoder@^0.47.4":
+ version "0.47.4"
+ resolved "https://registry.yarnpkg.com/@glimmer/encoder/-/encoder-0.47.4.tgz#c52c46d587152d0af1c3e866a4062d0665a8cc4a"
+ integrity sha512-tYZdIKssBTCogsUbjqhnbP27W9ZiefTYGebNH7O7V+/4ZeitiRhVzy+ELDSB0vKyvlfYWxyecjcckvxVTJBaNQ==
dependencies:
- "@glimmer/interfaces" "^0.47.3"
- "@glimmer/vm" "^0.47.3"
+ "@glimmer/interfaces" "^0.47.4"
+ "@glimmer/vm" "^0.47.4"
"@glimmer/[email protected]", "@glimmer/env@^0.1.7":
version "0.1.7"
resolved "https://registry.yarnpkg.com/@glimmer/env/-/env-0.1.7.tgz#fd2d2b55a9029c6b37a6c935e8c8871ae70dfa07"
integrity sha1-/S0rVakCnGs3psk16MiHGucN+gc=
-"@glimmer/[email protected]", "@glimmer/interfaces@^0.47.3":
- version "0.47.3"
- resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.47.3.tgz#cbe70af51fe9779e273f5fc5c4df82fb44220cc4"
- integrity sha512-5woCzbLqzes9ZMu0Kw16Ukt8ZiMPTqfkNuQPQSZHD/sCS6xg3TRNghrBz8GSv525p5g5x4TjdOl6JoTUzf/qlw==
+"@glimmer/[email protected]", "@glimmer/interfaces@^0.47.4":
+ version "0.47.4"
+ resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.47.4.tgz#17772fae66571b606f9fa26d733d7211960a2560"
+ integrity sha512-Wbv6954fIOy1aWHh2IdneBmIGrGysyu+ZWrmAiuMQC92uf57a9AXFJW0DFY+X6gd8Biaw/Nx8EHE0bNeMYCp9Q==
dependencies:
"@simple-dom/interface" "^1.4.0"
-"@glimmer/low-level@^0.47.3":
- version "0.47.3"
- resolved "https://registry.yarnpkg.com/@glimmer/low-level/-/low-level-0.47.3.tgz#aea34ef892b0d2b2c8b1f095e9ae5c1e6bc2e7ba"
- integrity sha512-k/E8CNwpAOQmID3uBVhYiHK8GJta+Puqn0abErZmRMbOY8LFwLJVJ/ga8HqKj6R8w220EKBl+HZEenvy3GS+PA==
+"@glimmer/low-level@^0.47.4":
+ version "0.47.4"
+ resolved "https://registry.yarnpkg.com/@glimmer/low-level/-/low-level-0.47.4.tgz#04684558499f5a5dbeec6ab440f97c3889156e20"
+ integrity sha512-brjZnS2XjKJFtG7XsjiL/D+CgLAi2uFcuDQAMcUEATsjTdW/XWspnBrUaX2s5SmaFwf843pZi61oKr0EgLmQKw==
-"@glimmer/[email protected]":
- version "0.47.3"
- resolved "https://registry.yarnpkg.com/@glimmer/node/-/node-0.47.3.tgz#99e9134cbda9e64647be789abe93b77ec722c468"
- integrity sha512-eeXLl8jUJhmcAa9EwJeCf4n/KH93XQjAlv+eFVmpEBu4jXuN/3TrgnMqArMpnvthFJNn/k3mBepEifamfQU4KA==
+"@glimmer/[email protected]":
+ version "0.47.4"
+ resolved "https://registry.yarnpkg.com/@glimmer/node/-/node-0.47.4.tgz#a19ed1afb2ebac656d98a35acb4931a8a987fd23"
+ integrity sha512-UP86z6x2Bh7Q4jWbPxAvuWsfCqsbM8lROSiNx5ReA+K8iUgTT3PT6c2ea7TUSVmHnsx0Xzbs6UgINGMSROIaCg==
dependencies:
- "@glimmer/interfaces" "^0.47.3"
- "@glimmer/runtime" "^0.47.3"
+ "@glimmer/interfaces" "^0.47.4"
+ "@glimmer/runtime" "^0.47.4"
"@simple-dom/document" "^1.4.0"
"@simple-dom/interface" "^1.4.0"
-"@glimmer/[email protected]":
- version "0.47.3"
- resolved "https://registry.yarnpkg.com/@glimmer/opcode-compiler/-/opcode-compiler-0.47.3.tgz#a9e139ebf3ea6db11cdc43ce69dfbde962218b2c"
- integrity sha512-v02O6GlzJN/W3c9WJaM1iUxXvC5hKgBfT+UQ4KUeLc/VF1TqJ1UhwcCUNrTrq685DmgMoBDWmv0/1zNU2lKl1Q==
- dependencies:
- "@glimmer/encoder" "^0.47.3"
- "@glimmer/interfaces" "^0.47.3"
- "@glimmer/program" "^0.47.3"
- "@glimmer/reference" "^0.47.3"
- "@glimmer/util" "^0.47.3"
- "@glimmer/vm" "^0.47.3"
- "@glimmer/wire-format" "^0.47.3"
-
-"@glimmer/[email protected]", "@glimmer/program@^0.47.3":
- version "0.47.3"
- resolved "https://registry.yarnpkg.com/@glimmer/program/-/program-0.47.3.tgz#9e6a29ee447b6c05460cb2d572b54bd5fdb0f5e7"
- integrity sha512-MN24uNA5fwMoA9x7JYs5oxVjP5I0zhTjSxcgXFIk6scyKmSqsX3fGXjYzBfeZ4cVyoaRJSykOm0UkTO56K+S1w==
- dependencies:
- "@glimmer/encoder" "^0.47.3"
- "@glimmer/interfaces" "^0.47.3"
- "@glimmer/util" "^0.47.3"
-
-"@glimmer/[email protected]", "@glimmer/reference@^0.47.3":
- version "0.47.3"
- resolved "https://registry.yarnpkg.com/@glimmer/reference/-/reference-0.47.3.tgz#34e879de392a54b19324fe6784e1b1c153a3ce4a"
- integrity sha512-F7A92ZcxvkJJvMjwuOgA5EUBpHb2mxHorqNlLUHoxSRfhCgYBKkUqdtEsK6PEKra4uAEFwNJDE0K4CxRXai4nA==
+"@glimmer/[email protected]":
+ version "0.47.4"
+ resolved "https://registry.yarnpkg.com/@glimmer/opcode-compiler/-/opcode-compiler-0.47.4.tgz#71decdfa7cac9ceef18e415ab349288e83768e53"
+ integrity sha512-uNY88oFZT6vwE5T+Cq74mJEkr8fwZ+nfIqRXtZNAIl8gNxfZDv0Q6nSDK+U2WNz6s4edomzxRUL67wpREfzwGw==
+ dependencies:
+ "@glimmer/encoder" "^0.47.4"
+ "@glimmer/interfaces" "^0.47.4"
+ "@glimmer/program" "^0.47.4"
+ "@glimmer/reference" "^0.47.4"
+ "@glimmer/util" "^0.47.4"
+ "@glimmer/vm" "^0.47.4"
+ "@glimmer/wire-format" "^0.47.4"
+
+"@glimmer/[email protected]", "@glimmer/program@^0.47.4":
+ version "0.47.4"
+ resolved "https://registry.yarnpkg.com/@glimmer/program/-/program-0.47.4.tgz#b0105b28e332b458839b6c2e50c99f349198033b"
+ integrity sha512-jI3FbnE96HasdkYwqPNcOG/pwiIyfN7M3hrpKP1WCvtrDTp6MeikKSdiEafZefNlOk/zr1OqnG9RNMzjl7N3+w==
+ dependencies:
+ "@glimmer/encoder" "^0.47.4"
+ "@glimmer/interfaces" "^0.47.4"
+ "@glimmer/util" "^0.47.4"
+
+"@glimmer/[email protected]", "@glimmer/reference@^0.47.4":
+ version "0.47.4"
+ resolved "https://registry.yarnpkg.com/@glimmer/reference/-/reference-0.47.4.tgz#972e24313ce2552e24ebbaf1ce7691d7c4c1f7e9"
+ integrity sha512-A7ruDxaa/jFSoAWv0yeGRGgtEevaP1XAhamJ4CMGAXAwE2PiODo5TZRNiTsgKnoZytsokcvfXOJZIHHQ/VHdTg==
dependencies:
"@glimmer/env" "^0.1.7"
- "@glimmer/util" "^0.47.3"
- "@glimmer/validator" "^0.47.3"
+ "@glimmer/util" "^0.47.4"
+ "@glimmer/validator" "^0.47.4"
-"@glimmer/[email protected]", "@glimmer/runtime@^0.47.3":
- version "0.47.3"
- resolved "https://registry.yarnpkg.com/@glimmer/runtime/-/runtime-0.47.3.tgz#67c0a7d2c20c7b1768e3eb7d9e3ce4a10941b294"
- integrity sha512-eCS4ucIcKKHr0Ys17uteNH6J6lUIRAK6gr3DW5CT26EpvJ+mCLSHu1Eu6vXrUmXztfRENVuMkPVanJ0qkiwknA==
+"@glimmer/[email protected]", "@glimmer/runtime@^0.47.4":
+ version "0.47.4"
+ resolved "https://registry.yarnpkg.com/@glimmer/runtime/-/runtime-0.47.4.tgz#ebeb396f5b4a1dea28b9865f8c7990b445474343"
+ integrity sha512-41eyqls4TpWk1tNVZHG0v2O2ynIpJr/vkCn3fPCajYM96KTV0dAXThJWwRm04O6nSzMaGmSpFawDjCe0A1FZtw==
dependencies:
"@glimmer/env" "0.1.7"
- "@glimmer/interfaces" "^0.47.3"
- "@glimmer/low-level" "^0.47.3"
- "@glimmer/program" "^0.47.3"
- "@glimmer/reference" "^0.47.3"
- "@glimmer/util" "^0.47.3"
- "@glimmer/validator" "^0.47.3"
- "@glimmer/vm" "^0.47.3"
- "@glimmer/wire-format" "^0.47.3"
+ "@glimmer/interfaces" "^0.47.4"
+ "@glimmer/low-level" "^0.47.4"
+ "@glimmer/program" "^0.47.4"
+ "@glimmer/reference" "^0.47.4"
+ "@glimmer/util" "^0.47.4"
+ "@glimmer/validator" "^0.47.4"
+ "@glimmer/vm" "^0.47.4"
+ "@glimmer/wire-format" "^0.47.4"
"@simple-dom/interface" "^1.4.0"
-"@glimmer/syntax@^0.47.3":
- version "0.47.3"
- resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.47.3.tgz#8082b5e354f27defd3307e78538db41a8df45294"
- integrity sha512-cR9F8aiEBRJptA1/rzuDQ3HSBfHidCcT3zZJ1n3NF1TwTwxtV1xzAMhXaU3laRMm1LMHsPG5jnNOjsII/NR4xw==
+"@glimmer/syntax@^0.47.4":
+ version "0.47.4"
+ resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.47.4.tgz#827f63a9c5f14a8329ff26c1e1f6ad211683690d"
+ integrity sha512-GCqoKyU11+cD9jL1J6AlSgKn1/rFUt/Wc3pgf/AE7uxza00OOYDEbqfpzOdv9sF727aqKdy9qp3a9O54IcevuA==
dependencies:
- "@glimmer/interfaces" "^0.47.3"
- "@glimmer/util" "^0.47.3"
+ "@glimmer/interfaces" "^0.47.4"
+ "@glimmer/util" "^0.47.4"
handlebars "^4.5.1"
- simple-html-tokenizer "^0.5.8"
+ simple-html-tokenizer "^0.5.9"
-"@glimmer/util@^0.47.3":
- version "0.47.3"
- resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.47.3.tgz#9d104e54d301e03707ea2228431e373529284d55"
- integrity sha512-2zFJIoqE4OxsEZkRi0tlHgjkL65AKcXNMTnBDsFSf7tLA0+Z58G18tM7mqijbZLZkwxA6/+uVpE/uGj0NbT24Q==
+"@glimmer/util@^0.47.4":
+ version "0.47.4"
+ resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.47.4.tgz#de6061d30f03ca09950208f6de7b529efc8fb539"
+ integrity sha512-uGcUjDtcy/CTSKMYuIpmvZfv4busDcPbx6X+AnWkaTIonvp0z8HKpZ5QYrulR9Gcbbtb+noCTmMr2qa7AEyA4Q==
dependencies:
"@simple-dom/interface" "^1.4.0"
-"@glimmer/[email protected]", "@glimmer/validator@^0.47.3":
- version "0.47.3"
- resolved "https://registry.yarnpkg.com/@glimmer/validator/-/validator-0.47.3.tgz#09722d88b2023b4e26632ab3e5ed9dacdbb5f3b2"
- integrity sha512-k7By19cTMFR53LtXsAwk/Ezrny4Md1YXTNdVqD8fXMOmA0xF5iiK+5s6TFaxxxtk08LKNKgU1x6x8L+2gR0TiA==
+"@glimmer/[email protected]", "@glimmer/validator@^0.47.4":
+ version "0.47.4"
+ resolved "https://registry.yarnpkg.com/@glimmer/validator/-/validator-0.47.4.tgz#8ba22ccdf5adbf57fd175cbe77f447e43cabd092"
+ integrity sha512-u7jFJRBtz3i5/XWRlfCjSUsp6/NEA4J0/ildurvfdWDZusLZ0qAu995H1C12WtpIvvbY4rA/ELHnt5sNMldHDQ==
dependencies:
"@glimmer/env" "^0.1.7"
-"@glimmer/vm@^0.47.3":
- version "0.47.3"
- resolved "https://registry.yarnpkg.com/@glimmer/vm/-/vm-0.47.3.tgz#0086952717944dc38d883567c78850f6861f55e3"
- integrity sha512-3KMuT+CXbDjTDFXHBjc7nid9iDBupj7SFAwDkmkuMErmrUjCf+j9N5R/jhJuljRI8KA2N1W4EMzGDkHBz1kpow==
+"@glimmer/vm@^0.47.4":
+ version "0.47.4"
+ resolved "https://registry.yarnpkg.com/@glimmer/vm/-/vm-0.47.4.tgz#13cab445e5e8dccb556150dacbfa2f9d3384a6e0"
+ integrity sha512-pZHbgfNG24WYO/nYldBOQMuasau3sgxTc9F10Pk1mAUKoCSSct2z04MoJrrvOh1ItpppIxLS5OHsLkBBNtbEDg==
dependencies:
- "@glimmer/interfaces" "^0.47.3"
- "@glimmer/util" "^0.47.3"
+ "@glimmer/interfaces" "^0.47.4"
+ "@glimmer/util" "^0.47.4"
-"@glimmer/wire-format@^0.47.3":
- version "0.47.3"
- resolved "https://registry.yarnpkg.com/@glimmer/wire-format/-/wire-format-0.47.3.tgz#16699818745f290520edfad5bd5dab94cd08b012"
- integrity sha512-nu+c1SrVAwyMeGuBNTCSoh/0qL0Fb0SYYZdLkd5xO8FxWjB4zgyJKwI2DpnBcIk4ymzyD1LcviU1HbYyrpiT8w==
+"@glimmer/wire-format@^0.47.4":
+ version "0.47.4"
+ resolved "https://registry.yarnpkg.com/@glimmer/wire-format/-/wire-format-0.47.4.tgz#9e05a9f9eb48a8494b37b2c90f89ac03f048925d"
+ integrity sha512-DMrx8sC6cOR4+5dDq/i8FzqJFGB6LTEcBjDyjLKqP9O9I0FY1ktjn4mcuFAm2KB7LLMbYa1u3iLHRaEs4k3deg==
dependencies:
- "@glimmer/interfaces" "^0.47.3"
- "@glimmer/util" "^0.47.3"
+ "@glimmer/interfaces" "^0.47.4"
+ "@glimmer/util" "^0.47.4"
"@simple-dom/document@^1.4.0":
version "1.4.0"
@@ -7585,10 +7585,10 @@ simple-dom@^1.4.0:
"@simple-dom/serializer" "^1.4.0"
"@simple-dom/void-map" "^1.4.0"
-simple-html-tokenizer@^0.5.8:
- version "0.5.8"
- resolved "https://registry.yarnpkg.com/simple-html-tokenizer/-/simple-html-tokenizer-0.5.8.tgz#3417382f75954ee34515cc4fd32d9918e693f173"
- integrity sha512-0Sq4FvLlQEQODVA6PH2MIrc7tzYO0KT2HzzwvaVLYClWgIsuvaNUOrhrAvTi1pZHrcq7GDB4WiI3ukjqBMxcGQ==
+simple-html-tokenizer@^0.5.9:
+ version "0.5.9"
+ resolved "https://registry.yarnpkg.com/simple-html-tokenizer/-/simple-html-tokenizer-0.5.9.tgz#1a83fe97f5a3e39b335fddf71cfe9b0263b581c2"
+ integrity sha512-w/3FEDN94r4JQ9WoYrIr8RqDIPZdyNkdpbK9glFady1CAEyD97XWCv8HFetQO21w81e7h7Nh59iYTyG1mUJftg==
slice-ansi@^2.1.0:
version "2.1.0"
| true |
Other
|
emberjs
|
ember.js
|
99e796a0ae52bc161b8541d0e481d27b7f21164c.json
|
Add v3.17.0-beta.2 to CHANGELOG
[ci skip]
(cherry picked from commit 799c0c38648e157a75dfad78aa6267b6f77f5094)
|
CHANGELOG.md
|
@@ -1,5 +1,11 @@
# Ember Changelog
+### v3.17.0-beta.2 (January 29, 2020)
+
+- [#18691](https://github.com/emberjs/ember.js/pull/18691) [BUGFIX] Updated blueprints for component and helper tests to output the correct hbs import statement
+- [#18694](https://github.com/emberjs/ember.js/pull/18694) [BUGFIX] Ensure tag updates are buffered, remove error message
+- [#18709](https://github.com/emberjs/ember.js/pull/18709) [BUGFIX] Fix `this` in `@tracked` initializer
+
### v3.17.0-beta.1 (January 20, 2020)
- [#18688](https://github.com/emberjs/ember.js/pull/18688) / [#18621](https://github.com/emberjs/ember.js/pull/18621) Updates Glimmer-VM to v0.46
| false |
Other
|
emberjs
|
ember.js
|
2fe2d01ad3312d1d28d4723d3f170357b2f7f688.json
|
add assertion for yield, fix assertion for usage
|
packages/ember-template-compiler/lib/plugins/assert-against-named-blocks.ts
|
@@ -22,15 +22,34 @@ export default function assertAgainstNamedBlocks(env: ASTPluginEnvironment): AST
visitor: {
ElementNode(node: AST.ElementNode) {
if (node.tag[0] === ':') {
- assert(assertMessage(node.tag, moduleName, node));
+ let sourceInformation = calculateLocationDisplay(moduleName, node.loc);
+
+ assert(
+ `Named blocks are not currently available, attempted to use the <${node.tag}> named block. ${sourceInformation}`
+ );
}
},
- },
- };
-}
-function assertMessage(tagName: string, moduleName: string, node: AST.ElementNode) {
- let sourceInformation = calculateLocationDisplay(moduleName, node.loc);
+ MustacheStatement(node: AST.MustacheStatement) {
+ if (node.path.type === 'PathExpression' && node.path.original === 'yield') {
+ let to = node.hash.pairs.filter(pair => pair.key === 'to')[0];
+
+ // Glimmer template compiler ensures yield must receive a string literal,
+ // so we only need to check if it is not "default" or "inverse"
+ if (
+ to &&
+ to.value.type === 'StringLiteral' &&
+ to.value.original !== 'default' &&
+ to.value.original !== 'inverse'
+ ) {
+ let sourceInformation = calculateLocationDisplay(moduleName, node.loc);
- return `Named blocks are not currently available, attempted to use the {{${tagName}}} named block. ${sourceInformation}`;
+ assert(
+ `Named blocks are not currently available, attempted to yield to a named block other than "default" or "inverse": {{yield to="${to.value.original}"}}. ${sourceInformation}`
+ );
+ }
+ }
+ },
+ },
+ };
}
| true |
Other
|
emberjs
|
ember.js
|
2fe2d01ad3312d1d28d4723d3f170357b2f7f688.json
|
add assertion for yield, fix assertion for usage
|
packages/ember-template-compiler/tests/plugins/assert-against-named-blocks-test.js
|
@@ -10,14 +10,24 @@ moduleFor(
compile(`<Foo><:named></:named></Foo>`, {
moduleName: 'baz/foo-bar',
});
+
+ compile(`{{yield to="bar"}}`, {
+ moduleName: 'baz/bar-baz',
+ });
}
[`@feature(!EMBER_NAMED_BLOCKS) is enabled when feature flag is disabled`]() {
expectAssertion(() => {
compile(`<Foo><:named></:named></Foo>`, {
moduleName: 'baz/foo-bar',
});
- }, `Named blocks are not currently available, attempted to use the {{:named}} named block. ('baz/foo-bar' @ L1:C5) `);
+ }, `Named blocks are not currently available, attempted to use the <:named> named block. ('baz/foo-bar' @ L1:C5) `);
+
+ expectAssertion(() => {
+ compile(`{{yield to="bar"}}`, {
+ moduleName: 'baz/bar-baz',
+ });
+ }, `Named blocks are not currently available, attempted to yield to a named block other than "default" or "inverse": {{yield to="bar"}}. ('baz/bar-baz' @ L1:C0) `);
}
}
);
| true |
Other
|
emberjs
|
ember.js
|
f0c95ad1c93c7bb29e3fc2a77858d59cc3296baf.json
|
Add v3.17.0-beta.1 to CHANGELOG
[ci skip]
(cherry picked from commit f04083d959903fcfabfaa92e5929a15ed73611e3)
|
CHANGELOG.md
|
@@ -1,5 +1,9 @@
# Ember Changelog
+### v3.17.0-beta.1 (January 20, 2020)
+
+- [#18688](https://github.com/emberjs/ember.js/pull/18688) / [#18621](https://github.com/emberjs/ember.js/pull/18621) Updates Glimmer-VM to v0.46
+
### v3.16.0 (January 20, 2020)
- [#18436](https://github.com/emberjs/ember.js/pull/18436) [DEPRECATION] Deprecate globals resolver per [RFC #331](https://github.com/emberjs/rfcs/blob/master/text/0331-deprecate-globals-resolver.md).
| false |
Other
|
emberjs
|
ember.js
|
f8fc3e9bfe3ef8928e00127e148bd248124e7f80.json
|
Add v3.16.0 to CHANGELOG
[ci skip]
(cherry picked from commit 8834ed1002f71fbee2ca9bd3f6694307fea22f00)
|
CHANGELOG.md
|
@@ -1,8 +1,10 @@
# Ember Changelog
-### v3.16.0-beta.1 (December 9, 2019)
+### v3.16.0 (January 20, 2020)
- [#18436](https://github.com/emberjs/ember.js/pull/18436) [DEPRECATION] Deprecate globals resolver per [RFC #331](https://github.com/emberjs/rfcs/blob/master/text/0331-deprecate-globals-resolver.md).
+- [#18668](https://github.com/emberjs/ember.js/pull/18668) [BUGFIX] Fix some scenarios where the "backtracking assertion" would be thrown by consuming tags after fully getting values
+- [#18651](https://github.com/emberjs/ember.js/pull/18651) [BUGFIX] Async functions were incorrectly treated as falsey in template conditionals
### v3.15.0 (December 9, 2019)
| false |
Other
|
emberjs
|
ember.js
|
d3ac1b95c6d967901b8f60237023e237b3f719f6.json
|
Reword replaceWith explanation
|
packages/@ember/-internals/routing/lib/services/router.ts
|
@@ -113,9 +113,11 @@ export default class RouterService extends Service {
}
/**
-Replace current route (URL) in history to desired destination route. instead of adding the desired Route to Route history,The route may be either a single route or route path:
-The major functional difference found between transitionTo and replaceWith is that on using transitionTo to navigate to new page, you can go Back to previsious route,Whereas in replaceWith this functionality
-is not possible due to the replacing mechanism
+ Similar to transitionTo, but instead of adding the destination to the browser's URL history,
+ it replaces the entry for the current route.
+ When the user clicks the "back" button in the browser, there will be fewer steps.
+ This is most commonly used to manage redirects in a way that does not cause confusing additions
+ to the user's browsing history.
See [replaceWith](/api/ember/release/classes/Route/methods/replaceWith?anchor=replaceWith) for more info.
Calling `replaceWith` from the Router service will cause default query parameter values to be included in the URL.
| false |
Other
|
emberjs
|
ember.js
|
93ac223bb56ca267176a398ca9e7afde047cea7a.json
|
tweak the content
|
packages/@ember/-internals/routing/lib/services/router.ts
|
@@ -94,7 +94,7 @@ export default class RouterService extends Service {
In the following example we use the Router service to navigate to a route with a
specific model from a Component.
- ```javascript
+ ```app/components/example.js
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
@@ -248,7 +248,8 @@ export default class RouterService extends Service {
See [model](api/ember/release/classes/Route/methods/model?anchor=model) and
[queryParams](/api/ember/3.7/classes/Route/properties/queryParams?anchor=queryParams) for more information about these arguments.
- In the following example, isActive will return `true` if the current route is `/posts`.
+ In the following example, `isActive` will return `true` if the current route is `/posts`.
+
```app/components/posts.js
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
@@ -262,8 +263,21 @@ export default class RouterService extends Service {
});
```
- Usage example with a model:
- ```javascript return this.get('router').isActive('posts', post.id)```
+ The next example includes a dynamic segment, and will return `true` if the current route is `/posts/1`,
+ assuming the post has an id of 1:
+
+ ```app/components/posts.js
+ import Component from '@glimmer/component';
+ import { inject as service } from '@ember/service';
+
+ export default class extends Component {
+ @service router;
+
+ displayComments(post) {
+ return this.get('router').isActive('posts', post.id);
+ }
+ });
+ ```
Where `post.id` is the id of a specific post, which is represented in the route as /posts/[post.id].
If `post.id` is equal to 1, then isActive will return true if the current route is /posts/1, and false if the route is anything else.
| false |
Other
|
emberjs
|
ember.js
|
bdfcdbe28794d28a644e07383a377adc62cfc4f4.json
|
use polyfill for WeakSet
|
packages/@ember/-internals/metal/lib/tags.ts
|
@@ -7,6 +7,7 @@ import {
toString,
} from '@ember/-internals/utils';
import { assert, deprecate } from '@ember/debug';
+import { _WeakSet as WeakSet } from '@ember/polyfills';
import { backburner } from '@ember/runloop';
import { DEBUG } from '@glimmer/env';
import {
| false |
Other
|
emberjs
|
ember.js
|
4a4c12cb36b7c9c8a016e557ae37eefac17417ad.json
|
fix last tests
|
packages/@ember/-internals/metal/tests/tracked/validation_test.js
|
@@ -286,17 +286,40 @@ moduleFor(
assert.equal(get(obj, 'full'), 'Tizzle Dale');
}
- ['@test interaction with arrays'](assert) {
+ ['@test ember get interaction with arrays'](assert) {
+ class EmberObject {
+ array = [];
+ }
+
+ let obj = new EmberObject();
+ let array;
+
+ let tag = track(() => (array = get(obj, 'array')));
+ let snapshot = value(tag);
+
+ assert.deepEqual(array, []);
+ assert.equal(validate(tag, snapshot), true);
+
+ array.push(1);
+ notifyPropertyChange(array, '[]');
+ assert.equal(
+ validate(tag, snapshot),
+ false,
+ 'invalid after pushing an object and notifying on the array'
+ );
+ }
+
+ ['@test native get interaction with arrays'](assert) {
class EmberObject {
@tracked array = [];
}
let obj = new EmberObject();
+ let array;
- let tag = tagForProperty(obj, 'array');
+ let tag = track(() => (array = obj.array));
let snapshot = value(tag);
- let array = get(obj, 'array');
assert.deepEqual(array, []);
assert.equal(validate(tag, snapshot), true);
@@ -309,19 +332,42 @@ moduleFor(
);
}
- ['@test interaction with ember arrays'](assert) {
+ ['@test ember get interaction with ember arrays'](assert) {
+ class EmberObject {
+ emberArray = {
+ [EMBER_ARRAY]: true,
+ };
+ }
+
+ let obj = new EmberObject();
+ let emberArray;
+
+ let tag = track(() => (emberArray = get(obj, 'emberArray')));
+ let snapshot = value(tag);
+
+ assert.equal(validate(tag, snapshot), true);
+
+ notifyPropertyChange(emberArray, '[]');
+ assert.equal(
+ validate(tag, snapshot),
+ false,
+ 'invalid after setting a property on the object'
+ );
+ }
+
+ ['@test native get interaction with ember arrays'](assert) {
class EmberObject {
@tracked emberArray = {
[EMBER_ARRAY]: true,
};
}
let obj = new EmberObject();
+ let emberArray;
- let tag = tagForProperty(obj, 'emberArray');
+ let tag = track(() => (emberArray = obj.emberArray));
let snapshot = value(tag);
- let emberArray = get(obj, 'emberArray');
assert.equal(validate(tag, snapshot), true);
notifyPropertyChange(emberArray, '[]');
| true |
Other
|
emberjs
|
ember.js
|
4a4c12cb36b7c9c8a016e557ae37eefac17417ad.json
|
fix last tests
|
packages/@ember/application/tests/application_instance_test.js
|
@@ -175,7 +175,7 @@ moduleFor(
}
['@test can build and boot a registered engine'](assert) {
- assert.expect(11);
+ assert.expect(10);
let ChatEngine = Engine.extend({
Resolver: ModuleBasedTestResolver,
| true |
Other
|
emberjs
|
ember.js
|
889dfeccabe85d616df66695ffe013e55eb9c298.json
|
fix experimental macros test
|
packages/@ember/-internals/glimmer/tests/integration/syntax/experimental-syntax-test.js
|
@@ -1,6 +1,7 @@
import { moduleFor, RenderingTestCase, strip } from 'internal-test-helpers';
import { _registerMacros, _experimentalMacros } from '@ember/-internals/glimmer';
+import { invokeStaticBlockWithStack } from '@glimmer/opcode-compiler';
moduleFor(
'registerMacros',
@@ -9,9 +10,8 @@ moduleFor(
let originalMacros = _experimentalMacros.slice();
_registerMacros(blocks => {
- blocks.add('-let', (params, hash, _default, inverse, builder) => {
- builder.compileParams(params);
- builder.invokeStaticBlock(_default, params.length);
+ blocks.add('-test-block', (params, _hash, blocks) => {
+ return invokeStaticBlockWithStack(blocks.get('default'));
});
});
@@ -29,11 +29,10 @@ moduleFor(
['@test allows registering custom syntax via private API']() {
this.render(
strip`
- {{#-let obj as |bar|}}
- {{bar}}
- {{/-let}}
- `,
- { obj: 'hello world!' }
+ {{#-test-block}}
+ hello world!
+ {{/-test-block}}
+ `
);
this.assertText('hello world!');
| false |
Other
|
emberjs
|
ember.js
|
4ea959bb7f9f836627598863177d73cad76a0fac.json
|
fix binding tests and deprecation message
|
packages/@ember/-internals/glimmer/lib/utils/bindings.ts
|
@@ -4,7 +4,12 @@ import { EMBER_COMPONENT_IS_VISIBLE } from '@ember/deprecated-features';
import { dasherize } from '@ember/string';
import { DEBUG } from '@glimmer/env';
import { Core, ElementOperations, Option, WireFormat, SexpOpcodes } from '@glimmer/interfaces';
-import { Reference, RootReference, VersionedPathReference, VersionedReference } from '@glimmer/reference';
+import {
+ Reference,
+ RootReference,
+ VersionedPathReference,
+ VersionedReference,
+} from '@glimmer/reference';
import { PrimitiveReference, UNDEFINED_REFERENCE } from '@glimmer/runtime';
import { combine, Tag } from '@glimmer/validator';
import { SimpleElement } from '@simple-dom/interface';
@@ -90,7 +95,12 @@ export const AttributeBinding = {
attribute === 'style' &&
StyleBindingReference !== undefined
) {
- reference = new StyleBindingReference(rootRef, reference, referenceForKey(rootRef, 'isVisible'), env);
+ reference = new StyleBindingReference(
+ rootRef,
+ reference,
+ referenceForKey(rootRef, 'isVisible'),
+ env
+ );
}
operations.setAttribute(attribute, reference, false, null);
@@ -142,9 +152,9 @@ if (EMBER_COMPONENT_IS_VISIBLE) {
if (isVisible !== undefined) {
deprecate(
- `\`isVisible\` is deprecated. Was accessed from:\n\n${this.env.getTemplatePathDebugContext(
- this
- )}`,
+ `The \`isVisible\` property on classic component classes is deprecated. Was accessed ${this.env
+ .getTemplatePathDebugContext(this)
+ .replace(/^W/, 'w')}`,
false,
{
id: 'ember-component.is-visible',
@@ -176,7 +186,12 @@ if (EMBER_COMPONENT_IS_VISIBLE) {
) => {
operations.setAttribute(
'style',
- new StyleBindingReference!(rootRef, UNDEFINED_REFERENCE, rootRef.get('isVisible'), environment),
+ new StyleBindingReference!(
+ rootRef,
+ UNDEFINED_REFERENCE,
+ rootRef.get('isVisible'),
+ environment
+ ),
false,
null
);
| true |
Other
|
emberjs
|
ember.js
|
4ea959bb7f9f836627598863177d73cad76a0fac.json
|
fix binding tests and deprecation message
|
packages/@ember/-internals/glimmer/tests/integration/components/curly-components-test.js
|
@@ -2914,7 +2914,7 @@ moduleFor(
this.render(`{{foo-bar id="foo-bar" isVisible=visible}}`, {
visible: false,
});
- }, '`isVisible` is deprecated (from "component:foo-bar")');
+ }, /The `isVisible` property on classic component classes is deprecated. Was accessed while rendering:\n\nfoo-bar/);
assertStyle('display: none;');
@@ -2924,15 +2924,15 @@ moduleFor(
runTask(() => {
set(this.context, 'visible', true);
});
- }, '`isVisible` is deprecated (from "component:foo-bar")');
+ }, /The `isVisible` property on classic component classes is deprecated. Was accessed while rendering:\n\nfoo-bar/);
assertStyle('');
expectDeprecation(() => {
runTask(() => {
set(this.context, 'visible', false);
});
- }, '`isVisible` is deprecated (from "component:foo-bar")');
+ }, /The `isVisible` property on classic component classes is deprecated. Was accessed while rendering:\n\nfoo-bar/);
assertStyle('display: none;');
}
@@ -2951,7 +2951,7 @@ moduleFor(
this.render(`{{foo-bar id="foo-bar" isVisible=visible}}`, {
visible: false,
});
- }, '`isVisible` is deprecated (from "component:foo-bar")');
+ }, /The `isVisible` property on classic component classes is deprecated. Was accessed while rendering:\n\nfoo-bar/);
this.assertComponentElement(this.firstChild, {
tagName: 'div',
@@ -2964,7 +2964,7 @@ moduleFor(
runTask(() => {
set(this.context, 'visible', true);
});
- }, '`isVisible` is deprecated (from "component:foo-bar")');
+ }, /The `isVisible` property on classic component classes is deprecated. Was accessed while rendering:\n\nfoo-bar/);
this.assertComponentElement(this.firstChild, {
tagName: 'div',
@@ -2975,7 +2975,7 @@ moduleFor(
runTask(() => {
set(this.context, 'visible', false);
});
- }, '`isVisible` is deprecated (from "component:foo-bar")');
+ }, /The `isVisible` property on classic component classes is deprecated. Was accessed while rendering:\n\nfoo-bar/);
this.assertComponentElement(this.firstChild, {
tagName: 'div',
@@ -3011,7 +3011,7 @@ moduleFor(
visible: false,
foo: 'baz',
});
- }, '`isVisible` is deprecated (from "component:foo-bar")');
+ }, /The `isVisible` property on classic component classes is deprecated. Was accessed while rendering:\n\nfoo-bar/);
assertStyle('display: none;');
@@ -3021,7 +3021,7 @@ moduleFor(
runTask(() => {
set(this.context, 'visible', true);
});
- }, '`isVisible` is deprecated (from "component:foo-bar")');
+ }, /The `isVisible` property on classic component classes is deprecated. Was accessed while rendering:\n\nfoo-bar/);
assertStyle('');
@@ -3030,7 +3030,7 @@ moduleFor(
set(this.context, 'visible', false);
set(this.context, 'foo', 'woo');
});
- }, '`isVisible` is deprecated (from "component:foo-bar")');
+ }, /The `isVisible` property on classic component classes is deprecated. Was accessed while rendering:\n\nfoo-bar/);
assertStyle('display: none;');
assert.equal(this.firstChild.getAttribute('foo'), 'woo');
| true |
Other
|
emberjs
|
ember.js
|
d8e6fd92fdb0e4f1bb1ae3115185374dc25e1b6e.json
|
fix debug tree and UPDATE
|
packages/@ember/-internals/glimmer/lib/component.ts
|
@@ -17,8 +17,6 @@ import { normalizeProperty } from '@glimmer/runtime';
import { createTag, dirty } from '@glimmer/validator';
import { Namespace } from '@simple-dom/interface';
-import { UPDATE } from './utils/references';
-
export const DIRTY_TAG = symbol('DIRTY_TAG');
export const ARGS = symbol('ARGS');
export const IS_DISPATCHING_ATTRS = symbol('IS_DISPATCHING_ATTRS');
@@ -787,8 +785,8 @@ const Component = CoreView.extend(
let args = this[ARGS];
let reference = args !== undefined ? args[key] : undefined;
- if (reference !== undefined && reference[UPDATE] !== undefined) {
- reference[UPDATE](get(this, key));
+ if (reference !== undefined && reference['updateReferencedValue'] !== undefined) {
+ reference['updateReferencedValue'](get(this, key));
}
},
| true |
Other
|
emberjs
|
ember.js
|
d8e6fd92fdb0e4f1bb1ae3115185374dc25e1b6e.json
|
fix debug tree and UPDATE
|
packages/@ember/-internals/glimmer/lib/environment.ts
|
@@ -105,7 +105,9 @@ export class EmberEnvironmentDelegate implements RuntimeEnvironmentDelegate<Embe
}
getTemplatePathDebugContext(pathRef: VersionedPathReference) {
- return this.extra.debugRenderTree.logRenderStackForPath(pathRef);
+ let stack = this.extra.debugRenderTree.logRenderStackForPath(pathRef);
+
+ return `While rendering:\n\n${stack}`;
}
setTemplatePathDebugContext(pathRef: VersionedPathReference, desc: string, parentRef: Option<VersionedPathReference>) {
| true |
Other
|
emberjs
|
ember.js
|
d8e6fd92fdb0e4f1bb1ae3115185374dc25e1b6e.json
|
fix debug tree and UPDATE
|
packages/@ember/-internals/glimmer/lib/helpers/mut.ts
|
@@ -4,7 +4,7 @@
import { symbol } from '@ember/-internals/utils';
import { assert } from '@ember/debug';
import { VMArguments } from '@glimmer/interfaces';
-import { INVOKE, UPDATE } from '../utils/references';
+import { INVOKE } from '../utils/references';
/**
The `mut` helper lets you __clearly specify__ that a child `Component` can update the
@@ -115,12 +115,12 @@ export default function(args: VMArguments) {
//
// This message is alright for the first case, but could be quite
// confusing for the second case.
- assert('You can only pass a path to mut', rawRef[UPDATE]);
+ assert('You can only pass a path to mut', 'updateReferencedValue' in rawRef);
let wrappedRef = Object.create(rawRef);
wrappedRef[SOURCE] = rawRef;
- wrappedRef[INVOKE] = rawRef[UPDATE];
+ wrappedRef[INVOKE] = rawRef['updateReferencedValue'];
wrappedRef[MUT_REFERENCE] = true;
return wrappedRef;
| true |
Other
|
emberjs
|
ember.js
|
d8e6fd92fdb0e4f1bb1ae3115185374dc25e1b6e.json
|
fix debug tree and UPDATE
|
packages/@ember/-internals/glimmer/lib/syntax/outlet.ts
|
@@ -8,7 +8,7 @@ import {
VM,
VMArguments,
} from '@glimmer/interfaces';
-import { ConstReference, PropertyReference, Reference, VersionedPathReference } from '@glimmer/reference';
+import { ConstReference, Reference, RootReference, VersionedPathReference } from '@glimmer/reference';
import {
CurriedComponentDefinition,
curry,
@@ -22,7 +22,6 @@ import { EmberVMEnvironment } from '../environment';
import { DynamicScope } from '../renderer';
import { isTemplateFactory } from '../template';
import { OutletReference, OutletState } from '../utils/outlet';
-// import { NestedPropertyReference, PropertyReference } from '../utils/references';
/**
The `{{outlet}}` helper lets you specify where a child route will render in
@@ -87,14 +86,14 @@ export function outletHelper(args: VMArguments, vm: VM) {
);
}
-class OutletModelReference implements VersionedPathReference {
+class OutletModelReference extends RootReference {
public tag: Tag;
- private didSetupDebugContext?: boolean;
constructor(
private parent: VersionedPathReference<OutletState | undefined>,
- private env: EmberVMEnvironment
+ env: EmberVMEnvironment
) {
+ super(env);
this.tag = parent.tag;
}
@@ -113,30 +112,11 @@ class OutletModelReference implements VersionedPathReference {
return render.model as unknown;
}
-
- get(property: string): VersionedPathReference {
- // We register the template debug context now since the reference is created
- // before the component itself. It shouldn't be possible to cause errors when
- // accessing {{@model}}, only subproperties of the model, so this should be
- // fine for the time being.
- //
- // TODO: This points to a need for more first class support for arguments in
- // the debugRenderTree. The fact that we can't accurately relate an argument
- // reference to its component is problematic for debug tooling.
- if (DEBUG && !this.didSetupDebugContext) {
- this.didSetupDebugContext = true;
- this.env.setTemplatePathDebugContext(this, '@model', null);
- }
-
- return new PropertyReference(this, property, this.env);
- }
}
-// if (DEBUG) {
-// OutletModelReference.prototype['debug'] = function debug(subPath: string): string {
-// return `${this['debugStackLog']}@model.${subPath}`;
-// };
-// }
+if (DEBUG) {
+ OutletModelReference.prototype['debugLogName'] = '@model';
+}
class OutletComponentReference
implements VersionedPathReference<CurriedComponentDefinition | null> {
@@ -150,44 +130,6 @@ class OutletComponentReference
) {
// The router always dirties the root state.
this.tag = outletRef.tag;
-
- // if (EMBER_ROUTING_MODEL_ARG) {
- // let modelRef = new OutletModelReference(outletRef, env);
- // let map = dict<VersionedPathReference>();
- // map.model = modelRef;
-
- // // TODO: the functionailty to create a proper CapturedArgument should be
- // // exported by glimmer, or that it should provide an overload for `curry`
- // // that takes `PreparedArguments`
- // this.args = {
- // tag,
- // positional: EMPTY_ARGS.positional,
- // named: {
- // tag,
- // map,
- // names: ['model'],
- // references: [modelRef],
- // length: 1,
- // has(key: string): boolean {
- // return key === 'model';
- // },
- // get<T extends VersionedPathReference>(key: string): T {
- // return (key === 'model' ? modelRef : UNDEFINED_REFERENCE) as unsafe;
- // },
- // value(): Dict<unknown> {
- // let model = modelRef.value();
- // return { model };
- // },
- // },
- // length: 1,
- // value() {
- // return {
- // named: this.named.value(),
- // positional: this.positional.value(),
- // };
- // },
- // };
- // }
}
value(): CurriedComponentDefinition | null {
| true |
Other
|
emberjs
|
ember.js
|
d8e6fd92fdb0e4f1bb1ae3115185374dc25e1b6e.json
|
fix debug tree and UPDATE
|
packages/@ember/-internals/glimmer/lib/utils/debug-render-tree.ts
|
@@ -1,10 +1,10 @@
import { assert } from '@ember/debug';
import { Bounds, CapturedArguments, Option } from '@glimmer/interfaces';
import { unwrapTemplate } from '@glimmer/opcode-compiler';
+import { VersionedPathReference } from '@glimmer/reference';
import { expect, Stack } from '@glimmer/util';
import { SimpleElement, SimpleNode } from '@simple-dom/interface';
import { OwnedTemplate } from '../template';
-import { VersionedPathReference } from '@glimmer/reference';
export type RenderNodeType = 'outlet' | 'engine' | 'route-template' | 'component';
@@ -234,7 +234,7 @@ export default class DebugRenderTree<Bucket extends object = object> {
node = node.parent;
} else {
- pathParts.push(node.name);
+ pathParts.unshift(node.name);
}
node = node.parent;
@@ -252,9 +252,7 @@ export default class DebugRenderTree<Bucket extends object = object> {
node = node.parent;
}
- messageParts.map((part, index) => `${repeatString(' ', index * 2)}${part}`);
-
- return messageParts.join('\n');
+ return messageParts.map((part, index) => `${repeatString(' ', index * 2)}${part}`).join('\n');
}
private reset(): void {
| true |
Other
|
emberjs
|
ember.js
|
d8e6fd92fdb0e4f1bb1ae3115185374dc25e1b6e.json
|
fix debug tree and UPDATE
|
packages/@ember/-internals/glimmer/lib/utils/process-args.ts
|
@@ -2,7 +2,7 @@ import { symbol } from '@ember/-internals/utils';
import { MUTABLE_CELL } from '@ember/-internals/views';
import { CapturedNamedArguments } from '@glimmer/interfaces';
import { ARGS } from '../component';
-import { ACTION, UPDATE } from './references';
+import { ACTION } from './references';
// ComponentArgs takes EvaluatedNamedArgs and converts them into the
// inputs needed by CurlyComponents (attrs and props, with mutable
@@ -22,7 +22,7 @@ export function processComponentArgs(namedArgs: CapturedNamedArguments) {
if (typeof value === 'function' && value[ACTION]) {
attrs[name] = value;
- } else if (ref[UPDATE]) {
+ } else if (ref['updateReferencedValue']) {
attrs[name] = new MutableCell(ref, value);
}
@@ -46,6 +46,6 @@ class MutableCell {
}
update(val: any) {
- this[REF][UPDATE](val);
+ this[REF]['updateReferencedValue'](val);
}
}
| true |
Other
|
emberjs
|
ember.js
|
d8e6fd92fdb0e4f1bb1ae3115185374dc25e1b6e.json
|
fix debug tree and UPDATE
|
packages/@ember/-internals/glimmer/lib/utils/references.ts
|
@@ -4,10 +4,9 @@ import { DEBUG } from '@glimmer/env';
import { CapturedArguments, Environment } from '@glimmer/interfaces';
import { HelperRootReference, RootReference, VersionedPathReference } from '@glimmer/reference';
import { PrimitiveReference } from '@glimmer/runtime';
-import { deprecateMutationsInAutotrackingTransaction, Tag } from '@glimmer/validator';
-import { HelperInstance, isSimpleHelper, SimpleHelper } from '../helper';
+import { consume, deprecateMutationsInAutotrackingTransaction, Tag } from '@glimmer/validator';
+import { HelperInstance, isSimpleHelper, RECOMPUTE_TAG, SimpleHelper } from '../helper';
-export const UPDATE = symbol('UPDATE');
export const INVOKE = symbol('INVOKE');
export const ACTION = symbol('ACTION');
@@ -36,6 +35,10 @@ export class EmberHelperRootReference<T = unknown> extends HelperRootReference<T
ret = helper.compute(positionalValue, namedValue);
}
+ if (helper[RECOMPUTE_TAG]) {
+ consume(helper[RECOMPUTE_TAG]);
+ }
+
return ret!;
};
| true |
Other
|
emberjs
|
ember.js
|
4e254b3937abf7b6221eee11ae77f3b8a9878777.json
|
use upstream tracking
|
packages/@ember/-internals/glimmer/lib/component-managers/custom.ts
|
@@ -1,4 +1,4 @@
-import { ARGS_PROXY_TAGS, consume } from '@ember/-internals/metal';
+import { ARGS_PROXY_TAGS } from '@ember/-internals/metal';
import { Factory } from '@ember/-internals/owner';
import { HAS_NATIVE_PROXY } from '@ember/-internals/utils';
import { EMBER_CUSTOM_COMPONENT_ARG_PROXY } from '@ember/canary-features';
@@ -17,7 +17,7 @@ import {
} from '@glimmer/interfaces';
import { unwrapTemplate } from '@glimmer/opcode-compiler';
import { PathReference, } from '@glimmer/reference';
-import { createTag, isConst, Tag } from '@glimmer/validator';
+import { consume, createTag, isConst, Tag } from '@glimmer/validator';
import { ENV } from '@ember/-internals/environment';
import { EmberVMEnvironment } from '../environment';
| true |
Other
|
emberjs
|
ember.js
|
4e254b3937abf7b6221eee11ae77f3b8a9878777.json
|
use upstream tracking
|
packages/@ember/-internals/glimmer/lib/environment.ts
|
@@ -78,6 +78,9 @@ export class EmberEnvironmentExtra {
export class EmberEnvironmentDelegate implements RuntimeEnvironmentDelegate<EmberEnvironmentExtra> {
public isInteractive: boolean;
+
+ public getPath = get;
+
public attributeFor?: (
element: SimpleElement,
attr: string,
@@ -108,24 +111,8 @@ export class EmberEnvironmentDelegate implements RuntimeEnvironmentDelegate<Embe
}
}
- // iterableFor(ref: VersionedReference, key: string): OpaqueIterable {
- // return createIterable(ref, key);
- // }
-
- // scheduleInstallModifier(modifier: any, manager: any): void {
- // if (this.isInteractive) {
- // super.scheduleInstallModifier(modifier, manager);
- // }
- // }
-
- // scheduleUpdateModifier(modifier: any, manager: any): void {
- // if (this.isInteractive) {
- // super.scheduleUpdateModifier(modifier, manager);
- // }
- // }
+ // toIterator(value: unknown) {
- // didDestroy(destroyable: Destroyable): void {
- // destroyable.destroy();
// }
}
| true |
Other
|
emberjs
|
ember.js
|
4e254b3937abf7b6221eee11ae77f3b8a9878777.json
|
use upstream tracking
|
packages/@ember/-internals/glimmer/lib/modifiers/custom.ts
|
@@ -1,10 +1,17 @@
-import { track, untrack } from '@ember/-internals/metal';
import { Factory } from '@ember/-internals/owner';
import { getDebugName } from '@ember/-internals/utils';
import { assert, deprecate } from '@ember/debug';
import { DEBUG } from '@glimmer/env';
import { CapturedArguments, Dict, ModifierManager, VMArguments } from '@glimmer/interfaces';
-import { combine, CONSTANT_TAG, createUpdatableTag, Tag, update } from '@glimmer/validator';
+import {
+ combine,
+ CONSTANT_TAG,
+ createUpdatableTag,
+ Tag,
+ track,
+ untrack,
+ update,
+} from '@glimmer/validator';
import { SimpleElement } from '@simple-dom/interface';
import debugRenderMessage from '../utils/debug-render-message';
| true |
Other
|
emberjs
|
ember.js
|
4e254b3937abf7b6221eee11ae77f3b8a9878777.json
|
use upstream tracking
|
packages/@ember/-internals/glimmer/lib/utils/iterable.ts
|
@@ -1,9 +1,7 @@
import {
- consume,
get,
- isTracking,
objectAt,
- tagFor,
+ tagForObject,
tagForProperty,
} from '@ember/-internals/metal';
import { _contentFor } from '@ember/-internals/runtime';
@@ -16,7 +14,7 @@ import {
OpaqueIterator,
VersionedReference,
} from '@glimmer/reference';
-import { combine, createUpdatableTag, Tag, update } from '@glimmer/validator';
+import { combine, consume, createUpdatableTag, isTracking, Tag, update } from '@glimmer/validator';
import { isEachIn } from '../helpers/each-in';
import { UpdatableReference } from './references';
@@ -290,7 +288,7 @@ class EachInIterable implements EmberIterable {
let { ref, valueTag } = this;
let iterable = ref.value();
- let tag = tagFor(iterable);
+ let tag = tagForObject(iterable);
if (isProxy(iterable)) {
// this is because the each-in doesn't actually get(proxy, 'key') but bypasses it
| true |
Other
|
emberjs
|
ember.js
|
4e254b3937abf7b6221eee11ae77f3b8a9878777.json
|
use upstream tracking
|
packages/@ember/-internals/glimmer/lib/utils/references.ts
|
@@ -1,11 +1,8 @@
import {
- consume,
- deprecateMutationsInAutotrackingTransaction,
get,
set,
- tagFor,
+ tagForObject,
tagForProperty,
- track,
} from '@ember/-internals/metal';
import { getDebugName, isProxy, symbol } from '@ember/-internals/utils';
import { assert, debugFreeze } from '@ember/debug';
@@ -23,13 +20,16 @@ import {
} from '@glimmer/runtime';
import {
combine,
+ consume,
createTag,
createUpdatableTag,
+ deprecateMutationsInAutotrackingTransaction,
dirty,
DirtyableTag,
isConst,
Revision,
Tag,
+ track,
UpdatableTag,
update,
validate,
@@ -186,6 +186,7 @@ export class NestedPropertyReference extends PropertyReference {
private propertyKey: string
) {
super();
+ debugger
let parentReferenceTag = parentReference.tag;
let propertyTag = (this.propertyTag = createUpdatableTag());
| true |
Other
|
emberjs
|
ember.js
|
4e254b3937abf7b6221eee11ae77f3b8a9878777.json
|
use upstream tracking
|
packages/@ember/-internals/meta/lib/meta.ts
|
@@ -1,7 +1,7 @@
import { symbol, toString } from '@ember/-internals/utils';
import { assert } from '@ember/debug';
import { DEBUG } from '@glimmer/env';
-import { createUpdatableTag, UpdatableTag } from '@glimmer/validator';
+import { UpdatableTag } from '@glimmer/validator';
type ObjMap<T> = { [key: string]: T };
@@ -96,8 +96,6 @@ let currentListenerVersion = 1;
export class Meta {
_descriptors: Map<string, any> | undefined;
_mixins: any | undefined;
- _tag: UpdatableTag | undefined;
- _tags: ObjMap<UpdatableTag> | undefined;
_flags: MetaFlags;
_lazyChains: ObjMap<ObjMap<UpdatableTag>> | undefined;
source: object;
@@ -120,8 +118,6 @@ export class Meta {
this._parent = undefined;
this._descriptors = undefined;
this._mixins = undefined;
- this._tag = undefined;
- this._tags = undefined;
// initial value for all flags right now is false
// see FLAGS const for detailed list of flags used
@@ -228,31 +224,6 @@ export class Meta {
return false;
}
- writableTags() {
- return this._getOrCreateOwnMap('_tags');
- }
- readableTags() {
- return this._tags;
- }
-
- writableTag() {
- assert(
- this.isMetaDestroyed()
- ? `Cannot create a new tag for \`${toString(this.source)}\` after it has been destroyed.`
- : '',
- !this.isMetaDestroyed()
- );
- let ret = this._tag;
- if (ret === undefined) {
- ret = this._tag = createUpdatableTag();
- }
- return ret;
- }
-
- readableTag() {
- return this._tag;
- }
-
writableLazyChainsFor(key: string) {
if (DEBUG) {
counters!.writableLazyChainsCalls++;
| true |
Other
|
emberjs
|
ember.js
|
4e254b3937abf7b6221eee11ae77f3b8a9878777.json
|
use upstream tracking
|
packages/@ember/-internals/metal/index.ts
|
@@ -53,17 +53,8 @@ export { default as expandProperties } from './lib/expand_properties';
export { addObserver, activateObserver, removeObserver, flushAsyncObservers } from './lib/observer';
export { Mixin, aliasMethod, mixin, observer, applyMixin } from './lib/mixin';
export { default as inject, DEBUG_INJECTION_FUNCTIONS } from './lib/injected_property';
-export { tagForProperty, tagFor, markObjectAsDirty, UNKNOWN_PROPERTY_TAG } from './lib/tags';
-export {
- consume,
- Tracker,
- tracked,
- track,
- untrack,
- isTracking,
- runInAutotrackingTransaction,
- deprecateMutationsInAutotrackingTransaction,
-} from './lib/tracked';
+export { tagForProperty, tagForObject, markObjectAsDirty, UNKNOWN_PROPERTY_TAG } from './lib/tags';
+export { tracked } from './lib/tracked';
export {
NAMESPACES,
| true |
Other
|
emberjs
|
ember.js
|
4e254b3937abf7b6221eee11ae77f3b8a9878777.json
|
use upstream tracking
|
packages/@ember/-internals/metal/lib/alias.ts
|
@@ -2,7 +2,7 @@ import { Meta } from '@ember/-internals/meta';
import { inspect } from '@ember/-internals/utils';
import { assert } from '@ember/debug';
import EmberError from '@ember/error';
-import { combine, UpdatableTag, update, validate, value } from '@glimmer/validator';
+import { combine, consume, untrack, UpdatableTag, update, validate, value } from '@glimmer/validator';
import { finishLazyChains, getChainTagsForKey } from './chain-tags';
import { getLastRevisionFor, setLastRevisionFor } from './computed_cache';
import {
@@ -16,7 +16,6 @@ import { defineProperty } from './properties';
import { get } from './property_get';
import { set } from './property_set';
import { tagForProperty } from './tags';
-import { consume, untrack } from './tracked';
export type AliasDecorator = Decorator & PropertyDecorator & AliasDecoratorImpl;
| true |
Other
|
emberjs
|
ember.js
|
4e254b3937abf7b6221eee11ae77f3b8a9878777.json
|
use upstream tracking
|
packages/@ember/-internals/metal/lib/computed.ts
|
@@ -4,7 +4,10 @@ import { assert, deprecate, warn } from '@ember/debug';
import EmberError from '@ember/error';
import {
combine,
+ consume,
Tag,
+ track,
+ untrack,
UpdatableTag,
update,
validate,
@@ -36,7 +39,6 @@ import { defineProperty } from './properties';
import { beginPropertyChanges, endPropertyChanges, notifyPropertyChange } from './property_events';
import { set } from './property_set';
import { tagForProperty } from './tags';
-import { consume, track, untrack } from './tracked';
export type ComputedPropertyGetter = (keyName: string) => any;
export type ComputedPropertySetter = (keyName: string, value: any, cachedValue?: any) => any;
| true |
Other
|
emberjs
|
ember.js
|
4e254b3937abf7b6221eee11ae77f3b8a9878777.json
|
use upstream tracking
|
packages/@ember/-internals/metal/lib/property_events.ts
|
@@ -36,9 +36,7 @@ function notifyPropertyChange(obj: object, keyName: string, _meta?: Meta | null)
return;
}
- if (meta !== null) {
- markObjectAsDirty(obj, keyName, meta);
- }
+ markObjectAsDirty(obj, keyName);
if (deferred <= 0) {
flushSyncObservers();
| true |
Other
|
emberjs
|
ember.js
|
4e254b3937abf7b6221eee11ae77f3b8a9878777.json
|
use upstream tracking
|
packages/@ember/-internals/metal/lib/property_get.ts
|
@@ -4,9 +4,9 @@
import { HAS_NATIVE_PROXY, isEmberArray, isProxy, symbol } from '@ember/-internals/utils';
import { assert } from '@ember/debug';
import { DEBUG } from '@glimmer/env';
+import { consume, deprecateMutationsInAutotrackingTransaction, isTracking } from '@glimmer/validator';
import { isPath } from './path_cache';
-import { tagFor, tagForProperty } from './tags';
-import { consume, deprecateMutationsInAutotrackingTransaction, isTracking } from './tracked';
+import { tagForProperty } from './tags';
export const PROXY_CONTENT = symbol('PROXY_CONTENT');
| true |
Other
|
emberjs
|
ember.js
|
4e254b3937abf7b6221eee11ae77f3b8a9878777.json
|
use upstream tracking
|
packages/@ember/-internals/metal/lib/tags.ts
|
@@ -1,80 +1,123 @@
-import { Meta, meta as metaFor } from '@ember/-internals/meta';
-import { setupMandatorySetter, symbol } from '@ember/-internals/utils';
+import { meta as metaFor } from '@ember/-internals/meta';
+import { getDebugName, isObject, setupMandatorySetter, symbol, toString } from '@ember/-internals/utils';
+import { assert, deprecate } from '@ember/debug';
import { backburner } from '@ember/runloop';
import { DEBUG } from '@glimmer/env';
-import { CONSTANT_TAG, createUpdatableTag, dirty, Tag } from '@glimmer/validator';
-import { assertTagNotConsumed } from './tracked';
+import {
+ CONSTANT_TAG,
+ dirtyTagFor,
+ setAutotrackingTransactionEnv,
+ setPropertyDidChange,
+ Tag,
+ tagFor,
+} from '@glimmer/validator';
+
+/////////
+
+// Setup tracking environment
+
+setPropertyDidChange(() => backburner.ensureInstance());
+
+if (DEBUG) {
+ setAutotrackingTransactionEnv!({
+ assert(message) {
+ assert(message, false);
+ },
+
+ deprecate(message) {
+ deprecate(message, false, {
+ id: 'autotracking.mutation-after-consumption',
+ until: '4.0.0'
+ });
+ },
+
+ debugMessage(obj, keyName) {
+ let dirtyString = keyName
+ ? `\`${keyName}\` on \`${getDebugName!(obj)}\``
+ : `\`${getDebugName!(obj)}\``;
+
+ return `You attempted to update ${dirtyString}, but it had already been used previously in the same computation. Attempting to update a value after using it in a computation can cause logical errors, infinite revalidation bugs, and performance issues, and is not supported.`;
+ },
+ });
+}
+
+/////////
export const UNKNOWN_PROPERTY_TAG = symbol('UNKNOWN_PROPERTY_TAG');
-export function tagForProperty(object: any, propertyKey: string | symbol, _meta?: Meta): Tag {
- let objectType = typeof object;
- if (objectType !== 'function' && (objectType !== 'object' || object === null)) {
+// This is exported for `@tracked`, but should otherwise be avoided. Use `tagForObject`.
+export const SELF_TAG: string = symbol('SELF_TAG');
+
+let SEEN_TAGS: WeakSet<Tag> | undefined;
+
+if (DEBUG) {
+ SEEN_TAGS = new WeakSet();
+}
+
+export function tagForProperty(obj: unknown, propertyKey: string | symbol): Tag {
+ if (!isObject(obj)) {
return CONSTANT_TAG;
}
- let meta = _meta === undefined ? metaFor(object) : _meta;
- if (!(propertyKey in object) && typeof object[UNKNOWN_PROPERTY_TAG] === 'function') {
- return object[UNKNOWN_PROPERTY_TAG](propertyKey);
+ if (!(propertyKey in obj) && typeof obj[UNKNOWN_PROPERTY_TAG] === 'function') {
+ return obj[UNKNOWN_PROPERTY_TAG](propertyKey);
}
- let tags = meta.writableTags();
- let tag = tags[propertyKey];
- if (tag) {
- return tag;
- }
+ let tag = tagFor(obj, propertyKey);
- let newTag = createUpdatableTag();
+ if (DEBUG && !SEEN_TAGS!.has(tag)) {
+ SEEN_TAGS!.add(tag);
- if (DEBUG) {
- setupMandatorySetter!(object, propertyKey);
+ setupMandatorySetter!(obj, propertyKey);
- (newTag as any)._propertyKey = propertyKey;
+ (tag as any)._propertyKey = propertyKey;
}
- return (tags[propertyKey] = newTag);
+ return tag;
}
-export function tagFor(object: any | null, _meta?: Meta): Tag {
- if (typeof object === 'object' && object !== null) {
- let meta = _meta === undefined ? metaFor(object) : _meta;
-
- if (!meta.isMetaDestroyed()) {
- return meta.writableTag();
+export function tagForObject(obj: unknown | null): Tag {
+ if (isObject(obj)) {
+ if (DEBUG) {
+ let meta = metaFor(obj);
+
+ assert(
+ meta.isMetaDestroyed()
+ ? `Cannot create a new tag for \`${toString(meta.source)}\` after it has been destroyed.`
+ : '',
+ !meta.isMetaDestroyed()
+ );
}
+
+ return tagFor(obj, SELF_TAG);
}
return CONSTANT_TAG;
}
-export function markObjectAsDirty(obj: object, propertyKey: string, _meta?: Meta): void {
- let meta = _meta === undefined ? metaFor(obj) : _meta;
- let objectTag = meta.readableTag();
+export function markObjectAsDirty(obj: object, propertyKey: string): void {
+ // let meta = _meta === undefined ? metaFor(obj) : _meta;
+ // let objectTag = meta.readableTag();
- if (objectTag !== undefined) {
- if (DEBUG) {
- assertTagNotConsumed!(objectTag, obj);
- }
+ // if (objectTag !== undefined) {
+ // if (DEBUG) {
+ // assertTagNotConsumed!(objectTag, obj);
+ // }
- dirty(objectTag);
- }
+ // dirty(objectTag);
+ // }
- let tags = meta.readableTags();
- let propertyTag = tags !== undefined ? tags[propertyKey] : undefined;
+ // let tags = meta.readableTags();
+ // let propertyTag = tags !== undefined ? tags[propertyKey] : undefined;
- if (propertyTag !== undefined) {
- if (DEBUG) {
- assertTagNotConsumed!(propertyTag, obj, propertyKey);
- }
+ // if (propertyTag !== undefined) {
+ // if (DEBUG) {
+ // assertTagNotConsumed!(propertyTag, obj, propertyKey);
+ // }
- dirty(propertyTag);
- }
-
- if (objectTag !== undefined || propertyTag !== undefined) {
- ensureRunloop();
- }
-}
+ // dirty(propertyTag);
+ // }
-export function ensureRunloop(): void {
- backburner.ensureInstance();
+ dirtyTagFor(obj, propertyKey);
+ dirtyTagFor(obj, SELF_TAG);
}
| true |
Other
|
emberjs
|
ember.js
|
4e254b3937abf7b6221eee11ae77f3b8a9878777.json
|
use upstream tracking
|
packages/@ember/-internals/metal/lib/tracked.ts
|
@@ -1,216 +1,10 @@
-import { getDebugName, isEmberArray } from '@ember/-internals/utils';
-import { assert, deprecate } from '@ember/debug';
+import { isEmberArray } from '@ember/-internals/utils';
+import { assert } from '@ember/debug';
import { DEBUG } from '@glimmer/env';
-import { combine, CONSTANT_TAG, Tag, UpdatableTag, update } from '@glimmer/validator';
+import { consume, dirtyTagFor, trackedData } from '@glimmer/validator';
import { Decorator, DecoratorPropertyDescriptor, isElementDescriptor } from './decorator';
import { setClassicDecorator } from './descriptor_map';
-import { markObjectAsDirty, tagForProperty } from './tags';
-
-type Option<T> = T | null;
-
-interface AutotrackingTransactionSourceData {
- context?: string;
- error: Error;
-}
-
-let DEPRECATE_IN_AUTOTRACKING_TRANSACTION = false;
-let AUTOTRACKING_TRANSACTION: WeakMap<Tag, AutotrackingTransactionSourceData> | null = null;
-
-export let runInAutotrackingTransaction: undefined | ((fn: () => void) => void);
-export let deprecateMutationsInAutotrackingTransaction: undefined | ((fn: () => void) => void);
-
-let debuggingContexts: string[] | undefined;
-
-export let assertTagNotConsumed:
- | undefined
- | ((tag: Tag, obj: object, keyName?: string, forHardError?: boolean) => void);
-
-let markTagAsConsumed: undefined | ((_tag: Tag, sourceError: Error) => void);
-
-if (DEBUG) {
- /**
- * Creates a global autotracking transaction. This will prevent any backflow
- * in any `track` calls within the transaction, even if they are not
- * externally consumed.
- *
- * `runInAutotrackingTransaction` can be called within itself, and it will add
- * onto the existing transaction if one exists.
- *
- * TODO: Only throw an error if the `track` is consumed.
- */
- runInAutotrackingTransaction = (fn: () => void) => {
- let previousDeprecateState = DEPRECATE_IN_AUTOTRACKING_TRANSACTION;
- let previousTransactionState = AUTOTRACKING_TRANSACTION;
-
- DEPRECATE_IN_AUTOTRACKING_TRANSACTION = false;
-
- if (previousTransactionState === null) {
- // if there was no transaction start it. Otherwise, the transaction already exists.
- AUTOTRACKING_TRANSACTION = new WeakMap();
- }
-
- try {
- fn();
- } finally {
- DEPRECATE_IN_AUTOTRACKING_TRANSACTION = previousDeprecateState;
- AUTOTRACKING_TRANSACTION = previousTransactionState;
- }
- };
-
- /**
- * Switches to deprecating within an autotracking transaction, if one exists.
- * If `runInAutotrackingTransaction` is called within the callback of this
- * method, it switches back to throwing an error, allowing zebra-striping of
- * the types of errors that are thrown.
- *
- * Does not start an autotracking transaction.
- */
- deprecateMutationsInAutotrackingTransaction = (fn: () => void) => {
- let previousDeprecateState = DEPRECATE_IN_AUTOTRACKING_TRANSACTION;
- DEPRECATE_IN_AUTOTRACKING_TRANSACTION = true;
-
- try {
- fn();
- } finally {
- DEPRECATE_IN_AUTOTRACKING_TRANSACTION = previousDeprecateState;
- }
- };
-
- let nthIndex = (str: string, pattern: string, n: number, startingPos = -1) => {
- let i = startingPos;
-
- while (n-- > 0 && i++ < str.length) {
- i = str.indexOf(pattern, i);
- if (i < 0) break;
- }
-
- return i;
- };
-
- let makeAutotrackingErrorMessage = (
- sourceData: AutotrackingTransactionSourceData,
- obj: object,
- keyName?: string
- ) => {
- let dirtyString = keyName
- ? `\`${keyName}\` on \`${getDebugName!(obj)}\``
- : `\`${getDebugName!(obj)}\``;
-
- let message = [
- `You attempted to update ${dirtyString}, but it had already been used previously in the same computation. Attempting to update a value after using it in a computation can cause logical errors, infinite revalidation bugs, and performance issues, and is not supported.`,
- ];
-
- if (sourceData.context) {
- message.push(`\`${keyName}\` was first used:\n\n${sourceData.context}`);
- }
-
- if (sourceData.error.stack) {
- let sourceStack = sourceData.error.stack;
- let thirdIndex = nthIndex(sourceStack, '\n', 3);
- sourceStack = sourceStack.substr(thirdIndex);
-
- message.push(`Stack trace for the first usage: ${sourceStack}`);
- }
-
- message.push(`Stack trace for the update:`);
-
- return message.join('\n\n');
- };
-
- debuggingContexts = [];
-
- markTagAsConsumed = (_tag: Tag, sourceError: Error) => {
- if (!AUTOTRACKING_TRANSACTION || AUTOTRACKING_TRANSACTION.has(_tag)) return;
-
- AUTOTRACKING_TRANSACTION.set(_tag, {
- context: debuggingContexts!.map(c => c.replace(/^/gm, ' ').replace(/^ /, '-')).join('\n\n'),
- error: sourceError,
- });
-
- // We need to mark the tag and all of its subtags as consumed, so we need to
- // cast in and access its internals. In the future this shouldn't be necessary,
- // this is only for computed properties.e
- let tag = _tag as any;
-
- if (tag.subtag) {
- markTagAsConsumed!(tag.subtag, sourceError);
- }
-
- if (tag.subtags) {
- tag.subtags.forEach((tag: Tag) => markTagAsConsumed!(tag, sourceError));
- }
- };
-
- assertTagNotConsumed = (tag: Tag, obj: object, keyName?: string, forceHardError = false) => {
- if (AUTOTRACKING_TRANSACTION === null) return;
-
- let sourceData = AUTOTRACKING_TRANSACTION.get(tag);
-
- if (!sourceData) return;
-
- if (DEPRECATE_IN_AUTOTRACKING_TRANSACTION && !forceHardError) {
- deprecate(makeAutotrackingErrorMessage(sourceData, obj, keyName), false, {
- id: 'autotracking.mutation-after-consumption',
- until: '4.0.0',
- });
- } else {
- // This hack makes the assertion message nicer, we can cut off the first
- // few lines of the stack trace and let users know where the actual error
- // occurred.
- try {
- assert(makeAutotrackingErrorMessage(sourceData, obj, keyName), false);
- } catch (e) {
- if (e.stack) {
- let updateStackBegin = e.stack.indexOf('Stack trace for the update:');
-
- if (updateStackBegin !== -1) {
- let start = nthIndex(e.stack, '\n', 1, updateStackBegin);
- let end = nthIndex(e.stack, '\n', 4, updateStackBegin);
- e.stack = e.stack.substr(0, start) + e.stack.substr(end);
- }
- }
-
- throw e;
- }
- }
- };
-}
-
-/**
- An object that that tracks @tracked properties that were consumed.
-
- @private
-*/
-export class Tracker {
- private tags = new Set<Tag>();
- private last: Option<Tag> = null;
-
- add(tag: Tag): void {
- this.tags.add(tag);
-
- if (DEBUG) {
- markTagAsConsumed!(tag, new Error());
- }
-
- this.last = tag;
- }
-
- get size(): number {
- return this.tags.size;
- }
-
- combine(): Tag {
- if (this.tags.size === 0) {
- return CONSTANT_TAG;
- } else if (this.tags.size === 1) {
- return this.last as Tag;
- } else {
- let tags: Tag[] = [];
- this.tags.forEach(tag => tags.push(tag));
- return combine(tags);
- }
- }
-}
+import { SELF_TAG, tagForProperty } from './tags';
/**
@decorator
@@ -354,153 +148,31 @@ function descriptorForField([_target, key, desc]: [
!desc || (!desc.value && !desc.get && !desc.set)
);
- let initializer = desc ? desc.initializer : undefined;
- let values = new WeakMap();
- let hasInitializer = typeof initializer === 'function';
+ let { getter, setter } = trackedData<any, any>(key, desc ? desc.initializer : undefined)
+
+ // let initializer = desc ? desc.initializer : undefined;
+ // let values = new WeakMap();
+ // let hasInitializer = typeof initializer === 'function';
return {
enumerable: true,
configurable: true,
get(): any {
- let propertyTag = tagForProperty(this, key) as UpdatableTag;
-
- consume(propertyTag);
-
- let value;
-
- // If the field has never been initialized, we should initialize it
- if (hasInitializer && !values.has(this)) {
- value = initializer.call(this);
-
- values.set(this, value);
- } else {
- value = values.get(this);
- }
+ let value = getter(this);
// Add the tag of the returned value if it is an array, since arrays
// should always cause updates if they are consumed and then changed
if (Array.isArray(value) || isEmberArray(value)) {
- update(propertyTag, tagForProperty(value, '[]'));
+ consume(tagForProperty(value, '[]'));
}
return value;
},
set(newValue: any): void {
- if (DEBUG) {
- // No matter what, attempting to update a tracked property in an
- // autotracking context after it has been read is invalid, even if we
- // are otherwise warning, so always assert.
- assertTagNotConsumed!(tagForProperty(this, key), this, key, true);
- }
-
- markObjectAsDirty(this, key);
-
- values.set(this, newValue);
-
- if (propertyDidChange !== null) {
- propertyDidChange();
- }
+ setter(this, newValue);
+ dirtyTagFor(this, SELF_TAG);
},
};
}
-
-/**
- @private
-
- Whenever a tracked computed property is entered, the current tracker is
- saved off and a new tracker is replaced.
-
- Any tracked properties consumed are added to the current tracker.
-
- When a tracked computed property is exited, the tracker's tags are
- combined and added to the parent tracker.
-
- The consequence is that each tracked computed property has a tag
- that corresponds to the tracked properties consumed inside of
- itself, including child tracked computed properties.
-*/
-let CURRENT_TRACKER: Option<Tracker> = null;
-
-export function track(callback: () => void, debuggingContext?: string | false) {
- // Note: debuggingContext is allowed to be false so `DEBUG && 'debug message'` works
-
- let parent = CURRENT_TRACKER;
- let current = new Tracker();
-
- CURRENT_TRACKER = current;
-
- try {
- if (DEBUG) {
- if (debuggingContext) {
- debuggingContexts!.unshift(debuggingContext);
- }
- runInAutotrackingTransaction!(callback);
- } else {
- callback();
- }
- } finally {
- if (DEBUG && debuggingContext) {
- debuggingContexts!.shift();
- }
- CURRENT_TRACKER = parent;
- }
-
- return current.combine();
-}
-
-export function consume(tag: Tag) {
- if (CURRENT_TRACKER !== null) {
- CURRENT_TRACKER.add(tag);
- }
-}
-
-export function isTracking() {
- return CURRENT_TRACKER !== null;
-}
-
-export function untrack(callback: () => void) {
- let parent = CURRENT_TRACKER;
- CURRENT_TRACKER = null;
-
- try {
- callback();
- } finally {
- CURRENT_TRACKER = parent;
- }
-}
-
-export type Key = string;
-
-export interface Interceptors {
- [key: string]: boolean;
-}
-
-let propertyDidChange: (() => void) | null = null;
-
-export function setPropertyDidChange(cb: () => void): void {
- propertyDidChange = cb;
-}
-
-export class UntrackedPropertyError extends Error {
- static for(obj: any, key: string): UntrackedPropertyError {
- return new UntrackedPropertyError(
- obj,
- key,
- `The property '${key}' on ${obj} was changed after being rendered. If you want to change a property used in a template after the component has rendered, mark the property as a tracked property with the @tracked decorator.`
- );
- }
-
- constructor(public target: any, public key: string, message: string) {
- super(message);
- }
-}
-
-/**
- * Function that can be used in development mode to generate more meaningful
- * error messages.
- */
-export interface UntrackedPropertyErrorThrower {
- (obj: any, key: string): void;
-}
| true |
Other
|
emberjs
|
ember.js
|
4e254b3937abf7b6221eee11ae77f3b8a9878777.json
|
use upstream tracking
|
packages/@ember/-internals/metal/tests/accessors/get_test.js
|
@@ -1,8 +1,9 @@
import { ENV } from '@ember/-internals/environment';
import { Object as EmberObject } from '@ember/-internals/runtime';
-import { get, set, track, getWithDefault, Mixin, observer, computed } from '../..';
+import { get, set, getWithDefault, Mixin, observer, computed } from '../..';
import { moduleFor, AbstractTestCase } from 'internal-test-helpers';
import { run } from '@ember/runloop';
+import { track } from '@glimmer/validator';
function aget(x, y) {
return x[y];
| true |
Other
|
emberjs
|
ember.js
|
4e254b3937abf7b6221eee11ae77f3b8a9878777.json
|
use upstream tracking
|
packages/@ember/-internals/metal/tests/tracked/classic_classes_test.js
|
@@ -1,7 +1,7 @@
import { AbstractTestCase, moduleFor } from 'internal-test-helpers';
-import { defineProperty, tracked, track, nativeDescDecorator } from '../..';
+import { defineProperty, tracked, nativeDescDecorator } from '../..';
-import { value, validate } from '@glimmer/validator';
+import { track, value, validate } from '@glimmer/validator';
moduleFor(
'@tracked decorator - classic classes',
| true |
Other
|
emberjs
|
ember.js
|
4e254b3937abf7b6221eee11ae77f3b8a9878777.json
|
use upstream tracking
|
packages/@ember/-internals/metal/tests/tracked/validation_test.js
|
@@ -5,13 +5,12 @@ import {
set,
tagForProperty,
tracked,
- track,
notifyPropertyChange,
} from '../..';
import { EMBER_ARRAY } from '@ember/-internals/utils';
import { AbstractTestCase, moduleFor } from 'internal-test-helpers';
-import { value, validate } from '@glimmer/validator';
+import { track, value, validate } from '@glimmer/validator';
moduleFor(
'@tracked get validation',
| true |
Other
|
emberjs
|
ember.js
|
4e254b3937abf7b6221eee11ae77f3b8a9878777.json
|
use upstream tracking
|
packages/@ember/-internals/runtime/lib/mixins/-proxy.js
|
@@ -8,7 +8,7 @@ import {
set,
defineProperty,
Mixin,
- tagFor,
+ tagForObject,
computed,
UNKNOWN_PROPERTY_TAG,
getChainTagsForKey,
@@ -21,7 +21,7 @@ export function contentFor(proxy, m) {
let content = get(proxy, 'content');
let tag = (m === undefined ? meta(proxy) : m).readableTag();
if (tag !== undefined) {
- update(tag, tagFor(content));
+ update(tag, tagForObject(content));
}
return content;
}
| true |
Other
|
emberjs
|
ember.js
|
4e254b3937abf7b6221eee11ae77f3b8a9878777.json
|
use upstream tracking
|
packages/@ember/-internals/utils/index.ts
|
@@ -29,6 +29,7 @@ export { canInvoke, tryInvoke } from './lib/invoke';
export { default as makeArray } from './lib/make-array';
export { getName, setName } from './lib/name';
export { default as toString } from './lib/to-string';
+export { isObject } from './lib/spec';
export { HAS_NATIVE_SYMBOL } from './lib/symbol-utils';
export { HAS_NATIVE_PROXY } from './lib/proxy-utils';
export { isProxy, setProxy } from './lib/is_proxy';
| true |
Other
|
emberjs
|
ember.js
|
4e254b3937abf7b6221eee11ae77f3b8a9878777.json
|
use upstream tracking
|
packages/@ember/object/compat.ts
|
@@ -1,15 +1,13 @@
import { Meta } from '@ember/-internals/meta';
import {
- consume,
Decorator,
DecoratorPropertyDescriptor,
isElementDescriptor,
setClassicDecorator,
tagForProperty,
- track,
} from '@ember/-internals/metal';
import { assert } from '@ember/debug';
-import { UpdatableTag, update } from '@glimmer/validator';
+import { consume, track, UpdatableTag, update } from '@glimmer/validator';
let wrapGetterSetter = function(_target: object, key: string, desc: PropertyDescriptor) {
let { get: originalGet } = desc;
| true |
Other
|
emberjs
|
ember.js
|
ad1614808be24da1bfc60d5aedd43fa96a8d2ac5.json
|
update simple dom imports
|
packages/@ember/-internals/glimmer/lib/component-managers/abstract.ts
|
@@ -1,4 +1,4 @@
-import { ComponentCapabilities, Simple } from '@glimmer/interfaces';
+import { ComponentCapabilities } from '@glimmer/interfaces';
import { Tag, VersionedPathReference } from '@glimmer/reference';
import {
Arguments,
@@ -10,6 +10,7 @@ import {
PreparedArguments,
} from '@glimmer/runtime';
import { Destroyable, Option } from '@glimmer/util';
+import { SimpleElement } from '@simple-dom/interface';
// implements the ComponentManager interface as defined in glimmer:
// tslint:disable-next-line:max-line-length
@@ -32,7 +33,7 @@ export default abstract class AbstractManager<T, U> implements ComponentManager<
abstract getSelf(component: T): VersionedPathReference<unknown>;
abstract getCapabilities(state: U): ComponentCapabilities;
- didCreateElement(_component: T, _element: Simple.Element, _operations: ElementOperations): void {
+ didCreateElement(_component: T, _element: SimpleElement, _operations: ElementOperations): void {
// noop
}
| true |
Other
|
emberjs
|
ember.js
|
ad1614808be24da1bfc60d5aedd43fa96a8d2ac5.json
|
update simple dom imports
|
packages/@ember/-internals/glimmer/lib/component-managers/curly.ts
|
@@ -17,7 +17,6 @@ import {
ComponentCapabilities,
Option,
ProgramSymbolTable,
- Simple,
VMHandle,
} from '@glimmer/interfaces';
import { combine, Tag, validate, value, VersionedPathReference } from '@glimmer/reference';
@@ -34,6 +33,7 @@ import {
WithStaticLayout,
} from '@glimmer/runtime';
import { Destroyable, EMPTY_ARRAY } from '@glimmer/util';
+import { SimpleElement } from '@simple-dom/interface';
import { BOUNDS, DIRTY_TAG, HAS_BLOCK, IS_DISPATCHING_ATTRS } from '../component';
import Environment from '../environment';
import { DynamicScope } from '../renderer';
@@ -67,7 +67,7 @@ function aliasIdToElementId(args: Arguments, props: any) {
// what has already been applied. This is essentially refining the concatenated
// properties applying right to left.
function applyAttributeBindings(
- element: Simple.Element,
+ element: SimpleElement,
attributeBindings: Array<string>,
component: Component,
rootRef: RootReference<Component>,
@@ -359,7 +359,7 @@ export default class CurlyComponentManager
didCreateElement(
{ component, classRef, environment, rootRef }: ComponentStateBucket,
- element: Simple.Element,
+ element: SimpleElement,
operations: ElementOperations
): void {
setViewElement(component, element);
| true |
Other
|
emberjs
|
ember.js
|
ad1614808be24da1bfc60d5aedd43fa96a8d2ac5.json
|
update simple dom imports
|
packages/@ember/-internals/glimmer/lib/component-managers/outlet.ts
|
@@ -5,7 +5,7 @@ import { assert } from '@ember/debug';
import EngineInstance from '@ember/engine/instance';
import { _instrumentStart } from '@ember/instrumentation';
import { assign } from '@ember/polyfills';
-import { ComponentCapabilities, Option, Simple } from '@glimmer/interfaces';
+import { ComponentCapabilities, Option } from '@glimmer/interfaces';
import { CONSTANT_TAG, createTag, Tag, VersionedPathReference } from '@glimmer/reference';
import {
Arguments,
@@ -18,6 +18,7 @@ import {
WithStaticLayout,
} from '@glimmer/runtime';
import { Destroyable } from '@glimmer/util';
+import { SimpleElement } from '@simple-dom/interface';
import Environment from '../environment';
import { DynamicScope } from '../renderer';
import RuntimeResolver from '../resolver';
@@ -255,7 +256,7 @@ export function createRootOutlet(outletView: OutletView): OutletComponentDefinit
didCreateElement(
component: OutletInstanceState,
- element: Simple.Element,
+ element: SimpleElement,
_operations: ElementOperations
): void {
// to add GUID id and class
| true |
Other
|
emberjs
|
ember.js
|
ad1614808be24da1bfc60d5aedd43fa96a8d2ac5.json
|
update simple dom imports
|
packages/@ember/-internals/glimmer/lib/environment.ts
|
@@ -2,14 +2,15 @@ import { OWNER, Owner } from '@ember/-internals/owner';
import { constructStyleDeprecationMessage } from '@ember/-internals/views';
import { warn } from '@ember/debug';
import { DEBUG } from '@glimmer/env';
-import { Option, Simple } from '@glimmer/interfaces';
+import { Option } from '@glimmer/interfaces';
import { OpaqueIterable, VersionedReference } from '@glimmer/reference';
import {
ElementBuilder,
Environment as GlimmerEnvironment,
SimpleDynamicAttribute,
} from '@glimmer/runtime';
import { Destroyable } from '@glimmer/util';
+import { AttrNamespace as SimpleAttrNamespace } from '@simple-dom/interface';
import createIterable from './utils/iterable';
import { ConditionalReference, UpdatableReference } from './utils/references';
import { isHTMLSafe } from './utils/string';
@@ -161,7 +162,7 @@ if (DEBUG) {
element,
attribute: string,
isTrusting: boolean,
- namespace: Option<Simple.AttrNamespace>
+ namespace: Option<SimpleAttrNamespace>
) {
if (attribute === 'style' && !isTrusting) {
return new StyleAttributeManager({ element, name: attribute, namespace });
| true |
Other
|
emberjs
|
ember.js
|
ad1614808be24da1bfc60d5aedd43fa96a8d2ac5.json
|
update simple dom imports
|
packages/@ember/-internals/glimmer/lib/modifiers/action.ts
|
@@ -3,7 +3,6 @@ import { ActionManager, isSimpleClick } from '@ember/-internals/views';
import { assert, deprecate } from '@ember/debug';
import { flaggedInstrument } from '@ember/instrumentation';
import { join } from '@ember/runloop';
-import { Simple } from '@glimmer/interfaces';
import { Tag } from '@glimmer/reference';
import {
Arguments,
@@ -13,6 +12,7 @@ import {
ModifierManager,
} from '@glimmer/runtime';
import { Destroyable } from '@glimmer/util';
+import { SimpleElement } from '@simple-dom/interface';
import { INVOKE } from '../utils/references';
const MODIFIERS = ['alt', 'shift', 'meta', 'ctrl'];
@@ -61,7 +61,7 @@ export let ActionHelper = {
};
export class ActionState {
- public element: Simple.Element;
+ public element: SimpleElement;
public actionId: number;
public actionName: any;
public actionArgs: any;
@@ -73,7 +73,7 @@ export class ActionState {
public tag: Tag;
constructor(
- element: Simple.Element,
+ element: SimpleElement,
actionId: number,
actionName: any,
actionArgs: any[],
@@ -188,7 +188,7 @@ export class ActionState {
// implements ModifierManager<Action>
export default class ActionModifierManager implements ModifierManager<ActionState, unknown> {
create(
- element: Simple.Element,
+ element: SimpleElement,
_state: unknown,
args: Arguments,
_dynamicScope: DynamicScope,
| true |
Other
|
emberjs
|
ember.js
|
ad1614808be24da1bfc60d5aedd43fa96a8d2ac5.json
|
update simple dom imports
|
packages/@ember/-internals/glimmer/lib/modifiers/custom.ts
|
@@ -3,9 +3,10 @@ import { Factory } from '@ember/-internals/owner';
import { getDebugName } from '@ember/-internals/utils';
import { assert, deprecate } from '@ember/debug';
import { DEBUG } from '@glimmer/env';
-import { Dict, Simple } from '@glimmer/interfaces';
+import { Dict } from '@glimmer/interfaces';
import { combine, CONSTANT_TAG, createUpdatableTag, Tag, update } from '@glimmer/reference';
import { Arguments, CapturedArguments, ModifierManager } from '@glimmer/runtime';
+import { SimpleElement } from '@simple-dom/interface';
import debugRenderMessage from '../utils/debug-render-message';
export interface CustomModifierDefinitionState<ModifierInstance> {
@@ -72,7 +73,7 @@ export class CustomModifierState<ModifierInstance> {
public tag = createUpdatableTag();
constructor(
- public element: Simple.Element,
+ public element: SimpleElement,
public delegate: ModifierManagerDelegate<ModifierInstance>,
public modifier: ModifierInstance,
public args: CapturedArguments
@@ -93,7 +94,7 @@ export interface Args {
export interface ModifierManagerDelegate<ModifierInstance> {
capabilities: Capabilities;
createModifier(factory: unknown, args: Args): ModifierInstance;
- installModifier(instance: ModifierInstance, element: Simple.Element, args: Args): void;
+ installModifier(instance: ModifierInstance, element: SimpleElement, args: Args): void;
updateModifier(instance: ModifierInstance, args: Args): void;
destroyModifier(instance: ModifierInstance, args: Args): void;
}
@@ -129,7 +130,7 @@ class InteractiveCustomModifierManager<ModifierInstance>
CustomModifierDefinitionState<ModifierInstance>
> {
create(
- element: Simple.Element,
+ element: SimpleElement,
definition: CustomModifierDefinitionState<ModifierInstance>,
args: Arguments
) {
| true |
Other
|
emberjs
|
ember.js
|
ad1614808be24da1bfc60d5aedd43fa96a8d2ac5.json
|
update simple dom imports
|
packages/@ember/-internals/glimmer/lib/modifiers/on.ts
|
@@ -1,9 +1,9 @@
import { assert } from '@ember/debug';
import { DEBUG } from '@glimmer/env';
-import { Simple } from '@glimmer/interfaces';
import { CONSTANT_TAG, Tag } from '@glimmer/reference';
import { Arguments, CapturedArguments, ModifierManager } from '@glimmer/runtime';
import { Destroyable } from '@glimmer/util';
+import { SimpleElement } from '@simple-dom/interface';
import buildUntouchableThis from '../utils/untouchable-this';
const untouchableContext = buildUntouchableThis('`on` modifier');
@@ -313,7 +313,7 @@ export default class OnModifierManager implements ModifierManager<OnModifierStat
return { adds, removes };
}
- create(element: Simple.Element | Element, _state: unknown, args: Arguments) {
+ create(element: SimpleElement | Element, _state: unknown, args: Arguments) {
if (!this.isInteractive) {
return null;
}
| true |
Other
|
emberjs
|
ember.js
|
ad1614808be24da1bfc60d5aedd43fa96a8d2ac5.json
|
update simple dom imports
|
packages/@ember/-internals/glimmer/lib/renderer.ts
|
@@ -4,7 +4,7 @@ import { getViewElement, getViewId } from '@ember/-internals/views';
import { assert } from '@ember/debug';
import { backburner, getCurrentRunLoop } from '@ember/runloop';
import { DEBUG } from '@glimmer/env';
-import { Option, Simple } from '@glimmer/interfaces';
+import { Option } from '@glimmer/interfaces';
import { CURRENT_TAG, validate, value, VersionedPathReference } from '@glimmer/reference';
import {
Bounds,
@@ -19,6 +19,7 @@ import {
RenderResult,
UNDEFINED_REFERENCE,
} from '@glimmer/runtime';
+import { SimpleElement, SimpleNode } from '@simple-dom/interface';
import RSVP from 'rsvp';
import { BOUNDS } from './component';
import { createRootOutlet } from './component-managers/outlet';
@@ -76,7 +77,7 @@ class RootState {
env: Environment,
template: OwnedTemplate,
self: VersionedPathReference<unknown>,
- parentElement: Simple.Element,
+ parentElement: SimpleElement,
dynamicScope: DynamicScope,
builder: IBuilder
) {
@@ -271,20 +272,20 @@ export abstract class Renderer {
// renderer HOOKS
- appendOutletView(view: OutletView, target: Simple.Element) {
+ appendOutletView(view: OutletView, target: SimpleElement) {
let definition = createRootOutlet(view);
this._appendDefinition(view, curry(definition), target);
}
- appendTo(view: Component, target: Simple.Element) {
+ appendTo(view: Component, target: SimpleElement) {
let definition = new RootComponentDefinition(view);
this._appendDefinition(view, curry(definition), target);
}
_appendDefinition(
root: OutletView | Component,
definition: CurriedComponentDefinition,
- target: Simple.Element
+ target: SimpleElement
) {
let self = new UnboundReference(definition);
let dynamicScope = new DynamicScope(null, UNDEFINED_REFERENCE);
@@ -355,11 +356,11 @@ export abstract class Renderer {
this._clearAllRoots();
}
- abstract getElement(view: unknown): Option<Simple.Element>;
+ abstract getElement(view: unknown): Option<SimpleElement>;
getBounds(
view: object
- ): { parentElement: Simple.Element; firstNode: Simple.Node; lastNode: Simple.Node } {
+ ): { parentElement: SimpleElement; firstNode: SimpleNode; lastNode: SimpleNode } {
let bounds: Bounds = view[BOUNDS];
assert('object passed to getBounds must have the BOUNDS symbol as a property', Boolean(bounds));
@@ -371,7 +372,7 @@ export abstract class Renderer {
return { parentElement, firstNode, lastNode };
}
- createElement(tagName: string): Simple.Element {
+ createElement(tagName: string): SimpleElement {
return this._env.getAppendOperations().createElement(tagName);
}
@@ -519,7 +520,7 @@ export class InertRenderer extends Renderer {
return new this(env, rootTemplate, _viewRegistry, false, builder);
}
- getElement(_view: unknown): Option<Simple.Element> {
+ getElement(_view: unknown): Option<SimpleElement> {
throw new Error(
'Accessing `this.element` is not allowed in non-interactive environments (such as FastBoot).'
);
@@ -541,7 +542,7 @@ export class InteractiveRenderer extends Renderer {
return new this(env, rootTemplate, _viewRegistry, true, builder);
}
- getElement(view: unknown): Option<Simple.Element> {
+ getElement(view: unknown): Option<SimpleElement> {
return getViewElement(view);
}
}
| true |
Other
|
emberjs
|
ember.js
|
ad1614808be24da1bfc60d5aedd43fa96a8d2ac5.json
|
update simple dom imports
|
packages/@ember/-internals/glimmer/lib/setup-registry.ts
|
@@ -1,7 +1,7 @@
import { hasDOM } from '@ember/-internals/browser-environment';
import { privatize as P, Registry } from '@ember/-internals/container';
import { ENV } from '@ember/-internals/environment';
-import { Simple } from '@glimmer/interfaces';
+import { SimpleDocument } from '@simple-dom/interface';
import Component from './component';
import Checkbox from './components/checkbox';
import Input from './components/input';
@@ -65,13 +65,13 @@ export function setupApplicationRegistry(registry: Registry) {
}
registry.register('service:-dom-changes', {
- create({ document }: { document: Simple.Document }) {
+ create({ document }: { document: SimpleDocument }) {
return new DOMChanges(document);
},
});
registry.register('service:-dom-tree-construction', {
- create({ document }: { document: Simple.Document }) {
+ create({ document }: { document: SimpleDocument }) {
let Implementation = hasDOM ? DOMTreeConstruction : NodeDOMTreeConstruction;
return new Implementation(document);
},
| true |
Other
|
emberjs
|
ember.js
|
ad1614808be24da1bfc60d5aedd43fa96a8d2ac5.json
|
update simple dom imports
|
packages/@ember/-internals/glimmer/lib/simple-dom.d.ts
|
@@ -1,4 +1,4 @@
-declare module 'simple-dom' {
- import { Simple } from '@glimmer/interfaces';
- export interface Document extends Simple.Document {}
-}
+// declare module 'simple-dom' {
+// import { Simple } from '@glimmer/interfaces';
+// export interface Document extends Simple.Document {}
+// }
| true |
Other
|
emberjs
|
ember.js
|
ad1614808be24da1bfc60d5aedd43fa96a8d2ac5.json
|
update simple dom imports
|
packages/@ember/-internals/glimmer/lib/utils/bindings.ts
|
@@ -2,9 +2,11 @@ import { get } from '@ember/-internals/metal';
import { assert, deprecate } from '@ember/debug';
import { EMBER_COMPONENT_IS_VISIBLE } from '@ember/deprecated-features';
import { dasherize } from '@ember/string';
-import { Option, Simple } from '@glimmer/interfaces';
+import { Option } from '@glimmer/interfaces';
import { CachedReference, combine, map, Reference, Tag } from '@glimmer/reference';
import { ElementOperations, PrimitiveReference } from '@glimmer/runtime';
+import { Core, Ops } from '@glimmer/wire-format';
+import { SimpleElement } from '@simple-dom/interface';
import { Component } from './curly-component-state-bucket';
import { referenceFromParts, RootReference } from './references';
import { htmlSafe, isHTMLSafe, SafeString } from './string';
@@ -52,7 +54,7 @@ export const AttributeBinding = {
},
install(
- _element: Simple.Element,
+ _element: SimpleElement,
component: Component,
rootRef: RootReference<Component>,
parsed: [string, string, boolean],
@@ -152,7 +154,7 @@ export let IsVisibleBinding:
| undefined
| {
install(
- element: Simple.Element,
+ element: SimpleElement,
component: Component,
rootRef: RootReference<Component>,
operations: ElementOperations
@@ -163,7 +165,7 @@ export let IsVisibleBinding:
if (EMBER_COMPONENT_IS_VISIBLE) {
IsVisibleBinding = {
install(
- _element: Simple.Element,
+ _element: SimpleElement,
component: Component,
rootRef: RootReference<Component>,
operations: ElementOperations
@@ -200,7 +202,7 @@ if (EMBER_COMPONENT_IS_VISIBLE) {
export const ClassNameBinding = {
install(
- _element: Simple.Element,
+ _element: SimpleElement,
rootRef: RootReference<Component>,
microsyntax: string,
operations: ElementOperations
| true |
Other
|
emberjs
|
ember.js
|
ad1614808be24da1bfc60d5aedd43fa96a8d2ac5.json
|
update simple dom imports
|
packages/@ember/-internals/glimmer/lib/utils/debug-render-tree.ts
|
@@ -1,7 +1,7 @@
import { assert } from '@ember/debug';
-import { Simple } from '@glimmer/interfaces';
import { Bounds, CapturedArguments } from '@glimmer/runtime';
import { expect, Option, Stack } from '@glimmer/util';
+import { SimpleElement, SimpleNode } from '@simple-dom/interface';
import { OwnedTemplate } from '../template';
export type RenderNodeType = 'outlet' | 'engine' | 'route-template' | 'component';
@@ -27,9 +27,9 @@ export interface CapturedRenderNode {
instance: unknown;
template: Option<string>;
bounds: Option<{
- parentElement: Simple.Element;
- firstNode: Simple.Node;
- lastNode: Simple.Node;
+ parentElement: SimpleElement;
+ firstNode: SimpleNode;
+ lastNode: SimpleNode;
}>;
children: CapturedRenderNode[];
}
| true |
Other
|
emberjs
|
ember.js
|
ad1614808be24da1bfc60d5aedd43fa96a8d2ac5.json
|
update simple dom imports
|
packages/@ember/-internals/glimmer/lib/views/outlet.ts
|
@@ -1,7 +1,7 @@
import { OWNER, Owner } from '@ember/-internals/owner';
import { assign } from '@ember/polyfills';
import { schedule } from '@ember/runloop';
-import { Simple } from '@glimmer/interfaces';
+import { SimpleElement } from '@simple-dom/interface';
import { OutletDefinitionState } from '../component-managers/outlet';
import { Renderer } from '../renderer';
import { OwnedTemplate } from '../template';
@@ -71,7 +71,7 @@ export default class OutletView {
};
}
- appendTo(selector: string | Simple.Element) {
+ appendTo(selector: string | SimpleElement) {
let target;
if (this._environment.hasDOM) {
| true |
Other
|
emberjs
|
ember.js
|
ad1614808be24da1bfc60d5aedd43fa96a8d2ac5.json
|
update simple dom imports
|
packages/@ember/-internals/glimmer/tests/integration/application/debug-render-tree-test.ts
|
@@ -20,15 +20,15 @@ import Controller from '@ember/controller';
import { captureRenderTree } from '@ember/debug';
import Engine from '@ember/engine';
import EngineInstance from '@ember/engine/instance';
-import { Simple } from '@glimmer/interfaces';
import { expect } from '@glimmer/util';
+import { SimpleElement, SimpleNode } from '@simple-dom/interface';
import { compile } from 'ember-template-compiler';
import { runTask } from 'internal-test-helpers/lib/run';
interface CapturedBounds {
- parentElement: Simple.Element;
- firstNode: Simple.Node;
- lastNode: Simple.Node;
+ parentElement: SimpleElement;
+ firstNode: SimpleNode;
+ lastNode: SimpleNode;
}
type Expected<T> = T | ((actual: T) => boolean);
@@ -1529,17 +1529,17 @@ if (ENV._DEBUG_RENDER_TREE) {
parentElement: (expect(
node.parentNode,
'BUG: detached node'
- ) as Simple.Node) as Simple.Element,
- firstNode: node as Simple.Node,
- lastNode: node as Simple.Node,
+ ) as SimpleNode) as SimpleElement,
+ firstNode: node as SimpleNode,
+ lastNode: node as SimpleNode,
};
}
elementBounds(element: Element): CapturedBounds {
return {
- parentElement: element as Simple.Element,
- firstNode: element.firstChild! as Simple.Node,
- lastNode: element.lastChild! as Simple.Node,
+ parentElement: element as SimpleElement,
+ firstNode: element.firstChild! as SimpleNode,
+ lastNode: element.lastChild! as SimpleNode,
};
}
| true |
Other
|
emberjs
|
ember.js
|
ad1614808be24da1bfc60d5aedd43fa96a8d2ac5.json
|
update simple dom imports
|
packages/@ember/-internals/views/index.d.ts
|
@@ -1,6 +1,7 @@
-import { Simple, Template, Option } from '@glimmer/interfaces';
+import { Template, Option } from '@glimmer/interfaces';
import { Factory, Owner } from '@ember/-internals/owner';
import { TemplateFactory } from '@ember/-internals/glimmer';
+import { SimpleElement } from '@simple-dom/interface';
export interface StaticTemplateMeta {
moduleName: string;
@@ -21,11 +22,11 @@ export const ViewMixin: any;
export const ViewStateSupport: any;
export const TextSupport: any;
-export function getElementView(element: Simple.Element): unknown;
-export function getViewElement(view: unknown): Option<Simple.Element>;
-export function setElementView(element: Simple.Element, view: unknown): void;
-export function setViewElement(view: unknown, element: Simple.Element): void;
-export function clearElementView(element: Simple.Element): void;
+export function getElementView(element: SimpleElement): unknown;
+export function getViewElement(view: unknown): Option<SimpleElement>;
+export function setElementView(element: SimpleElement, view: unknown): void;
+export function setViewElement(view: unknown, element: SimpleElement): void;
+export function clearElementView(element: SimpleElement): void;
export function clearViewElement(view: unknown): void;
export function addChildView(parent: unknown, child: unknown): void;
| true |
Other
|
emberjs
|
ember.js
|
98c3be3a593e2ca370d98eefb45d493104e20f90.json
|
Remove unused wrapComponentClassAttribute (#18603)
Remove unused wrapComponentClassAttribute
|
packages/@ember/-internals/glimmer/lib/helpers/-class.ts
|
@@ -1,29 +0,0 @@
-import { dasherize } from '@ember/string';
-import { Arguments, VM } from '@glimmer/runtime';
-import { InternalHelperReference } from '../utils/references';
-
-function classHelper({ positional }: any) {
- let path = positional.at(0);
- let args = positional.length;
- let value = path.value();
-
- if (value === true) {
- if (args > 1) {
- return dasherize(positional.at(1).value());
- }
- return null;
- }
-
- if (value === false) {
- if (args > 2) {
- return dasherize(positional.at(2).value());
- }
- return null;
- }
-
- return value;
-}
-
-export default function(_vm: VM, args: Arguments) {
- return new InternalHelperReference(classHelper, args.capture());
-}
| true |
Other
|
emberjs
|
ember.js
|
98c3be3a593e2ca370d98eefb45d493104e20f90.json
|
Remove unused wrapComponentClassAttribute (#18603)
Remove unused wrapComponentClassAttribute
|
packages/@ember/-internals/glimmer/lib/resolver.ts
|
@@ -28,7 +28,6 @@ import InternalComponentManager, {
import { TemplateOnlyComponentDefinition } from './component-managers/template-only';
import { isHelperFactory, isSimpleHelper } from './helper';
import { default as componentAssertionHelper } from './helpers/-assert-implicit-component-helper-argument';
-import { default as classHelper } from './helpers/-class';
import { default as inputTypeHelper } from './helpers/-input-type';
import { default as normalizeClassHelper } from './helpers/-normalize-class';
import { default as action } from './helpers/action';
@@ -252,7 +251,6 @@ const BUILTINS_HELPERS: IBuiltInHelpers = {
readonly,
unbound,
unless: inlineUnless,
- '-class': classHelper,
'-each-in': eachIn,
'-input-type': inputTypeHelper,
'-normalize-class': normalizeClassHelper,
| true |
Other
|
emberjs
|
ember.js
|
98c3be3a593e2ca370d98eefb45d493104e20f90.json
|
Remove unused wrapComponentClassAttribute (#18603)
Remove unused wrapComponentClassAttribute
|
packages/@ember/-internals/glimmer/lib/syntax.ts
|
@@ -9,7 +9,6 @@ import { blockLetMacro } from './syntax/let';
import { mountMacro } from './syntax/mount';
import { outletMacro } from './syntax/outlet';
import { hashToArgs } from './syntax/utils';
-import { wrapComponentClassAttribute } from './utils/bindings';
function refineInlineSyntax(
name: string,
@@ -46,7 +45,6 @@ function refineBlockSyntax(
let handle = builder.compiler['resolver'].lookupComponentDefinition(name, builder.referrer);
if (handle !== null) {
- wrapComponentClassAttribute(hash);
builder.component.static(handle, [params, hashToArgs(hash), template, inverse]);
return true;
}
| true |
Other
|
emberjs
|
ember.js
|
98c3be3a593e2ca370d98eefb45d493104e20f90.json
|
Remove unused wrapComponentClassAttribute (#18603)
Remove unused wrapComponentClassAttribute
|
packages/@ember/-internals/glimmer/lib/utils/bindings.ts
|
@@ -5,7 +5,6 @@ import { dasherize } from '@ember/string';
import { Opaque, Option, Simple } from '@glimmer/interfaces';
import { CachedReference, combine, map, Reference, Tag } from '@glimmer/reference';
import { ElementOperations, PrimitiveReference } from '@glimmer/runtime';
-import { Core, Ops } from '@glimmer/wire-format';
import { Component } from './curly-component-state-bucket';
import { referenceFromParts, RootReference } from './references';
import { htmlSafe, isHTMLSafe, SafeString } from './string';
@@ -29,31 +28,6 @@ function referenceForParts(rootRef: RootReference<Component>, parts: string[]):
return referenceFromParts(rootRef, parts);
}
-// TODO we should probably do this transform at build time
-export function wrapComponentClassAttribute(hash: Core.Hash) {
- if (hash === null) {
- return;
- }
-
- let [keys, values] = hash;
- let index = keys === null ? -1 : keys.indexOf('class');
-
- if (index !== -1) {
- let value = values[index];
- if (!Array.isArray(value)) {
- return;
- }
-
- let [type] = value;
-
- if (type === Ops.Get || type === Ops.MaybeLocal) {
- let path = value[value.length - 1];
- let propName = path[path.length - 1];
- values[index] = [Ops.Helper, '-class', [value, propName], null];
- }
- }
-}
-
export const AttributeBinding = {
parse(microsyntax: string): [string, string, boolean] {
let colonIndex = microsyntax.indexOf(':');
| true |
Other
|
emberjs
|
ember.js
|
98c3be3a593e2ca370d98eefb45d493104e20f90.json
|
Remove unused wrapComponentClassAttribute (#18603)
Remove unused wrapComponentClassAttribute
|
packages/@ember/-internals/glimmer/tests/integration/helpers/-class-test.js
|
@@ -1,76 +0,0 @@
-import { RenderingTestCase, moduleFor, classes, runTask } from 'internal-test-helpers';
-
-import { set } from '@ember/-internals/metal';
-
-moduleFor(
- 'Helpers test: {{-class}}',
- class extends RenderingTestCase {
- ['@test casts binding to dasherized class']() {
- this.registerComponent('foo-bar', { template: '' });
- this.render(`{{foo-bar class=(-class someTruth "someTruth")}}`, {
- someTruth: true,
- });
-
- this.assertComponentElement(this.firstChild, {
- tagName: 'div',
- attrs: { class: classes('some-truth ember-view') },
- });
-
- runTask(() => this.rerender());
-
- this.assertComponentElement(this.firstChild, {
- tagName: 'div',
- attrs: { class: classes('some-truth ember-view') },
- });
-
- runTask(() => set(this.context, 'someTruth', false));
-
- this.assertComponentElement(this.firstChild, {
- tagName: 'div',
- attrs: { class: classes('ember-view') },
- });
-
- runTask(() => set(this.context, 'someTruth', true));
-
- this.assertComponentElement(this.firstChild, {
- tagName: 'div',
- attrs: { class: classes('some-truth ember-view') },
- });
- }
-
- ['@tests casts leaf path of binding to dasherized class']() {
- this.registerComponent('foo-bar', { template: '' });
- this.render(`{{foo-bar class=(-class this.model.someTruth "someTruth")}}`, {
- model: {
- someTruth: true,
- },
- });
-
- this.assertComponentElement(this.firstChild, {
- tagName: 'div',
- attrs: { class: classes('some-truth ember-view') },
- });
-
- runTask(() => this.rerender());
-
- this.assertComponentElement(this.firstChild, {
- tagName: 'div',
- attrs: { class: classes('some-truth ember-view') },
- });
-
- runTask(() => set(this.context, 'model.someTruth', false));
-
- this.assertComponentElement(this.firstChild, {
- tagName: 'div',
- attrs: { class: classes('ember-view') },
- });
-
- runTask(() => set(this.context, 'model', { someTruth: true }));
-
- this.assertComponentElement(this.firstChild, {
- tagName: 'div',
- attrs: { class: classes('some-truth ember-view') },
- });
- }
- }
-);
| true |
Other
|
emberjs
|
ember.js
|
1df3e992ed01bd9f97f302927bd596fdb82ee8a4.json
|
Add v3.16.0-beta.1 to CHANGELOG
[ci skip]
(cherry picked from commit 9c13333618e7407d5940cbb859f50c71097bbbc7)
|
CHANGELOG.md
|
@@ -1,5 +1,9 @@
# Ember Changelog
+### v3.16.0-beta.1 (December 9, 2019)
+
+- [#18436](https://github.com/emberjs/ember.js/pull/18436) [DEPRECATION] Deprecate globals resolver per [RFC #331](https://github.com/emberjs/rfcs/blob/master/text/0331-deprecate-globals-resolver.md).
+
### v3.15.0 (December 9, 2019)
- [#17948](https://github.com/emberjs/ember.js/pull/17948) [DEPRECATION] Deprecate `Component#isVisible` per [RFC #324](https://github.com/emberjs/rfcs/blob/master/text/0324-deprecate-component-isvisible.md).
| false |
Other
|
emberjs
|
ember.js
|
c76e584adef6a613799e4611499b6078eedafd99.json
|
Add v3.15.0 to CHANGELOG
[ci skip]
(cherry picked from commit e3bd1e55a899997d1707efaeb162f1ec061e5f91)
|
CHANGELOG.md
|
@@ -1,27 +1,12 @@
# Ember Changelog
-### v3.15.0-beta.5 (December 4, 2019)
-
-- [#18582](https://github.com/emberjs/ember.js/pull/18582) [BUGFIX] Ensure `loader.js` is transpiled to the applications specified targets (from `config/targets.js`).
-
-### v3.15.0-beta.4 (November 25, 2019)
-
-- [#17834](https://github.com/emberjs/ember.js/pull/17834) [BUGFIX] Prevents autotracking ArrayProxy creation
-- [#18554](https://github.com/emberjs/ember.js/pull/18554) [BREAKING BUGFIX] Adds autotracking transaction
-
-### v3.15.0-beta.3 (November 18, 2019)
-
-- [#18549](https://github.com/emberjs/ember.js/pull/18549) [BUGFIX] Add component reference to the mouse event handler deprecation warnings
-
-### v3.15.0-beta.2 (November 11, 2019)
-
-- [#18539](https://github.com/emberjs/ember.js/pull/18539) [BUGFIX] Add ID to `CapturedRenderNode`
-
-### v3.15.0-beta.1 (October 31, 2019)
+### v3.15.0 (December 9, 2019)
- [#17948](https://github.com/emberjs/ember.js/pull/17948) [DEPRECATION] Deprecate `Component#isVisible` per [RFC #324](https://github.com/emberjs/rfcs/blob/master/text/0324-deprecate-component-isvisible.md).
- [#18491](https://github.com/emberjs/ember.js/pull/18491) [DEPRECATION] Deprecate `{{partial}}` per [RFC #449](https://github.com/emberjs/rfcs/blob/master/text/0449-deprecate-partials.md).
-- [#18441](https://github.com/emberjs/ember.js/pull/18441) [DEPRECATION] Deprecate window.ENV
+- [#18441](https://github.com/emberjs/ember.js/pull/18441) [DEPRECATION] Deprecate use of window.ENV to configure boot options
+- [#18554](https://github.com/emberjs/ember.js/pull/18554) [BREAKING BUGFIX] Adds autotracking transaction
+- [#17834](https://github.com/emberjs/ember.js/pull/17834) [BUGFIX] Prevents autotracking ArrayProxy creation
### v3.14.3 (December 3, 2019)
| false |
Other
|
emberjs
|
ember.js
|
a8b95d4cc050bb5b6e055ad1c021a09174ee7586.json
|
[DOCS] Route, setupController: add missing transition param
|
packages/@ember/-internals/routing/lib/system/route.ts
|
@@ -1276,6 +1276,7 @@ class Route extends EmberObject implements IRoute {
@method setupController
@param {Controller} controller instance
@param {Object} model
+ @param {Object} transition
@since 1.0.0
@public
*/
| false |
Other
|
emberjs
|
ember.js
|
f1cc1196e8c992eb0d1d6cd997e0e9cec454563e.json
|
Add v3.15.0-beta.5 to CHANGELOG
[ci skip]
(cherry picked from commit 1cd3aa263767659fd1111706a700484f8f9001b3)
|
CHANGELOG.md
|
@@ -1,5 +1,9 @@
# Ember Changelog
+### v3.15.0-beta.5 (December 4, 2019)
+
+- [#18582](https://github.com/emberjs/ember.js/pull/18582) [BUGFIX] Ensure `loader.js` is transpiled to the applications specified targets (from `config/targets.js`).
+
### v3.15.0-beta.4 (November 25, 2019)
- [#17834](https://github.com/emberjs/ember.js/pull/17834) [BUGFIX] Prevents autotracking ArrayProxy creation
@@ -21,7 +25,7 @@
### v3.14.3 (December 3, 2019)
-- [#18582](https://github.com/emberjs/ember.js/pull/18582) [BUGFIX release] Ensure `loader.js` is transpiled to the applications specified targets (from `config/targets.js`).
+- [#18582](https://github.com/emberjs/ember.js/pull/18582) [BUGFIX] Ensure `loader.js` is transpiled to the applications specified targets (from `config/targets.js`).
### v3.14.2 (November 20, 2019)
| false |
Other
|
emberjs
|
ember.js
|
a751e2778f8c95fd053ee29c45e43a91e5e03968.json
|
remove peekmeta in property_set (#18580)
remove peekmeta in property_set
|
packages/@ember/-internals/metal/lib/property_set.ts
|
@@ -1,4 +1,3 @@
-import { peekMeta } from '@ember/-internals/meta';
import {
HAS_NATIVE_PROXY,
lookupDescriptor,
@@ -73,8 +72,6 @@ export function set(obj: object, keyName: string, value: any, tolerant?: boolean
return setPath(obj, keyName, value, tolerant);
}
- let meta = peekMeta(obj);
-
let descriptor = lookupDescriptor(obj, keyName);
let setter = descriptor === null ? undefined : descriptor.set;
@@ -106,7 +103,7 @@ export function set(obj: object, keyName: string, value: any, tolerant?: boolean
}
if (currentValue !== value) {
- notifyPropertyChange(obj, keyName, meta);
+ notifyPropertyChange(obj, keyName);
}
}
| false |
Other
|
emberjs
|
ember.js
|
d698efa924a346c352c014523531be6a1e2e90b7.json
|
Add v3.12.2 to CHANGELOG.md.
[ci skip]
|
CHANGELOG.md
|
@@ -87,6 +87,10 @@
- [#18217](https://github.com/emberjs/ember.js/pull/18217) [BUGFIX] Adds ability for computed props to depend on args
- [#18222](https://github.com/emberjs/ember.js/pull/18222) [BUGFIX] Matches assertion behavior for CPs computing after destroy
+### v3.12.2 (December 4, 2019)
+
+- [#18576](https://github.com/emberjs/ember.js/pull/18576) [BUGFIX] Fix leftover `const` expressions in legacy builds
+
### v3.12.1 (November 20, 2019)
- [#18244](https://github.com/emberjs/ember.js/pull/18244) Fix query param assertion when using the router services `transitionTo` to redirect _during_ an existing transition.
| false |
Other
|
emberjs
|
ember.js
|
8444ca8831dab1f968c2af45089f16bcea633d98.json
|
Add v3.14.3 to CHANGELOG.md.
[ci skip]
|
CHANGELOG.md
|
@@ -19,6 +19,10 @@
- [#18491](https://github.com/emberjs/ember.js/pull/18491) [DEPRECATION] Deprecate `{{partial}}` per [RFC #449](https://github.com/emberjs/rfcs/blob/master/text/0449-deprecate-partials.md).
- [#18441](https://github.com/emberjs/ember.js/pull/18441) [DEPRECATION] Deprecate window.ENV
+### v3.14.3 (December 3, 2019)
+
+- [#18582](https://github.com/emberjs/ember.js/pull/18582) [BUGFIX release] Ensure `loader.js` is transpiled to the applications specified targets (from `config/targets.js`).
+
### v3.14.2 (November 20, 2019)
- [#18539](https://github.com/emberjs/ember.js/pull/18539) / [#18548](https://github.com/emberjs/ember.js/pull/18548) [BUGFIX] Fix issues with the new APIs to be used by ember-inspector for building the "component's tree" including `@glimmer/component`.
| false |
Other
|
emberjs
|
ember.js
|
f4be4981a895db2f19a4772b6b76a73f91b5f482.json
|
remove peekmeta in property_set
|
packages/@ember/-internals/metal/lib/property_set.ts
|
@@ -1,4 +1,3 @@
-import { peekMeta } from '@ember/-internals/meta';
import {
HAS_NATIVE_PROXY,
lookupDescriptor,
@@ -73,8 +72,6 @@ export function set(obj: object, keyName: string, value: any, tolerant?: boolean
return setPath(obj, keyName, value, tolerant);
}
- let meta = peekMeta(obj);
-
let descriptor = lookupDescriptor(obj, keyName);
let setter = descriptor === null ? undefined : descriptor.set;
@@ -106,7 +103,7 @@ export function set(obj: object, keyName: string, value: any, tolerant?: boolean
}
if (currentValue !== value) {
- notifyPropertyChange(obj, keyName, meta);
+ notifyPropertyChange(obj, keyName);
}
}
| false |
Other
|
emberjs
|
ember.js
|
a590298a3ac9d3199217ae02c56e0d21e809f2fd.json
|
Add v3.15.0-beta.4 to CHANGELOG
[ci skip]
(cherry picked from commit ee81995e5c95d3b6e36450df76918740c513787c)
|
CHANGELOG.md
|
@@ -1,5 +1,10 @@
# Ember Changelog
+### v3.15.0-beta.4 (November 25, 2019)
+
+- [#17834](https://github.com/emberjs/ember.js/pull/17834) [BUGFIX] Prevents autotracking ArrayProxy creation
+- [#18554](https://github.com/emberjs/ember.js/pull/18554) [BREAKING BUGFIX] Adds autotracking transaction
+
### v3.15.0-beta.3 (November 18, 2019)
- [#18549](https://github.com/emberjs/ember.js/pull/18549) [BUGFIX] Add component reference to the mouse event handler deprecation warnings
| false |
Other
|
emberjs
|
ember.js
|
35eef67d36e472897bef5ab3abc7a4af588646c7.json
|
Apply suggestions from code review
Co-Authored-By: Chris Garrett <[email protected]>
Co-Authored-By: Robert Jackson <[email protected]>
|
packages/@ember/-internals/glimmer/index.ts
|
@@ -132,7 +132,7 @@
```app/components/labeled-textfield.hbs
<label>
- {{yield}} <Input @value={{value}} />
+ {{yield}} <Input @value={{@value}} />
</label>
```
@@ -157,7 +157,7 @@
```app/templates/components/labeled-textfield.hbs
<label>
- {{yield this.validationError}} <Input @value={{value}} />
+ {{yield this.validationError}} <Input @value={{@value}} />
</label>
```
| true |
Other
|
emberjs
|
ember.js
|
35eef67d36e472897bef5ab3abc7a4af588646c7.json
|
Apply suggestions from code review
Co-Authored-By: Chris Garrett <[email protected]>
Co-Authored-By: Robert Jackson <[email protected]>
|
packages/@ember/-internals/glimmer/lib/helpers/each-in.ts
|
@@ -115,7 +115,7 @@ import { Opaque } from '@glimmer/util';
/**
The `{{each-in}}` helper loops over properties on an object.
- For example, if the `@user` argument contains this object:
+ For example, given this component definition:
```app/components/developer-details.js
import Component from '@glimmer/component';
@@ -129,12 +129,12 @@ import { Opaque } from '@glimmer/util';
}
```
- This template would display all properties on the `@user`
+ This template would display all properties on the `developer`
object in a list:
```app/components/developer-details.hbs
<ul>
- {{#each-in @user as |key value|}}
+ {{#each-in this.developer as |key value|}}
<li>{{key}}: {{value}}</li>
{{/each-in}}
</ul>
| true |
Other
|
emberjs
|
ember.js
|
35eef67d36e472897bef5ab3abc7a4af588646c7.json
|
Apply suggestions from code review
Co-Authored-By: Chris Garrett <[email protected]>
Co-Authored-By: Robert Jackson <[email protected]>
|
packages/@ember/-internals/glimmer/lib/helpers/if-unless.ts
|
@@ -179,7 +179,7 @@ export function inlineIf(_vm: VM, { positional }: Arguments) {
Like the `if` helper, the `unless` helper also has a block form.
- The following:
+ The following will not render anything:
```app/templates/application.hbs
<Greeting />
@@ -191,8 +191,6 @@ export function inlineIf(_vm: VM, { positional }: Arguments) {
{{/unless}}
```
- Will not render anything.
-
You can also use an `else` helper with the `unless` block. The
`else` will display if the value is truthy.
@@ -221,7 +219,7 @@ export function inlineIf(_vm: VM, { positional }: Arguments) {
and calling it with a falsey `userData`:
```app/templates/application.hbs
- <LoggedIn @userData=false />
+ <LoggedIn @userData={{false}} />
```
Will render:
| true |
Other
|
emberjs
|
ember.js
|
39e48ff8646507bdfea352257ddb308e4c0ea91b.json
|
Add v3.12.1 to CHANGELOG.md.
[ci skip]
|
CHANGELOG.md
|
@@ -78,6 +78,11 @@
- [#18217](https://github.com/emberjs/ember.js/pull/18217) [BUGFIX] Adds ability for computed props to depend on args
- [#18222](https://github.com/emberjs/ember.js/pull/18222) [BUGFIX] Matches assertion behavior for CPs computing after destroy
+### v3.12.1 (November 20, 2019)
+
+- [#18244](https://github.com/emberjs/ember.js/pull/18244) Fix query param assertion when using the router services `transitionTo` to redirect _during_ an existing transition.
+- [#18458](https://github.com/emberjs/ember.js/pull/18458) / [#18555](https://github.com/emberjs/ember.js/pull/18555) Ensure `(query-params)` helper can be used outside of direct `{{link-to}}` / `<LinkTo />` invocation.
+
### v3.12.0 (August 5, 2019)
- [#18159](https://github.com/emberjs/ember.js/pull/18159) [BUGFIX] Update router.js to ensure buildRouteInfoMetadata does not eagerly cache routes in lazy Engines
| false |
Other
|
emberjs
|
ember.js
|
432c49d2ceb55067f5cf6893c04a2e609bf1fa0d.json
|
Add v3.14.2 to CHANGELOG.md.
[ci skip]
|
CHANGELOG.md
|
@@ -14,6 +14,11 @@
- [#18491](https://github.com/emberjs/ember.js/pull/18491) [DEPRECATION] Deprecate `{{partial}}` per [RFC #449](https://github.com/emberjs/rfcs/blob/master/text/0449-deprecate-partials.md).
- [#18441](https://github.com/emberjs/ember.js/pull/18441) [DEPRECATION] Deprecate window.ENV
+### v3.14.2 (November 20, 2019)
+
+- [#18539](https://github.com/emberjs/ember.js/pull/18539) / [#18548](https://github.com/emberjs/ember.js/pull/18548) [BUGFIX] Fix issues with the new APIs to be used by ember-inspector for building the "component's tree" including `@glimmer/component`.
+- [#18549](https://github.com/emberjs/ember.js/pull/18549) [BUGFIX] Add component reference to the mouse event handler deprecation warnings.
+
### v3.14.1 (October 30, 2019)
- [#18244](https://github.com/emberjs/ember.js/pull/18244) [BUGFIX] Fix query param assertion when using the router services `transitionTo` to redirect _during_ an existing transition.
| false |
Other
|
emberjs
|
ember.js
|
255bd2860a5968484b3891a0e1c822da5643a634.json
|
remove debug stack
|
packages/@ember/-internals/glimmer/index.ts
|
@@ -385,11 +385,8 @@ export { default as AbstractComponentManager } from './lib/component-managers/ab
// TODO just test these through public API
// a lot of these are testing how a problem was solved
// rather than the problem was solved
-// DebugStack should just test the assert message
-// it supports for example
export { UpdatableReference, INVOKE } from './lib/utils/references';
export { default as iterableFor } from './lib/utils/iterable';
-export { default as getDebugStack, DebugStack } from './lib/utils/debug-stack';
export { default as OutletView } from './lib/views/outlet';
export { capabilities } from './lib/component-managers/custom';
export { setComponentManager, getComponentManager } from './lib/utils/custom-component-manager';
| true |
Other
|
emberjs
|
ember.js
|
255bd2860a5968484b3891a0e1c822da5643a634.json
|
remove debug stack
|
packages/@ember/-internals/glimmer/lib/component-managers/abstract.ts
|
@@ -10,23 +10,16 @@ import {
PreparedArguments,
} from '@glimmer/runtime';
import { Destroyable, Opaque, Option } from '@glimmer/util';
-import { DebugStack } from '../utils/debug-stack';
// implements the ComponentManager interface as defined in glimmer:
// tslint:disable-next-line:max-line-length
// https://github.com/glimmerjs/glimmer-vm/blob/v0.24.0-beta.4/packages/%40glimmer/runtime/lib/component/interfaces.ts#L21
export default abstract class AbstractManager<T, U> implements ComponentManager<T, U> {
- public debugStack: DebugStack | undefined = undefined;
-
prepareArgs(_state: U, _args: Arguments): Option<PreparedArguments> {
return null;
}
- // must be implemented by inheritors, inheritors should also
- // call `this._pushToDebugStack` to ensure the rerendering
- // assertion messages are properly maintained
-
abstract create(
env: Environment,
definition: U,
@@ -43,9 +36,6 @@ export default abstract class AbstractManager<T, U> implements ComponentManager<
// noop
}
- // inheritors should also call `this.debugStack.pop()` to
- // ensure the rerendering assertion messages are properly
- // maintained
didRenderLayout(_component: T, _bounds: Bounds): void {
// noop
}
@@ -56,16 +46,10 @@ export default abstract class AbstractManager<T, U> implements ComponentManager<
abstract getTag(_bucket: T): Tag;
- // inheritors should also call `this._pushToDebugStack`
- // to ensure the rerendering assertion messages are
- // properly maintained
update(_bucket: T, _dynamicScope: DynamicScope): void {
// noop
}
- // inheritors should also call `this.debugStack.pop()` to
- // ensure the rerendering assertion messages are properly
- // maintained
didUpdateLayout(_bucket: T, _bounds: Bounds): void {
// noop
}
| true |
Other
|
emberjs
|
ember.js
|
255bd2860a5968484b3891a0e1c822da5643a634.json
|
remove debug stack
|
packages/@ember/-internals/glimmer/lib/component-managers/curly.ts
|
@@ -256,10 +256,6 @@ export default class CurlyComponentManager
callerSelfRef: VersionedPathReference,
hasBlock: boolean
): ComponentStateBucket {
- if (DEBUG) {
- environment.debugStack.push(`component:${state.name}`);
- }
-
// Get the nearest concrete component instance from the scope. "Virtual"
// components will be skipped.
let parentView = dynamicScope.view;
@@ -430,10 +426,6 @@ export default class CurlyComponentManager
if (ENV._DEBUG_RENDER_TREE) {
bucket.environment.debugRenderTree.didRender(bucket, bounds);
}
-
- if (DEBUG) {
- bucket.environment.debugStack.pop();
- }
}
getTag({ args, component }: ComponentStateBucket): Tag {
@@ -455,10 +447,6 @@ export default class CurlyComponentManager
environment.debugRenderTree.update(bucket);
}
- if (DEBUG) {
- environment.debugStack.push(component._debugContainerKey);
- }
-
bucket.finalizer = _instrumentStart('render.component', rerenderInstrumentDetails, component);
if (args && !validate(args.tag, argsRevision)) {
@@ -486,10 +474,6 @@ export default class CurlyComponentManager
if (ENV._DEBUG_RENDER_TREE) {
bucket.environment.debugRenderTree.didRender(bucket, bounds);
}
-
- if (DEBUG) {
- bucket.environment.debugStack.pop();
- }
}
didUpdate({ component, environment }: ComponentStateBucket): void {
| true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.