This repository was archived by the owner on Feb 17, 2021. It is now read-only.
File tree 2 files changed +39
-1
lines changed
2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change 1089
1089
utils . addClass ( el , 'hopscotch-callout no-number' ) ;
1090
1090
} else {
1091
1091
currTour = winHopscotch . getCurrTour ( ) ;
1092
- utils . addClass ( el , 'tour-' + currTour . id ) ;
1092
+ if ( currTour ) {
1093
+ utils . addClass ( el , 'tour-' + currTour . id ) ;
1094
+ }
1093
1095
}
1094
1096
1095
1097
/**
1323
1325
return bubble ;
1324
1326
} ,
1325
1327
1328
+ /**
1329
+ * Destroy the bubble currently associated with Hopscotch.
1330
+ * This is done when we end the current tour.
1331
+ *
1332
+ * @private
1333
+ */
1334
+ destroyBubble = function ( ) {
1335
+ if ( bubble ) {
1336
+ bubble . destroy ( ) ;
1337
+ bubble = null ;
1338
+ }
1339
+ } ,
1340
+
1326
1341
/**
1327
1342
* Convenience method for getting an option. Returns custom config option
1328
1343
* or the default config option if no custom value exists.
1996
2011
1997
2012
this . removeCallbacks ( null , true ) ;
1998
2013
this . resetDefaultOptions ( ) ;
2014
+ destroyBubble ( ) ;
1999
2015
2000
2016
currTour = null ;
2001
2017
Original file line number Diff line number Diff line change @@ -156,6 +156,12 @@ describe('Hopscotch', function() {
156
156
hopscotch . endTour ( ) ;
157
157
} ) ;
158
158
159
+ it ( 'should complain if no tour data is passed in' , function ( ) {
160
+ expect ( function ( ) {
161
+ hopscotch . startTour ( ) ;
162
+ } ) . toThrow ( new Error ( 'Tour data is required for startTour.' ) ) ;
163
+ } ) ;
164
+
159
165
it ( 'should reject tour IDs that include invalid characters' , function ( ) {
160
166
expect ( function ( ) {
161
167
hopscotch . startTour ( {
@@ -1285,6 +1291,22 @@ describe('HopscotchBubble', function() {
1285
1291
expect ( content ) . toBe ( 'It\'s a shopping list' ) ;
1286
1292
hopscotch . endTour ( ) ;
1287
1293
} ) ;
1294
+
1295
+ it ( 'Should include tour ID as part of bubble classes' , function ( ) {
1296
+ hopscotch . startTour ( {
1297
+ id : 'hs-test-tour-class' ,
1298
+ steps : [ {
1299
+ target : 'shopping-list' ,
1300
+ placement : 'left' ,
1301
+ title : 'Shopping List' ,
1302
+ content : 'It\'s a shopping list'
1303
+ } ]
1304
+ } ) ;
1305
+ bubble = document . querySelector ( '.hopscotch-bubble.tour-hs-test-tour-class' ) ;
1306
+ console . log ( document . querySelector ( '.hopscotch-bubble' ) . classList ) ;
1307
+ expect ( bubble ) . not . toBe ( null ) ;
1308
+ hopscotch . endTour ( ) ;
1309
+ } ) ;
1288
1310
} ) ;
1289
1311
1290
1312
describe ( 'Step Number' , function ( ) {
You can’t perform that action at this time.
0 commit comments