From 329f39b8da64bea4f7a7e5fa530220a8439e9853 Mon Sep 17 00:00:00 2001 From: Matt Gibbs Date: Wed, 19 Aug 2015 10:46:48 -0400 Subject: [PATCH 1/2] Correcting typings on Tour Buttons --- tether-shepherd/tether-shepherd.d.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tether-shepherd/tether-shepherd.d.ts b/tether-shepherd/tether-shepherd.d.ts index b632fb771..eeee87104 100644 --- a/tether-shepherd/tether-shepherd.d.ts +++ b/tether-shepherd/tether-shepherd.d.ts @@ -143,7 +143,7 @@ declare module TetherShepherd { title?: string; attachTo?: any; beforeShowPromise?: any; - classes?: any; + classes?: string; buttons?: IShepherdTourButton[]; advanceOn?: any; showCancelLink?: boolean; @@ -156,9 +156,13 @@ declare module TetherShepherd { interface IShepherdTourButton { text: string; - classes: string[]; - action?: any; - events?: any; + classes?: string; + action?: Function; + events?: IShepherdTourButtonEventHash; + } + + interface IShepherdTourButtonEventHash { + [Key: string]: Function; } interface IShepherdTourAttachProperties { From 0ac23ee1fb12c3c3d849deb8f1cd50353a5e9839 Mon Sep 17 00:00:00 2001 From: Matt Gibbs Date: Wed, 19 Aug 2015 11:22:40 -0400 Subject: [PATCH 2/2] Creating more robust test case. --- tether-shepherd/tether-shepherd-tests.ts | 46 ++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/tether-shepherd/tether-shepherd-tests.ts b/tether-shepherd/tether-shepherd-tests.ts index 48bef675b..7325a8464 100644 --- a/tether-shepherd/tether-shepherd-tests.ts +++ b/tether-shepherd/tether-shepherd-tests.ts @@ -6,11 +6,53 @@ var tour = new Shepherd.Tour({ } }); -tour.addStep('test-step', { +var step1Options: TetherShepherd.IShepherdTourStepOptions = { text: 'This is a test step being added to the test tour', title: 'Test Step Title', attachTo: { element: '#button', on: 'right' + }, + buttons: [ + { + text: 'Continue', + action: tour.next + }, + { + text: 'Cancel', + action: tour.cancel + } + ] +}; + +tour.addStep('test-step', step1Options); + +var step2Options: TetherShepherd.IShepherdTourStepOptions = { + text: 'This is the next step being added to the test tour', + title: 'Test Step Title 2 - Electric Boogaloo', + attachTo: '#anotherButton right', + buttons: [ + { + text: 'Done', + action: tour.next, + events: { + 'mouseover': () => { + console.log('I did not feel like making a function body that pretended to do something else'); + } + } + } + ], + when: { + destroy: () => { + console.log('Destroyed the Step 2'); + } } -}); +}; + +tour.addStep('test-step-2', step2Options); + +var queriedStep = tour.getById('test-step-2'); + +queriedStep.destroy(); + +tour.start(); \ No newline at end of file