Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Rename defaults to defaultStepOptions. #243

Merged
merged 2 commits into from
Sep 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ confirm window on cancel, to ensure you want to cancel.
`confirmCancelMessage` is a string to display in the confirm dialog when `confirmCancel`
is set to true.

### defaults
### defaultStepOptions

`defaults` is used to set the options that will be applied to each step by default.
`defaultStepOptions` is used to set the options that will be applied to each step by default.
You can pass in any of the options that you can with Shepherd.

**⚠️ You must set defaults *BEFORE* setting steps.**
**⚠️ You must set `defaultStepOptions` *BEFORE* setting steps.**

It will be an object of a form something like:

```js
this.get('tour').set('defaults', {
this.get('tour').set('defaultStepOptions', {
classes: 'custom-class-name-1 custom-class-name-2',
scrollTo: false,
showCancelLink: true
Expand Down
6 changes: 3 additions & 3 deletions addon/services/tour.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default Service.extend(Evented, {
// Configuration Options
confirmCancel: false,
confirmCancelMessage: null,
defaults: {},
defaultStepOptions: {},
disableScroll: false,
errorTitle: null,
isActive: false,
Expand Down Expand Up @@ -171,12 +171,12 @@ export default Service.extend(Evented, {
initialize() {
const confirmCancel = get(this, 'confirmCancel');
const confirmCancelMessage = get(this, 'confirmCancelMessage');
const defaults = get(this, 'defaults');
const defaultStepOptions = get(this, 'defaultStepOptions');

const tourObject = new Shepherd.Tour({
confirmCancel,
confirmCancelMessage,
defaults
defaultStepOptions
});

tourObject.on('start', run.bind(this, 'onTourStart'));
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"ember-cli-node-assets": "0.2.2",
"ember-getowner-polyfill": "^2.2.0",
"fastboot-transform": "^0.1.3",
"shepherd.js": "^2.0.0-beta.26"
"shepherd.js": "^2.0.0-beta.27"
},
"devDependencies": {
"@ember/optional-features": "^0.6.3",
Expand Down
4 changes: 2 additions & 2 deletions tests/acceptance/ember-shepherd-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module('Acceptance | Tour functionality tests', function(hooks) {
});

test('Hides cancel link', async function(assert) {
const defaults = {
const defaultStepOptions = {
classes: 'shepherd-theme-arrows test-defaults',
showCancelLink: false
};
Expand All @@ -46,7 +46,7 @@ module('Acceptance | Tour functionality tests', function(hooks) {

await visit('/');

tour.set('defaults', defaults);
tour.set('defaultStepOptions', defaultStepOptions);
tour.set('steps', steps);

await click('.toggleHelpModal');
Expand Down
4 changes: 2 additions & 2 deletions tests/dummy/app/routes/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { steps as defaultSteps } from '../data';
export default Route.extend({
tour: service(),
disableScroll: true,
defaults: {
defaultStepOptions: {
classes: 'shepherd-theme-arrows custom-default-class',
scrollTo: true,
showCancelLink: true
Expand All @@ -17,7 +17,7 @@ export default Route.extend({
beforeModel() {
const tour = this.get('tour');

tour.set('defaults', this.get('defaults'));
tour.set('defaultStepOptions', this.get('defaultStepOptions'));
tour.set('disableScroll', this.get('disableScroll'));
tour.set('modal', true);
tour.set('confirmCancel', false);
Expand Down
2 changes: 1 addition & 1 deletion tests/dummy/app/templates/application.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{{~#code-block language='javascript'~}}
//Inject the service: tour: Ember.inject.service()
let tour = this.get('tour');
tour.set('defaults', shepherdDefaults);
tour.set('defaultStepOptions', shepherdDefaults);
tour.set('disableScroll', true);
tour.set('modal', true);
tour.set('requiredElements', requiredElements);
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8198,9 +8198,9 @@ shellwords@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b"

shepherd.js@^2.0.0-beta.26:
version "2.0.0-beta.26"
resolved "https://registry.yarnpkg.com/shepherd.js/-/shepherd.js-2.0.0-beta.26.tgz#04d8e5dfa8aba7d873d4314183b1e56e4acb7f4e"
shepherd.js@^2.0.0-beta.27:
version "2.0.0-beta.27"
resolved "https://registry.yarnpkg.com/shepherd.js/-/shepherd.js-2.0.0-beta.27.tgz#09b6744fc902fccb1dce482cd7af12422a3d48cd"
dependencies:
element-matches "^0.1.2"
lodash-es "^4.17.10"
Expand Down