diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/examples/slide-backgrounds.html | 32 | ||||
-rw-r--r-- | test/examples/slide-transitions.html | 101 | ||||
-rw-r--r-- | test/test-markdown-element-attributes.html | 6 | ||||
-rw-r--r-- | test/test-markdown-element-attributes.js | 2 | ||||
-rw-r--r-- | test/test.html | 6 | ||||
-rw-r--r-- | test/test.js | 34 |
6 files changed, 170 insertions, 11 deletions
diff --git a/test/examples/slide-backgrounds.html b/test/examples/slide-backgrounds.html index ba020cb..4e5e406 100644 --- a/test/examples/slide-backgrounds.html +++ b/test/examples/slide-backgrounds.html @@ -10,6 +10,16 @@ <link rel="stylesheet" href="../../css/reveal.css"> <link rel="stylesheet" href="../../css/theme/serif.css" id="theme"> + <style type="text/css" media="screen"> + .slides section.has-dark-background, + .slides section.has-dark-background h2 { + color: #fff; + } + .slides section.has-light-background, + .slides section.has-light-background h2 { + color: #222; + } + </style> </head> <body> @@ -26,6 +36,10 @@ <h2>data-background: #bb00bb</h2> </section> + <section data-background-color="lightblue"> + <h2>data-background: lightblue</h2> + </section> + <section> <section data-background="#ff0000"> <h2>data-background: #ff0000</h2> @@ -45,25 +59,25 @@ <section> <h2>Background applied to stack</h2> </section> - <section data-background="rgba(100, 0, 0, 0.2)"> + <section data-background="rgb(66, 66, 66)"> <h2>Background applied to slide inside of stack</h2> </section> </section> - <section data-background-transition="slide" data-background="assets/image1.png" style="background: rgba(255,255,255,0.9)"> + <section data-background-transition="slide" data-background="assets/image1.png"> <h2>Background image</h2> </section> <section> - <section data-background-transition="slide" data-background="assets/image1.png" style="background: rgba(255,255,255,0.9)"> + <section data-background-transition="slide" data-background="assets/image1.png"> <h2>Background image</h2> </section> - <section data-background-transition="slide" data-background="assets/image1.png" style="background: rgba(255,255,255,0.9)"> + <section data-background-transition="slide" data-background="assets/image1.png"> <h2>Background image</h2> </section> </section> - <section data-background="assets/image2.png" data-background-size="100px" data-background-repeat="repeat" data-background-color="#111" style="background: rgba(255,255,255,0.9)"> + <section data-background="assets/image2.png" data-background-size="100px" data-background-repeat="repeat" data-background-color="#111"> <h2>Background image</h2> <pre>data-background-size="100px" data-background-repeat="repeat" data-background-color="#111"</pre> </section> @@ -75,6 +89,14 @@ <h2>Same background twice (2/2)</h2> </section> + <section data-background-video="https://s3.amazonaws.com/static.slid.es/site/homepage/v1/homepage-video-editor.mp4,https://s3.amazonaws.com/static.slid.es/site/homepage/v1/homepage-video-editor.webm"> + <h2>Video background</h2> + </section> + + <section data-background-iframe="https://slides.com"> + <h2>Iframe background</h2> + </section> + <section> <section data-background="#417203"> <h2>Same background twice vertical (1/2)</h2> diff --git a/test/examples/slide-transitions.html b/test/examples/slide-transitions.html new file mode 100644 index 0000000..88119dc --- /dev/null +++ b/test/examples/slide-transitions.html @@ -0,0 +1,101 @@ +<!doctype html> +<html lang="en"> + + <head> + <meta charset="utf-8"> + + <title>reveal.js - Slide Transitions</title> + + <link rel="stylesheet" href="../../css/reveal.css"> + <link rel="stylesheet" href="../../css/theme/white.css" id="theme"> + <style type="text/css" media="screen"> + .slides section.has-dark-background, + .slides section.has-dark-background h3 { + color: #fff; + } + .slides section.has-light-background, + .slides section.has-light-background h3 { + color: #222; + } + </style> + </head> + + <body> + + <div class="reveal"> + + <div class="slides"> + + <section> + <h3>Default</h3> + </section> + + <section> + <h3>Default</h3> + </section> + + <section data-transition="zoom"> + <h3>data-transition: zoom</h3> + </section> + + <section data-transition="zoom-in fade-out"> + <h3>data-transition: zoom-in fade-out</h3> + </section> + + <section> + <h3>Default</h3> + </section> + + <section data-transition="convex"> + <h3>data-transition: convex</h3> + </section> + + <section data-transition="convex-in concave-out"> + <h3>data-transition: convex-in concave-out</h3> + </section> + + <section> + <section data-transition="zoom"> + <h3>Default</h3> + </section> + <section data-transition="concave"> + <h3>data-transition: concave</h3> + </section> + <section data-transition="convex-in fade-out"> + <h3>data-transition: convex-in fade-out</h3> + </section> + <section> + <h3>Default</h3> + </section> + </section> + + <section data-transition="none"> + <h3>data-transition: none</h3> + </section> + + <section> + <h3>Default</h3> + </section> + + </div> + + </div> + + <script src="../../lib/js/head.min.js"></script> + <script src="../../js/reveal.js"></script> + + <script> + + Reveal.initialize({ + center: true, + history: true, + + // transition: 'slide', + // transitionSpeed: 'slow', + // backgroundTransition: 'slide' + }); + + </script> + + </body> +</html> diff --git a/test/test-markdown-element-attributes.html b/test/test-markdown-element-attributes.html index 5dba085..6edf95e 100644 --- a/test/test-markdown-element-attributes.html +++ b/test/test-markdown-element-attributes.html @@ -38,9 +38,9 @@ Paragraph 2 <!-- {_class="fragment grow"} --> - - list item 1 <!-- {_class="fragment roll-in"} --> - - list item 2 <!-- {_class="fragment roll-in"} --> - - list item 3 <!-- {_class="fragment roll-in"} --> + - list item 1 <!-- {_class="fragment grow"} --> + - list item 2 <!-- {_class="fragment grow"} --> + - list item 3 <!-- {_class="fragment grow"} --> --- diff --git a/test/test-markdown-element-attributes.js b/test/test-markdown-element-attributes.js index 4541077..10a2503 100644 --- a/test/test-markdown-element-attributes.js +++ b/test/test-markdown-element-attributes.js @@ -19,7 +19,7 @@ Reveal.addEventListener( 'ready', function() { }); test( 'Attributes on element list items in vertical slides', function() { - strictEqual( document.querySelectorAll( '.reveal .slides section>section li.fragment.roll-in' ).length, 3, 'found a vertical slide with three list items with class fragment.roll-in' ); + strictEqual( document.querySelectorAll( '.reveal .slides section>section li.fragment.grow' ).length, 3, 'found a vertical slide with three list items with class fragment.grow' ); }); test( 'Attributes on element paragraphs in horizontal slides', function() { diff --git a/test/test.html b/test/test.html index 29d02a9..d08e4f0 100644 --- a/test/test.html +++ b/test/test.html @@ -22,10 +22,13 @@ <section data-background-image="examples/assets/image1.png"> <h1>1</h1> <img data-src="fake-url.png"> + <video data-src="fake-url.mp4"></video> + <audio data-src="fake-url.mp3"></audio> + <aside class="notes">speaker notes 1</aside> </section> <section> - <section data-background="examples/assets/image2.png"> + <section data-background="examples/assets/image2.png" data-notes="speaker notes 2"> <h1>2.1</h1> </section> <section> @@ -52,6 +55,7 @@ <li class="fragment" data-fragment-index="0">4.1</li> <li class="fragment" data-fragment-index="0">4.2</li> </ul> + <iframe data-src="http://example.com"></iframe> </section> <section> diff --git a/test/test.js b/test/test.js index 6c7270f..a96b70b 100644 --- a/test/test.js +++ b/test/test.js @@ -89,7 +89,7 @@ Reveal.addEventListener( 'ready', function() { test( 'Reveal.isLastSlide after vertical slide', function() { var lastSlideIndex = document.querySelectorAll( '.reveal .slides>section' ).length - 1; - + Reveal.slide( 1, 1 ); Reveal.slide( lastSlideIndex ); strictEqual( Reveal.isLastSlide(), true, 'true after Reveal.slide( 1, 1 ) and then Reveal.slide( '+ lastSlideIndex +', 0 )' ); @@ -139,6 +139,14 @@ Reveal.addEventListener( 'ready', function() { strictEqual( Reveal.getSlideBackground( 1, 100 ), undefined, 'undefined when out of vertical bounds' ); }); + test( 'Reveal.getSlideNotes', function() { + Reveal.slide( 0, 0 ); + ok( Reveal.getSlideNotes() === 'speaker notes 1', 'works with <aside class="notes">' ); + + Reveal.slide( 1, 0 ); + ok( Reveal.getSlideNotes() === 'speaker notes 2', 'works with <section data-notes="">' ); + }); + test( 'Reveal.getPreviousSlide/getCurrentSlide', function() { Reveal.slide( 0, 0 ); Reveal.slide( 1, 0 ); @@ -313,6 +321,13 @@ Reveal.addEventListener( 'ready', function() { Reveal.slide( 3, 0, 0 ); equal( fragmentSlide.querySelectorAll( '.fragment.visible' ).length, 2, 'both fragments of same index are shown' ); + + // This slide has three fragments, first one is index 0, second and third have index 1 + Reveal.slide( 2, 2, 0 ); + equal( Reveal.getIndices().f, 0, 'returns correct index for first fragment' ); + + Reveal.slide( 2, 2, 1 ); + equal( Reveal.getIndices().f, 1, 'returns correct index for two fragments with same index' ); }); test( 'Index generation', function() { @@ -488,6 +503,23 @@ Reveal.addEventListener( 'ready', function() { strictEqual( document.querySelectorAll( '.reveal section img[src]' ).length, 1, 'Image source has been set' ); }); + test( 'video with data-src', function() { + strictEqual( document.querySelectorAll( '.reveal section video[src]' ).length, 1, 'Video source has been set' ); + }); + + test( 'audio with data-src', function() { + strictEqual( document.querySelectorAll( '.reveal section audio[src]' ).length, 1, 'Audio source has been set' ); + }); + + test( 'iframe with data-src', function() { + Reveal.slide( 0, 0 ); + strictEqual( document.querySelectorAll( '.reveal section iframe[src]' ).length, 0, 'Iframe source is not set' ); + Reveal.slide( 2, 1 ); + strictEqual( document.querySelectorAll( '.reveal section iframe[src]' ).length, 1, 'Iframe source is set' ); + Reveal.slide( 2, 2 ); + strictEqual( document.querySelectorAll( '.reveal section iframe[src]' ).length, 0, 'Iframe source is not set' ); + }); + test( 'background images', function() { var imageSource1 = Reveal.getSlide( 0 ).getAttribute( 'data-background-image' ); var imageSource2 = Reveal.getSlide( 1, 0 ).getAttribute( 'data-background' ); |