Add unit test for default slide attributes separator pattern.

This commit is contained in:
VonC 2013-10-29 14:29:01 +01:00
parent 2cdd1afe85
commit 1774de2113
2 changed files with 44 additions and 1 deletions

View file

@ -51,6 +51,38 @@
## Slide 4
</script>
</section>
<section data-markdown data-separator="^\n\n\n"
data-vertical="^\n\n"
data-notes="^Note:"
data-charset="utf-8">
<script type="text/template">
# Test attributes in Markdown with default separator
## Slide 1 Def
## Slide 2 Def
<!-- slide-attributes: id="slide2def" data-transition="concave" data-background="#A7C66B" -->
## Slide 2.1 Def
<!-- slide-attributes: data-background="#f70000" data-transition="page" -->
## Slide 2.2 Def
[Link to Slide2](#/slide2def)
## Slide 3 Def
<!-- slide-attributes: data-transition="concave" data-background="#C7916B" -->
## Slide 4 ## Slide 4
</script> </script>
</section> </section>

View file

@ -5,7 +5,7 @@ Reveal.addEventListener( 'ready', function() {
QUnit.module( 'Markdown' ); QUnit.module( 'Markdown' );
test( 'Vertical separator', function() { test( 'Vertical separator', function() {
strictEqual( document.querySelectorAll( '.reveal .slides>section>section' ).length, 3, 'found three vertical slides' ); strictEqual( document.querySelectorAll( '.reveal .slides>section>section' ).length, 6, 'found six vertical slides' );
}); });
test( 'Id on slide', function() { test( 'Id on slide', function() {
@ -25,6 +25,17 @@ Reveal.addEventListener( 'ready', function() {
strictEqual( document.querySelectorAll( '.reveal .slides section [data-transition="zoom"]' ).length, 1, 'found one slide with data-transition="zoom"' ); strictEqual( document.querySelectorAll( '.reveal .slides section [data-transition="zoom"]' ).length, 1, 'found one slide with data-transition="zoom"' );
}); });
test( 'data-background attributes with default separator', function() {
strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-background="#A7C66B"]' ).length, 1, 'found one vertical slide with data-background="#A0C66B"' );
strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-background="#f70000"]' ).length, 1, 'found one vertical slide with data-background="#ff0000"' );
strictEqual( document.querySelectorAll( '.reveal .slides>section[data-background="#C7916B"]' ).length, 1, 'found one slide with data-background="#C6916B"' );
});
test( 'data-transition attributes with default separator', function() {
strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-transition="concave"]' ).length, 1, 'found one vertical slide with data-transition="zoom"' );
strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-transition="page"]' ).length, 1, 'found one vertical slide with data-transition="fade"' );
strictEqual( document.querySelectorAll( '.reveal .slides section [data-transition="concave"]' ).length, 1, 'found one slide with data-transition="zoom"' );
});
} ); } );
Reveal.initialize(); Reveal.initialize();