File tree Expand file tree Collapse file tree 3 files changed +31
-2
lines changed
Expand file tree Collapse file tree 3 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -292,10 +292,10 @@ export class Step extends Evented {
292292
293293 /**
294294 * Check if the step is open and visible
295- * @return {*| boolean } True if the step is open and visible
295+ * @return {boolean } True if the step is open and visible
296296 */
297297 isOpen ( ) {
298- return this . el && ! this . el . hidden ;
298+ return Boolean ( this . el && ! this . el . hidden ) ;
299299 }
300300
301301 /**
Original file line number Diff line number Diff line change @@ -148,6 +148,17 @@ export class Tour extends Evented {
148148 return this . currentStep ;
149149 }
150150
151+ /**
152+ * Hide the current step
153+ */
154+ hide ( ) {
155+ const currentStep = this . getCurrentStep ( ) ;
156+
157+ if ( currentStep ) {
158+ return currentStep . hide ( ) ;
159+ }
160+ }
161+
151162 /**
152163 * Go to the next step in the tour
153164 * If we are at the end, call `complete`
Original file line number Diff line number Diff line change @@ -147,6 +147,24 @@ describe('Tour', function() {
147147 } ) ;
148148 } ) ;
149149
150+ describe ( '.hide()' , function ( ) {
151+ it ( 'hides the current step' , ( ) => {
152+ const firstStep = instance . steps [ 0 ] ;
153+ const hideStepSpy = spy ( firstStep , 'hide' ) ;
154+
155+ assert . equal ( firstStep . isOpen ( ) , false ) ;
156+
157+ instance . start ( ) ;
158+
159+ assert . equal ( firstStep . isOpen ( ) , true ) ;
160+
161+ instance . hide ( ) ;
162+
163+ assert . equal ( firstStep . isOpen ( ) , false ) ;
164+ assert . equal ( hideStepSpy . callCount , 1 ) ;
165+ } ) ;
166+ } ) ;
167+
150168 describe ( '.next()/.back()' , function ( ) {
151169 it ( 'goes to the next/previous steps' , function ( ) {
152170 instance . start ( ) ;
You can’t perform that action at this time.
0 commit comments