Skip to content

Commit

Permalink
change all instances for builtInButtons to align with Shepherd docs f…
Browse files Browse the repository at this point in the history
…or config
  • Loading branch information
chuckcarpenter committed Sep 10, 2018
1 parent 5539757 commit cfba88c
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 38 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ this.get('tour').set('steps', [
});
});
},
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary',
text: 'Exit',
Expand Down Expand Up @@ -218,15 +218,15 @@ A function that returns a promise. When the promise resolves, the rest of the `s
> **default value:** `null`

##### builtInButtons
##### buttons

These are the standard button types supported by Shepherd. Just set type to `next`, `back`, or `cancel`, then set the text and classes as normal.

Custom actions can also be used by using an action method instead of a type. For example:

``` javascript
...
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary',
text: 'Exit',
Expand Down
5 changes: 2 additions & 3 deletions addon/services/tour.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ export default Service.extend(Evented, {
stepsChange: observer('steps', function() {
this.initialize();
const steps = get(this, 'steps');

const tour = get(this, 'tourObject');

// Return nothing if there are no steps
Expand All @@ -336,8 +335,8 @@ export default Service.extend(Evented, {
steps.forEach((step, index) => {
const { id, options } = step;

assert('You must either pass an array of builtInButtons or `false`, undefined is not supported', options.builtInButtons !== undefined);
options.buttons = (options.builtInButtons !== false) ? options.builtInButtons.map(this.makeButton, this) : false;
assert('You must either pass an array of buttons or `false`, undefined is not supported', options.buttons !== undefined);
options.buttons = (options.buttons !== false) ? options.buttons.map(this.makeButton, this) : false;
options.attachTo = this.normalizeAttachTo(options.attachTo);
tour.addStep(id, options);

Expand Down
22 changes: 11 additions & 11 deletions tests/acceptance/ember-shepherd-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module('Acceptance | Tour functionality tests', function(hooks) {
id: 'test-highlight',
options: {
attachTo: '.first-element bottom',
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary cancel-button',
text: 'Exit',
Expand Down Expand Up @@ -90,7 +90,7 @@ module('Acceptance | Tour functionality tests', function(hooks) {
id: 'intro',
options: {
attachTo: '.first-element bottom',
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary cancel-button',
text: 'Exit',
Expand Down Expand Up @@ -150,7 +150,7 @@ module('Acceptance | Tour functionality tests', function(hooks) {
assert.notOk(document.querySelector('#shepherdOverlay'), '#shepherdOverlay should not exist, since non-modal');
});

test('Tour next, back, and cancel builtInButtons work', async function(assert) {
test('Tour next, back, and cancel buttons work', async function(assert) {
assert.expect(3);

await visit('/');
Expand All @@ -173,7 +173,7 @@ module('Acceptance | Tour functionality tests', function(hooks) {
id: 'test-highlight',
options: {
attachTo: '.first-element bottom',
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary cancel-button',
text: 'Exit',
Expand Down Expand Up @@ -214,7 +214,7 @@ module('Acceptance | Tour functionality tests', function(hooks) {
id: 'test-highlight',
options: {
attachTo: '.first-element bottom',
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary cancel-button',
text: 'Exit',
Expand Down Expand Up @@ -260,7 +260,7 @@ module('Acceptance | Tour functionality tests', function(hooks) {
id: 'test-defaults-classes',
options: {
attachTo: '.first-element bottom',
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary cancel-button',
text: 'Exit',
Expand Down Expand Up @@ -300,7 +300,7 @@ module('Acceptance | Tour functionality tests', function(hooks) {
element: '.first-element',
on: 'bottom'
},
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary cancel-button',
text: 'Exit',
Expand Down Expand Up @@ -342,7 +342,7 @@ module('Acceptance | Tour functionality tests', function(hooks) {
element: find('.first-element'),
on: 'bottom'
},
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary cancel-button',
text: 'Exit',
Expand Down Expand Up @@ -381,7 +381,7 @@ module('Acceptance | Tour functionality tests', function(hooks) {
element: '.first-element',
on: 'bottom'
},
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary button-one',
text: 'button one'
Expand Down Expand Up @@ -473,7 +473,7 @@ module('Acceptance | Tour functionality tests', function(hooks) {
id: 'intro',
options: {
attachTo: '.first-element bottom',
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary cancel-button',
text: 'Exit',
Expand Down Expand Up @@ -545,7 +545,7 @@ module('Acceptance | Tour functionality tests', function(hooks) {
id: 'intro',
options: {
attachTo: '.first-element bottom',
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary cancel-button',
text: 'Exit',
Expand Down
20 changes: 10 additions & 10 deletions tests/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export default [
id: 'intro',
options: {
attachTo: '.first-element bottom',
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary cancel-button',
text: 'Exit',
Expand Down Expand Up @@ -32,7 +32,7 @@ export default [
id: 'installation',
options: {
attachTo: '.install-element bottom',
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary cancel-button',
text: 'Exit',
Expand All @@ -58,7 +58,7 @@ export default [
id: 'usage',
options: {
attachTo: '.usage-element bottom',
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary cancel-button',
text: 'Exit',
Expand Down Expand Up @@ -87,7 +87,7 @@ export default [
element: '.modal-element',
on: 'top'
},
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary cancel-button',
text: 'Exit',
Expand Down Expand Up @@ -119,7 +119,7 @@ export default [
element: '.style-copy-element',
on: 'top'
},
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary cancel-button',
text: 'Exit',
Expand All @@ -146,10 +146,10 @@ export default [
}
},
{
id: 'builtInButtons',
id: 'buttons',
options: {
attachTo: '.built-in-buttons-element top',
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary cancel-button',
text: 'Exit',
Expand All @@ -171,15 +171,15 @@ export default [
text: [
`For the common button types ("next", "back", "cancel", etc.), we implemented Ember actions
that perform these actions on your tour automatically. To use them, simply include
in the builtInButtons array in each step.`
in the buttons array in each step.`
]
}
},
{
id: 'disableScroll',
options: {
attachTo: '.disable-scroll-element top',
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary cancel-button',
text: 'Exit',
Expand Down Expand Up @@ -208,7 +208,7 @@ export default [
{
id: 'noAttachTo',
options: {
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary cancel-button',
text: 'Exit',
Expand Down
20 changes: 10 additions & 10 deletions tests/dummy/app/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export default [
id: 'intro',
options: {
attachTo: '.first-element bottom',
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary cancel-button',
text: 'Exit',
Expand Down Expand Up @@ -32,7 +32,7 @@ export default [
id: 'installation',
options: {
attachTo: '.install-element bottom',
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary cancel-button',
text: 'Exit',
Expand All @@ -58,7 +58,7 @@ export default [
id: 'usage',
options: {
attachTo: '.usage-element bottom',
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary cancel-button',
text: 'Exit',
Expand Down Expand Up @@ -87,7 +87,7 @@ export default [
element: '.modal-element',
on: 'top'
},
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary cancel-button',
text: 'Exit',
Expand Down Expand Up @@ -119,7 +119,7 @@ export default [
element: '.style-copy-element',
on: 'top'
},
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary cancel-button',
text: 'Exit',
Expand All @@ -146,10 +146,10 @@ export default [
}
},
{
id: 'builtInButtons',
id: 'buttons',
options: {
attachTo: '.built-in-buttons-element top',
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary cancel-button',
text: 'Exit',
Expand All @@ -171,15 +171,15 @@ export default [
text: [
`For the common button types ("next", "back", "cancel", etc.), we implemented Ember actions
that perform these actions on your tour automatically. To use them, simply include
in the builtInButtons array in each step.`
in the buttons array in each step.`
]
}
},
{
id: 'disableScroll',
options: {
attachTo: '.disable-scroll-element top',
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary cancel-button',
text: 'Exit',
Expand Down Expand Up @@ -208,7 +208,7 @@ export default [
{
id: 'noAttachTo',
options: {
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary cancel-button',
text: 'Exit',
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/services/tour-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const steps = [
id: 'intro',
options: {
attachTo: '.test-element bottom',
builtInButtons: [
buttons: [
{
classes: 'shepherd-button-secondary',
text: 'Exit',
Expand Down

0 comments on commit cfba88c

Please sign in to comment.