Skip to content

Commit

Permalink
Update to 3.6 + bump ember-app-scheduler to fix deprecations (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
cibernox authored and snewcomer committed Dec 21, 2018
1 parent 89baf44 commit ae210bb
Show file tree
Hide file tree
Showing 8 changed files with 1,199 additions and 2,764 deletions.
20 changes: 20 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ module.exports = {
// node files
{
files: [
'.eslintrc.js',
'.template-lintrc.js',
'ember-cli-build.js',
'index.js',
'testem.js',
Expand Down
22 changes: 21 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,27 @@ env:
global:
# See https://git.io/vdao3 for details.
- JOBS=1
matrix:

branches:
only:
- master
# npm version tags
- /^v\d+\.\d+\.\d+/

jobs:
fail_fast: true
allow_failures:
- env: EMBER_TRY_SCENARIO=ember-canary

include:
# runs linting and tests with current locked deps

- stage: "Tests"
name: "Tests"
script:
- npm run lint:js
- npm test

# we recommend new addons test the current and previous LTS
# as well as latest stable release (bonus points to beta/canary)
- EMBER_TRY_SCENARIO=ember-lts-2.12
Expand Down
26 changes: 26 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# How To Contribute

## Installation

* `git clone <repository-url>`
* `cd my-addon`
* `npm install`

## Linting

* `npm run lint:hbs`
* `npm run lint:js`
* `npm run lint:js -- --fix`

## Running tests

* `ember test` – Runs the test suite on the current Ember version
* `ember test --server` – Runs the test suite in "watch mode"
* `ember try:each` – Runs the test suite against multiple Ember versions

## Running the dummy application

* `ember serve`
* Visit the dummy application at [http://localhost:4200](http://localhost:4200).

For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).
38 changes: 19 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# ember-router-scroll

[![Build Status](https://travis-ci.org/dollarshaveclub/ember-router-scroll.svg?branch=master)](https://travis-ci.org/dollarshaveclub/ember-router-scroll)
[![Build Status](https://travis-ci.org/dollarshaveclub/ember-router-scroll.svg?branch=master)](https://travis-ci.org/dollarshaveclub/ember-router-scroll)
[![Greenkeeper badge](https://badges.greenkeeper.io/dollarshaveclub/ember-router-scroll.svg)](https://greenkeeper.io/)

> Scroll to page top on transition, like a non-SPA website. An alternative scroll behavior for Ember applications.
## Why Use it?

Ember expects an application to be rendered with nested views. The default behavior is for the scroll position to be
preserved on every transition. However, not all Ember applications use nested views. For these applications, a user
Ember expects an application to be rendered with nested views. The default behavior is for the scroll position to be
preserved on every transition. However, not all Ember applications use nested views. For these applications, a user
would expect to see the top of the page on most transitions.

In addition to scrolling to the top of the page on most transitions, a user would expect the scroll position to be
In addition to scrolling to the top of the page on most transitions, a user would expect the scroll position to be
preserved when using the back or forward browser buttons.

**ember-router-scroll** makes your single page application feel more like a regular website.
Expand All @@ -31,7 +31,7 @@ You need to import the mixin in your `app/router.js` file, so it will be injecte
Also, you have to add RouterScroll as an extension to your Router object:

```javascript
// app/router.js
// app/router.js

import RouterScroll from 'ember-router-scroll';

Expand All @@ -53,9 +53,9 @@ historySupportMiddleware: true,

This location type inherits from Ember's `HistoryLocation`.

**4.** If using old style QUnit tests. If tests based on [RFC](https://github.com/emberjs/rfcs/pull/232), you can
**4.** If using old style QUnit tests. If tests based on [RFC](https://github.com/emberjs/rfcs/pull/232), you can
ignore this.
In your router and controller tests, add `'service:router-scroll'` and `'service:scheduler'` as dependencies in the
In your router and controller tests, add `'service:router-scroll'` and `'service:scheduler'` as dependencies in the
`needs: []` block:

```javascript
Expand All @@ -66,7 +66,7 @@ needs:[ 'service:router-scroll', 'service:scheduler' ],

### Options

If you need to scroll to the top of an area that generates a vertical scroll bar, you can specify the id of an element
If you need to scroll to the top of an area that generates a vertical scroll bar, you can specify the id of an element
of the scrollable area. Default is `window` for using the scroll position of the whole viewport. You can pass an options
object in your application's `config/environment.js` file.

Expand All @@ -76,8 +76,8 @@ ENV['routerScroll'] = {
};
```

If you want to scroll to a target element on the page, you can specify the id or class of the element on the page. This
is particularly useful if instead of scrolling to the top of the window, you want to scroll to the top of the main
If you want to scroll to a target element on the page, you can specify the id or class of the element on the page. This
is particularly useful if instead of scrolling to the top of the window, you want to scroll to the top of the main
content area (that does not generate a vertical scrollbar).

```javascript
Expand Down Expand Up @@ -135,8 +135,8 @@ Adding a query parameter or controller property fixes this issue.

### preserveScrollPosition with queryParams

In certain cases, you might want to have certain routes preserve scroll position when coming from a specific location.
For example, inside your application, there is a way to get to a route where the user expects scroll position to be
In certain cases, you might want to have certain routes preserve scroll position when coming from a specific location.
For example, inside your application, there is a way to get to a route where the user expects scroll position to be
preserved (such as a tab section).

**1.** Add query param in controller
Expand Down Expand Up @@ -166,18 +166,18 @@ Next, in the place where a transition is triggered, pass in `preserveScrollPosit

### preserveScrollPosition with a controller property

In other cases, you may have certain routes that always preserve scroll position, or routes where the controller can
decide when to preserve scroll position. For instance, you may have some nested routes that have true nested UI where
preserving scroll position is expected. Or you want a particular route to start off with the default scroll-to-top
In other cases, you may have certain routes that always preserve scroll position, or routes where the controller can
decide when to preserve scroll position. For instance, you may have some nested routes that have true nested UI where
preserving scroll position is expected. Or you want a particular route to start off with the default scroll-to-top
behavior but then preserve scroll position when query params change in response to user interaction. Using a controller
property also allows the use of preserveScrollPosition without adding this to the query params.


**1.** Add query param to controller

Add `preserveScrollPosition` as a controller property for the route that needs to preserve the scroll position.
In this example we have `preserveScrollPosition` initially set to false so that we get our normal scroll-to-top behavior
when the route loads. Later on, when an action triggers a change to the `filter` query param, we also set
In this example we have `preserveScrollPosition` initially set to false so that we get our normal scroll-to-top behavior
when the route loads. Later on, when an action triggers a change to the `filter` query param, we also set
`preserveScrollPosition` to true so that this user interaction does not trigger the scroll-to-top behavior.

Example:
Expand All @@ -201,8 +201,8 @@ export default Controller.extend({

**2.** Reset preserveScrollPosition if necessary

If your controller is changing the preserveScrollPosition property, you'll probably need to reset
`preserveScrollPosition` back to the default behavior whenever the controller is reset. This is not necessary on routes
If your controller is changing the preserveScrollPosition property, you'll probably need to reset
`preserveScrollPosition` back to the default behavior whenever the controller is reset. This is not necessary on routes
where `preserveScrollPosition` is always set to true.

```javascript
Expand Down
17 changes: 15 additions & 2 deletions config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ module.exports = function() {
},
{
name: 'ember-lts-2.16',
env: {
EMBER_OPTIONAL_FEATURES: JSON.stringify({ 'jquery-integration': true })
},
npm: {
devDependencies: {
'ember-source': '~2.16.0'
Expand All @@ -29,6 +32,9 @@ module.exports = function() {
},
{
name: 'ember-lts-2.18',
env: {
EMBER_OPTIONAL_FEATURES: JSON.stringify({ 'jquery-integration': true })
},
npm: {
devDependencies: {
'ember-source': '~2.18.0'
Expand Down Expand Up @@ -60,9 +66,16 @@ module.exports = function() {
}
},
{
name: 'ember-default',
name: 'ember-default-with-jquery',
env: {
EMBER_OPTIONAL_FEATURES: JSON.stringify({
'jquery-integration': true
})
},
npm: {
devDependencies: {}
devDependencies: {
'@ember/jquery': '^0.5.1'
}
}
}
]
Expand Down
27 changes: 14 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"homepage": "https://dollarshaveclub.github.io/ember-router-scroll/",
"scripts": {
"build": "ember build",
"lint:hbs": "ember-template-lint .",
"lint:js": "eslint ./*.js addon app config tests",
"start": "ember serve",
"test": "ember test",
Expand All @@ -63,35 +64,35 @@
"update": "ember update --run-codemods"
},
"dependencies": {
"ember-app-scheduler": "^1.0.1",
"ember-cli-babel": "^7.1.0",
"ember-getowner-polyfill": "^2.0.1"
"ember-app-scheduler": "^1.0.5",
"ember-cli-babel": "^7.1.2",
"ember-getowner-polyfill": "^2.2.0"
},
"devDependencies": {
"broccoli-asset-rev": "^3.0.0",
"ember-cli": "~3.5.0",
"ember-cli": "~3.6.0",
"ember-cli-dependency-checker": "^3.0.0",
"ember-cli-eslint": "^5.0.0",
"ember-cli-github-pages": "^0.2.0",
"ember-cli-htmlbars": "^3.0.0",
"ember-cli-htmlbars-inline-precompile": "^2.0.0",
"ember-cli-htmlbars-inline-precompile": "^2.1.0",
"ember-cli-inject-live-reload": "^2.0.1",
"ember-cli-qunit": "^4.1.1",
"ember-cli-qunit": "^4.4.0",
"ember-cli-shims": "^1.2.0",
"ember-cli-sri": "^2.1.0",
"ember-cli-uglify": "^2.0.0",
"ember-cli-update": "^0.27.0",
"ember-disable-prototype-extensions": "^1.1.2",
"ember-cli-uglify": "^2.1.0",
"ember-cli-update": "^0.27.3",
"ember-disable-prototype-extensions": "^1.1.3",
"ember-export-application-global": "^2.0.0",
"ember-load-initializers": "^2.0.0",
"ember-maybe-import-regenerator": "^0.1.6",
"ember-resolver": "^5.0.1",
"ember-source": "~3.5.0",
"ember-source-channel-url": "^1.0.1",
"ember-source": "~3.6.1",
"ember-source-channel-url": "^1.1.0",
"ember-try": "^1.0.0-beta.2",
"eslint-plugin-ember": "^6.0.1",
"eslint-plugin-ember": "^6.1.0",
"eslint-plugin-node": "^8.0.0",
"loader.js": "^4.2.3"
"loader.js": "^4.7.0"
},
"engines": {
"node": "^4.5 || 6.* || >= 7.*"
Expand Down
Loading

0 comments on commit ae210bb

Please sign in to comment.