additional fragment tests
This commit is contained in:
parent
0fb343f5bf
commit
0fcff33a61
20
test/test.js
20
test/test.js
@ -239,7 +239,7 @@ Reveal.addEventListener( 'ready', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test( 'Stepping past fragments', function() {
|
test( 'Stepping past fragments', function() {
|
||||||
var fragmentSlide = document.querySelector( '#fragment-slides>section:first-child' );
|
var fragmentSlide = document.querySelector( '#fragment-slides>section:nth-child(1)' );
|
||||||
|
|
||||||
Reveal.slide( 0, 0, 0 );
|
Reveal.slide( 0, 0, 0 );
|
||||||
equal( fragmentSlide.querySelectorAll( '.fragment.visible' ).length, 0, 'no fragments visible when on previous slide' );
|
equal( fragmentSlide.querySelectorAll( '.fragment.visible' ).length, 0, 'no fragments visible when on previous slide' );
|
||||||
@ -255,6 +255,24 @@ Reveal.addEventListener( 'ready', function() {
|
|||||||
equal( fragmentSlide.querySelectorAll( '.fragment.visible' ).length, 2, 'both fragments of same index are shown' );
|
equal( fragmentSlide.querySelectorAll( '.fragment.visible' ).length, 2, 'both fragments of same index are shown' );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test( 'Index generation', function() {
|
||||||
|
var fragmentSlide = document.querySelector( '#fragment-slides>section:nth-child(1)' );
|
||||||
|
|
||||||
|
// These have no indices defined to start with
|
||||||
|
equal( fragmentSlide.querySelectorAll( '.fragment' )[0].getAttribute( 'data-fragment-index' ), '0' );
|
||||||
|
equal( fragmentSlide.querySelectorAll( '.fragment' )[1].getAttribute( 'data-fragment-index' ), '1' );
|
||||||
|
equal( fragmentSlide.querySelectorAll( '.fragment' )[2].getAttribute( 'data-fragment-index' ), '2' );
|
||||||
|
});
|
||||||
|
|
||||||
|
test( 'Index normalization', function() {
|
||||||
|
var fragmentSlide = document.querySelector( '#fragment-slides>section:nth-child(3)' );
|
||||||
|
|
||||||
|
// These start out as 1-4-4 and should normalize to 0-1-1
|
||||||
|
equal( fragmentSlide.querySelectorAll( '.fragment' )[0].getAttribute( 'data-fragment-index' ), '0' );
|
||||||
|
equal( fragmentSlide.querySelectorAll( '.fragment' )[1].getAttribute( 'data-fragment-index' ), '1' );
|
||||||
|
equal( fragmentSlide.querySelectorAll( '.fragment' )[2].getAttribute( 'data-fragment-index' ), '1' );
|
||||||
|
});
|
||||||
|
|
||||||
asyncTest( 'fragmentshown event', function() {
|
asyncTest( 'fragmentshown event', function() {
|
||||||
expect( 2 );
|
expect( 2 );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user