Skip to content

Commit

Permalink
Add test for onLeave callback - test that it gets called with true
Browse files Browse the repository at this point in the history
…if the tour

is being skipped by the user - related gh #66
  • Loading branch information
James Warwood committed May 9, 2015
1 parent 902dd8c commit 215f87f
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/tests.js
Expand Up @@ -281,6 +281,8 @@ QUnit.module('index', lifecycle);
QUnit.test('returns zero on the first step', function(assert) {
createWalkthrough(this.fixture);



assert.strictEqual(this.fixture.pagewalkthrough('index'), 0);
});

Expand Down Expand Up @@ -332,3 +334,32 @@ QUnit.asyncTest('clicks on the tooltip content/arrow do not propagate', 0, funct
QUnit.start();
}, 1000);
});

QUnit.asyncTest('onLeave called with true if tour skipped', 1, function(assert) {
createWalkthrough(this.fixture, {
steps: [
{
autoScroll: false,
popup: {
content: 'Hello, world!',
type: 'modal'
},
onLeave: function(skipped) {
assert.equal(skipped, true, 'skipped flag was true');
QUnit.start();
}
},
{
autoScroll: false,
popup: {
content: 'My second step',
type: 'modal'
}
}
]
});

this.fixture.pagewalkthrough('show');

$('#jpwClose').click();
});

0 comments on commit 215f87f

Please sign in to comment.