add getSlidePath API method, update URL tests to work with new replaceState throttle
parent
2a239aedca
commit
37861335a2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -2744,6 +2744,9 @@ export default function( revealElement, options ) {
|
||||||
// Helper method, retrieves query string as a key:value map
|
// Helper method, retrieves query string as a key:value map
|
||||||
getQueryHash: Util.getQueryHash,
|
getQueryHash: Util.getQueryHash,
|
||||||
|
|
||||||
|
// Returns the path to the current slide as represented in the URL
|
||||||
|
getSlidePath: location.getHash.bind( location ),
|
||||||
|
|
||||||
// Returns reveal.js DOM elements
|
// Returns reveal.js DOM elements
|
||||||
getRevealElement: () => revealElement,
|
getRevealElement: () => revealElement,
|
||||||
getSlidesElement: () => dom.slides,
|
getSlidesElement: () => dom.slides,
|
||||||
|
|
|
@ -341,38 +341,38 @@
|
||||||
Reveal.configure({ hash: true, fragmentInURL: false });
|
Reveal.configure({ hash: true, fragmentInURL: false });
|
||||||
|
|
||||||
Reveal.slide( 2, 0 );
|
Reveal.slide( 2, 0 );
|
||||||
assert.strictEqual( window.location.hash, '#/2' );
|
assert.strictEqual( Reveal.getSlidePath(), '/2' );
|
||||||
|
|
||||||
Reveal.slide( 2, 1 );
|
Reveal.slide( 2, 1 );
|
||||||
assert.strictEqual( window.location.hash, '#/2/1' );
|
assert.strictEqual( Reveal.getSlidePath(), '/2/1' );
|
||||||
|
|
||||||
Reveal.slide( 2, 0, 1 );
|
Reveal.slide( 2, 0, 1 );
|
||||||
assert.strictEqual( window.location.hash, '#/2' );
|
assert.strictEqual( Reveal.getSlidePath(), '/2' );
|
||||||
|
|
||||||
Reveal.slide( 2, 2, 0 );
|
Reveal.slide( 2, 2, 0 );
|
||||||
assert.strictEqual( window.location.hash, '#/fragments3' );
|
assert.strictEqual( Reveal.getSlidePath(), '/fragments3' );
|
||||||
|
|
||||||
Reveal.slide( 2, 2, 1 );
|
Reveal.slide( 2, 2, 1 );
|
||||||
assert.strictEqual( window.location.hash, '#/fragments3' );
|
assert.strictEqual( Reveal.getSlidePath(), '/fragments3' );
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test( 'Write (fragmentInURL: true)', function( assert ) {
|
QUnit.test( 'Write (fragmentInURL: true)', function( assert ) {
|
||||||
Reveal.configure({ hash: true, fragmentInURL: true });
|
Reveal.configure({ hash: true, fragmentInURL: true });
|
||||||
|
|
||||||
Reveal.slide( 2, 0, -1 );
|
Reveal.slide( 2, 0, -1 );
|
||||||
assert.strictEqual( window.location.hash, '#/2' );
|
assert.strictEqual( Reveal.getSlidePath(), '/2' );
|
||||||
|
|
||||||
Reveal.slide( 2, 1, -1 );
|
Reveal.slide( 2, 1, -1 );
|
||||||
assert.strictEqual( window.location.hash, '#/2/1' );
|
assert.strictEqual( Reveal.getSlidePath(), '/2/1' );
|
||||||
|
|
||||||
Reveal.slide( 2, 0, 1 );
|
Reveal.slide( 2, 0, 1 );
|
||||||
assert.strictEqual( window.location.hash, '#/2/0/1' );
|
assert.strictEqual( Reveal.getSlidePath(), '/2/0/1' );
|
||||||
|
|
||||||
Reveal.slide( 2, 2, -1 );
|
Reveal.slide( 2, 2, -1 );
|
||||||
assert.strictEqual( window.location.hash, '#/fragments3' );
|
assert.strictEqual( Reveal.getSlidePath(), '/fragments3' );
|
||||||
|
|
||||||
Reveal.slide( 2, 2, 1 );
|
Reveal.slide( 2, 2, 1 );
|
||||||
assert.strictEqual( window.location.hash, '#/fragments3/1' );
|
assert.strictEqual( Reveal.getSlidePath(), '/fragments3/1' );
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test( 'Read', async function( assert ) {
|
QUnit.test( 'Read', async function( assert ) {
|
||||||
|
|
Loading…
Reference in New Issue