This commit is contained in:
bedaka 2021-10-13 20:30:24 +02:00
parent 077ce98e57
commit bd4f891f4b
33 changed files with 0 additions and 4060 deletions

View File

@ -1,476 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js The HTML Presentation Framework</title>
<meta name="description" content="A framework for easily creating beautiful presentations using HTML">
<meta name="author" content="Hakim El Hattab">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="dist/reset.css">
<link rel="stylesheet" href="dist/reveal.css">
<link rel="stylesheet" href="dist/theme/black.css" id="theme">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="plugin/highlight/monokai.css">
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<a href="https://revealjs.com">
<img src="https://static.slid.es/reveal/logo-v1/reveal-white-text.svg" alt="reveal.js logo" style="height: 180px; margin: 0 auto 4rem auto; background: transparent;" class="demo-logo">
</a>
<h3>The HTML Presentation Framework</h3>
<p>
<small>Created by <a href="http://hakim.se">Hakim El Hattab</a> and <a href="https://github.com/hakimel/reveal.js/graphs/contributors">contributors</a></small>
</p>
</section>
<section>
<h2>Hello There</h2>
<p>
reveal.js enables you to create beautiful interactive slide decks using HTML. This presentation will show you examples of what it can do.
</p>
</section>
<!-- Example of nested vertical slides -->
<section>
<section>
<h2>Vertical Slides</h2>
<p>Slides can be nested inside of each other.</p>
<p>Use the <em>Space</em> key to navigate through all slides.</p>
<br>
<a href="#" class="navigate-down">
<img class="r-frame" style="background: rgba(255,255,255,0.1);" width="178" height="238" data-src="https://static.slid.es/reveal/arrow.png" alt="Down arrow">
</a>
</section>
<section>
<h2>Basement Level 1</h2>
<p>Nested slides are useful for adding additional detail underneath a high level horizontal slide.</p>
</section>
<section>
<h2>Basement Level 2</h2>
<p>That's it, time to go back up.</p>
<br>
<a href="#/2">
<img class="r-frame" style="background: rgba(255,255,255,0.1); transform: rotate(180deg);" width="178" height="238" data-src="https://static.slid.es/reveal/arrow.png" alt="Up arrow">
</a>
</section>
</section>
<section>
<h2>Slides</h2>
<p>
Not a coder? Not a problem. There's a fully-featured visual editor for authoring these, try it out at <a href="https://slides.com" target="_blank">https://slides.com</a>.
</p>
</section>
<section data-visibility="hidden">
<h2>Hidden Slides</h2>
<p>
This slide is visible in the source, but hidden when the presentation is viewed. You can show all hidden slides by setting the `showHiddenSlides` config option to `true`.
</p>
</section>
<section data-auto-animate>
<h2 data-id="code-title">Pretty Code</h2>
<pre data-id="code-animation"><code class="hljs" data-trim data-line-numbers>
import React, { useState } from 'react';
function Example() {
const [count, setCount] = useState(0);
return (
...
);
}
</code></pre>
<p>Code syntax highlighting courtesy of <a href="https://highlightjs.org/usage/">highlight.js</a>.</p>
</section>
<section data-auto-animate>
<h2 data-id="code-title">With animations</h2>
<pre data-id="code-animation"><code class="hljs" data-trim data-line-numbers="|4,8-11|17|22-24"><script type="text/template">
import React, { useState } from 'react';
function Example() {
const [count, setCount] = useState(0);
return (
<div>
<p>You clicked {count} times</p>
<button onClick={() => setCount(count + 1)}>
Click me
</button>
</div>
);
}
function SecondExample() {
const [count, setCount] = useState(0);
return (
<div>
<p>You clicked {count} times</p>
<button onClick={() => setCount(count + 1)}>
Click me
</button>
</div>
);
}
</script></code></pre>
</section>
<section>
<h2>Point of View</h2>
<p>
Press <strong>ESC</strong> to enter the slide overview.
</p>
<p>
Hold down the <strong>alt</strong> key (<strong>ctrl</strong> in Linux) and click on any element to zoom towards it using <a href="http://lab.hakim.se/zoom-js">zoom.js</a>. Click again to zoom back out.
</p>
<p>
(NOTE: Use ctrl + click in Linux.)
</p>
</section>
<section data-auto-animate data-auto-animate-easing="cubic-bezier(0.770, 0.000, 0.175, 1.000)">
<h2>Auto-Animate</h2>
<p>Automatically animate matching elements across slides with <a href="https://revealjs.com/auto-animate/">Auto-Animate</a>.</p>
<div class="r-hstack justify-center">
<div data-id="box1" style="background: #999; width: 50px; height: 50px; margin: 10px; border-radius: 5px;"></div>
<div data-id="box2" style="background: #999; width: 50px; height: 50px; margin: 10px; border-radius: 5px;"></div>
<div data-id="box3" style="background: #999; width: 50px; height: 50px; margin: 10px; border-radius: 5px;"></div>
</div>
</section>
<section data-auto-animate data-auto-animate-easing="cubic-bezier(0.770, 0.000, 0.175, 1.000)">
<div class="r-hstack justify-center">
<div data-id="box1" data-auto-animate-delay="0" style="background: cyan; width: 150px; height: 100px; margin: 10px;"></div>
<div data-id="box2" data-auto-animate-delay="0.1" style="background: magenta; width: 150px; height: 100px; margin: 10px;"></div>
<div data-id="box3" data-auto-animate-delay="0.2" style="background: yellow; width: 150px; height: 100px; margin: 10px;"></div>
</div>
<h2 style="margin-top: 20px;">Auto-Animate</h2>
</section>
<section data-auto-animate data-auto-animate-easing="cubic-bezier(0.770, 0.000, 0.175, 1.000)">
<div class="r-stack">
<div data-id="box1" style="background: cyan; width: 300px; height: 300px; border-radius: 200px;"></div>
<div data-id="box2" style="background: magenta; width: 200px; height: 200px; border-radius: 200px;"></div>
<div data-id="box3" style="background: yellow; width: 100px; height: 100px; border-radius: 200px;"></div>
</div>
<h2 style="margin-top: 20px;">Auto-Animate</h2>
</section>
<section>
<h2>Touch Optimized</h2>
<p>
Presentations look great on touch devices, like mobile phones and tablets. Simply swipe through your slides.
</p>
</section>
<section data-markdown>
<script type="text/template">
## Markdown support
Write content using inline or external Markdown.
Instructions and more info available in the [docs](https://revealjs.com/markdown/).
```html []
<section data-markdown>
## Markdown support
Write content using inline or external Markdown.
Instructions and more info available in the [docs](https://revealjs.com/markdown/).
</section>
```
</script>
</section>
<section>
<p>Add the <code>r-fit-text</code> class to auto-size text</p>
<h2 class="r-fit-text">FIT TEXT</h2>
</section>
<section>
<section id="fragments">
<h2>Fragments</h2>
<p>Hit the next arrow...</p>
<p class="fragment">... to step through ...</p>
<p><span class="fragment">... a</span> <span class="fragment">fragmented</span> <span class="fragment">slide.</span></p>
<aside class="notes">
This slide has fragments which are also stepped through in the notes window.
</aside>
</section>
<section>
<h2>Fragment Styles</h2>
<p>There's different types of fragments, like:</p>
<p class="fragment grow">grow</p>
<p class="fragment shrink">shrink</p>
<p class="fragment fade-out">fade-out</p>
<p>
<span style="display: inline-block;" class="fragment fade-right">fade-right, </span>
<span style="display: inline-block;" class="fragment fade-up">up, </span>
<span style="display: inline-block;" class="fragment fade-down">down, </span>
<span style="display: inline-block;" class="fragment fade-left">left</span>
</p>
<p class="fragment fade-in-then-out">fade-in-then-out</p>
<p class="fragment fade-in-then-semi-out">fade-in-then-semi-out</p>
<p>Highlight <span class="fragment highlight-red">red</span> <span class="fragment highlight-blue">blue</span> <span class="fragment highlight-green">green</span></p>
</section>
</section>
<section id="transitions">
<h2>Transition Styles</h2>
<p>
You can select from different transitions, like: <br>
<a href="?transition=none#/transitions">None</a> -
<a href="?transition=fade#/transitions">Fade</a> -
<a href="?transition=slide#/transitions">Slide</a> -
<a href="?transition=convex#/transitions">Convex</a> -
<a href="?transition=concave#/transitions">Concave</a> -
<a href="?transition=zoom#/transitions">Zoom</a>
</p>
</section>
<section id="themes">
<h2>Themes</h2>
<p>
reveal.js comes with a few themes built in: <br>
<!-- Hacks to swap themes after the page has loaded. Not flexible and only intended for the reveal.js demo deck. -->
<a href="#" onclick="document.getElementById('theme').setAttribute('href','dist/theme/black.css'); return false;">Black (default)</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','dist/theme/white.css'); return false;">White</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','dist/theme/league.css'); return false;">League</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','dist/theme/sky.css'); return false;">Sky</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','dist/theme/beige.css'); return false;">Beige</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','dist/theme/simple.css'); return false;">Simple</a> <br>
<a href="#" onclick="document.getElementById('theme').setAttribute('href','dist/theme/serif.css'); return false;">Serif</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','dist/theme/blood.css'); return false;">Blood</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','dist/theme/night.css'); return false;">Night</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','dist/theme/moon.css'); return false;">Moon</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','dist/theme/solarized.css'); return false;">Solarized</a>
</p>
</section>
<section>
<section data-background="#dddddd">
<h2>Slide Backgrounds</h2>
<p>
Set <code>data-background="#dddddd"</code> on a slide to change the background color. All CSS color formats are supported.
</p>
<a href="#" class="navigate-down">
<img class="r-frame" style="background: rgba(255,255,255,0.1);" width="178" height="238" data-src="https://static.slid.es/reveal/arrow.png" alt="Down arrow">
</a>
</section>
<section data-background="https://static.slid.es/reveal/image-placeholder.png">
<h2>Image Backgrounds</h2>
<pre><code class="hljs html">&lt;section data-background="image.png"&gt;</code></pre>
</section>
<section data-background="https://static.slid.es/reveal/image-placeholder.png" data-background-repeat="repeat" data-background-size="100px">
<h2>Tiled Backgrounds</h2>
<pre><code class="hljs html" style="word-wrap: break-word;">&lt;section data-background="image.png" data-background-repeat="repeat" data-background-size="100px"&gt;</code></pre>
</section>
<section data-background-video="https://s3.amazonaws.com/static.slid.es/site/homepage/v1/homepage-video-editor.mp4" data-background-color="#000000">
<div style="background-color: rgba(0, 0, 0, 0.9); color: #fff; padding: 20px;">
<h2>Video Backgrounds</h2>
<pre><code class="hljs html" style="word-wrap: break-word;">&lt;section data-background-video="video.mp4,video.webm"&gt;</code></pre>
</div>
</section>
<section data-background="http://i.giphy.com/90F8aUepslB84.gif">
<h2>... and GIFs!</h2>
</section>
</section>
<section data-transition="slide" data-background="#4d7e65" data-background-transition="zoom">
<h2>Background Transitions</h2>
<p>
Different background transitions are available via the backgroundTransition option. This one's called "zoom".
</p>
<pre><code class="hljs javascript">Reveal.configure({ backgroundTransition: 'zoom' })</code></pre>
</section>
<section data-transition="slide" data-background="#b5533c" data-background-transition="zoom">
<h2>Background Transitions</h2>
<p>
You can override background transitions per-slide.
</p>
<pre><code class="hljs html" style="word-wrap: break-word;">&lt;section data-background-transition="zoom"&gt;</code></pre>
</section>
<section data-background-iframe="https://hakim.se" data-background-interactive>
<div style="position: absolute; width: 40%; right: 0; box-shadow: 0 1px 4px rgba(0,0,0,0.5), 0 5px 25px rgba(0,0,0,0.2); background-color: rgba(0, 0, 0, 0.9); color: #fff; padding: 20px; font-size: 20px; text-align: left;">
<h2>Iframe Backgrounds</h2>
<p>Since reveal.js runs on the web, you can easily embed other web content. Try interacting with the page in the background.</p>
</div>
</section>
<section>
<h2>Marvelous List</h2>
<ul>
<li>No order here</li>
<li>Or here</li>
<li>Or here</li>
<li>Or here</li>
</ul>
</section>
<section>
<h2>Fantastic Ordered List</h2>
<ol>
<li>One is smaller than...</li>
<li>Two is smaller than...</li>
<li>Three!</li>
</ol>
</section>
<section>
<h2>Tabular Tables</h2>
<table>
<thead>
<tr>
<th>Item</th>
<th>Value</th>
<th>Quantity</th>
</tr>
</thead>
<tbody>
<tr>
<td>Apples</td>
<td>$1</td>
<td>7</td>
</tr>
<tr>
<td>Lemonade</td>
<td>$2</td>
<td>18</td>
</tr>
<tr>
<td>Bread</td>
<td>$3</td>
<td>2</td>
</tr>
</tbody>
</table>
</section>
<section>
<h2>Clever Quotes</h2>
<p>
These guys come in two forms, inline: <q cite="http://searchservervirtualization.techtarget.com/definition/Our-Favorite-Technology-Quotations">The nice thing about standards is that there are so many to choose from</q> and block:
</p>
<blockquote cite="http://searchservervirtualization.techtarget.com/definition/Our-Favorite-Technology-Quotations">
&ldquo;For years there has been a theory that millions of monkeys typing at random on millions of typewriters would
reproduce the entire works of Shakespeare. The Internet has proven this theory to be untrue.&rdquo;
</blockquote>
</section>
<section>
<h2>Intergalactic Interconnections</h2>
<p>
You can link between slides internally,
<a href="#/2/3">like this</a>.
</p>
</section>
<section>
<h2>Speaker View</h2>
<p>There's a <a href="https://revealjs.com/speaker-view/">speaker view</a>. It includes a timer, preview of the upcoming slide as well as your speaker notes.</p>
<p>Press the <em>S</em> key to try it out.</p>
<aside class="notes">
Oh hey, these are some notes. They'll be hidden in your presentation, but you can see them if you open the speaker notes window (hit 's' on your keyboard).
</aside>
</section>
<section>
<h2>Export to PDF</h2>
<p>Presentations can be <a href="https://revealjs.com/pdf-export/">exported to PDF</a>, here's an example:</p>
<iframe data-src="https://www.slideshare.net/slideshow/embed_code/42840540" width="445" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:3px solid #666; margin-bottom:5px; max-width: 100%;" allowfullscreen> </iframe>
</section>
<section>
<h2>Global State</h2>
<p>
Set <code>data-state="something"</code> on a slide and <code>"something"</code>
will be added as a class to the document element when the slide is open. This lets you
apply broader style changes, like switching the page background.
</p>
</section>
<section data-state="customevent">
<h2>State Events</h2>
<p>
Additionally custom events can be triggered on a per slide basis by binding to the <code>data-state</code> name.
</p>
<pre><code class="javascript" data-trim contenteditable style="font-size: 18px;">
Reveal.on( 'customevent', function() {
console.log( '"customevent" has fired' );
} );
</code></pre>
</section>
<section>
<h2>Take a Moment</h2>
<p>
Press B or . on your keyboard to pause the presentation. This is helpful when you're on stage and want to take distracting slides off the screen.
</p>
</section>
<section>
<h2>Much more</h2>
<ul>
<li>Right-to-left support</li>
<li><a href="https://revealjs.com/api/">Extensive JavaScript API</a></li>
<li><a href="https://revealjs.com/auto-slide/">Auto-progression</a></li>
<li><a href="https://revealjs.com/backgrounds/#parallax-background">Parallax backgrounds</a></li>
<li><a href="https://revealjs.com/keyboard/">Custom keyboard bindings</a></li>
</ul>
</section>
<section style="text-align: left;">
<h1>THE END</h1>
<p>
- <a href="https://slides.com">Try the online editor</a> <br>
- <a href="https://github.com/hakimel/reveal.js">Source code &amp; documentation</a>
</p>
</section>
</div>
</div>
<script src="dist/reveal.js"></script>
<script src="plugin/zoom/zoom.js"></script>
<script src="plugin/notes/notes.js"></script>
<script src="plugin/search/search.js"></script>
<script src="plugin/markdown/markdown.js"></script>
<script src="plugin/highlight/highlight.js"></script>
<script>
// Also available as an ES module, see:
// https://revealjs.com/initialization/
Reveal.initialize({
controls: true,
progress: true,
center: true,
hash: true,
// Learn about plugins: https://revealjs.com/plugins/
plugins: [ RevealZoom, RevealNotes, RevealSearch, RevealMarkdown, RevealHighlight ]
});
</script>
</body>
</html>

View File

@ -1,2 +0,0 @@
Source: https://freesound.org/people/fennelliott/sounds/379419/
License: CC0 (public domain)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

View File

@ -1,194 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - Auto Animate</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../dist/theme/black.css" id="theme">
<link rel="stylesheet" href="../plugin/highlight/monokai.css">
</head>
<body>
<div class="reveal">
<div class="slides">
<section data-auto-animate data-auto-animate-unmatched="fade">
<h3>Auto-Animate Example</h3>
<p>This will fade out</p>
<img src="assets/image1.png" style="height: 100px;">
<pre data-id="code"><code data-line-numbers class="hljs" data-trim>
function Example() {
const [count, setCount] = useState(0);
}
</code></pre>
</section>
<section data-auto-animate data-auto-animate-unmatched="fade">
<h3>Auto-Animate Example</h3>
<p style="opacity: 0.2; margin-top: 100px;">This will fade out</p>
<p>This element is unmatched</p>
<img src="assets/image1.png" style="height: 150px;">
<pre data-id="code"><code data-line-numbers class="hljs" data-trim>
function Example() {
New line!
const [count, setCount] = useState(0);
}
</code></pre>
</section>
<section data-auto-animate>
<p data-id="text-props" style="background: #555; line-height: 1em; letter-spacing: 0em;">Line Height & Letter Spacing</p>
</section>
<section data-auto-animate>
<p data-id="text-props" style="background: #555; line-height: 3em; letter-spacing: 0.2em;">Line Height & Letter Spacing</p>
</section>
<section>
<section data-auto-animate>
<pre data-id="code"><code data-line-numbers class="hljs" data-trim>
import React, { useState } from 'react';
function Example() {
const [count, setCount] = useState(0);
return (
...
);
}
</code></pre>
</section>
<section data-auto-animate>
<pre data-id="code"><code data-line-numbers class="hljs" data-trim>
function Example() {
const [count, setCount] = useState(0);
return (
&lt;div&gt;
&lt;p&gt;You clicked {count} times&lt;/p&gt;
&lt;button onClick={() =&gt; setCount(count + 1)}&gt;
Click me
&lt;/button&gt;
&lt;/div&gt;
);
}
</code></pre>
</section>
<section data-auto-animate>
<pre data-id="code"><code data-line-numbers class="hljs" data-trim>
function Example() {
// A comment!
const [count, setCount] = useState(0);
return (
&lt;div&gt;
&lt;p&gt;You clicked {count} times&lt;/p&gt;
&lt;button onClick={() =&gt; setCount(count + 1)}&gt;
Click me
&lt;/button&gt;
&lt;/div&gt;
);
}
</code></pre>
</section>
</section>
<section>
<section data-auto-animate>
<h3>Swapping list items</h3>
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
</ul>
</section>
<section data-auto-animate>
<h3>Swapping list items</h3>
<ul>
<li>Two</li>
<li>One</li>
<li>Three</li>
</ul>
</section>
<section data-auto-animate>
<h3>Swapping list items</h3>
<ul>
<li>Two</li>
<li>Three</li>
<li>One</li>
</ul>
</section>
</section>
<section data-auto-animate style="height: 600px">
<h3 style="opacity: 0.3; font-size: 18px;">SLIDE 1</h2>
<h2 data-id="title" style="margin-top: 260px;">Animate Anything</h2>
<div data-id="1" style="background: white; position: absolute; top: 150px; left: 16%; width: 60px; height: 60px;"></div>
<div data-id="2" style="background: white; position: absolute; top: 150px; left: 36%; width: 60px; height: 60px;"></div>
<div data-id="3" style="background: white; position: absolute; top: 150px; left: 56%; width: 60px; height: 60px;"></div>
<div data-id="4" style="background: white; position: absolute; top: 150px; left: 76%; width: 60px; height: 60px;"></div>
</section>
<section data-auto-animate style="height: 600px">
<h3 style="opacity: 0.3; font-size: 18px;">SLIDE 2</h2>
<h2 data-id="title" style="margin-top: 500px">With Auto Animate</h2>
<div data-id="1" style="background: cyan; position: absolute; bottom: 190px; left: 16%; width: 60px; height: 60px;"></div>
<div data-id="2" style="background: magenta; position: absolute; bottom: 190px; left: 36%; width: 60px; height: 160px;"></div>
<div data-id="3" style="background: yellow; position: absolute; bottom: 190px; left: 56%; width: 60px; height: 260px;"></div>
<div data-id="4" style="background: red; position: absolute; bottom: 190px; left: 76%; width: 60px; height: 360px;"></div>
</section>
<section data-auto-animate style="height: 600px">
<h3 style="opacity: 0.3; font-size: 18px;">SLIDE 3</h2>
<h2 data-id="title" style="margin-top: 500px; opacity: 0;">With Auto Animate</h2>
<div data-id="1" style="background: cyan; position: absolute; top: 50%; left: 50%; width: 400px; height: 400px; margin: -200px 0 0 -200px; border-radius: 400px;"></div>
<div data-id="2" style="background: magenta; position: absolute; top: 50%; left: 50%; width: 300px; height: 300px; margin: -150px 0 0 -150px; border-radius: 400px;"></div>
<div data-id="3" style="background: yellow; position: absolute; top: 50%; left: 50%; width: 200px; height: 200px; margin: -100px 0 0 -100px; border-radius: 400px;"></div>
<div data-id="4" style="background: red; position: absolute; top: 50%; left: 50%; width: 100px; height: 100px; margin: -50px 0 0 -50px; border-radius: 400px;"></div>
</section>
<section data-auto-animate style="height: 600px">
<h3 style="opacity: 0.3; font-size: 18px;">SLIDE 3</h2>
<h2 data-id="title" style="margin-top: 500px; opacity: 0;">With Auto Animate</h2>
<div data-id="1" style="background: red; position: absolute; top: 250px; left: 16%; width: 60px; height: 60px;"></div>
<div data-id="2" style="background: yellow; position: absolute; top: 250px; left: 36%; width: 60px; height: 60px;"></div>
<div data-id="3" style="background: magenta; position: absolute; top: 250px; left: 56%; width: 60px; height: 60px;"></div>
<div data-id="4" style="background: cyan; position: absolute; top: 250px; left: 76%; width: 60px; height: 60px;"></div>
</section>
<section data-auto-animate data-auto-animate-id="a">
<h2>data-auto-animate-id="a"</h2>
<h3>A1</h3>
</section>
<section data-auto-animate data-auto-animate-id="a">
<h2>data-auto-animate-id="a"</h2>
<h3>A1</h3>
<h3>A2</h3>
</section>
<section data-auto-animate data-auto-animate-id="b">
<h2>data-auto-animate-id="b"</h2>
<h3>B1</h3>
</section>
<section data-auto-animate data-auto-animate-id="b">
<h2>data-auto-animate-id="b"</h2>
<h3>B1</h3>
<h3>B2</h3>
</section>
</div>
</div>
<script src="../dist/reveal.js"></script>
<script src="../plugin/highlight/highlight.js"></script>
<script>
Reveal.initialize({
center: true,
hash: true,
plugins: [ RevealHighlight ]
});
</script>
</body>
</html>

View File

@ -1,141 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - Slide Backgrounds</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../dist/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>
<div class="reveal">
<div class="slides">
<section data-background="#00ffff">
<h2>data-background: #00ffff</h2>
</section>
<section data-background="#bb00bb">
<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>
</section>
<section data-background="rgba(0, 0, 0, 0.2)">
<h2>data-background: rgba(0, 0, 0, 0.2)</h2>
</section>
<section data-background="salmon">
<h2>data-background: salmon</h2>
</section>
</section>
<section data-background="rgba(0, 100, 100, 0.2)">
<section>
<h2>Background applied to stack</h2>
</section>
<section>
<h2>Background applied to stack</h2>
</section>
<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">
<h2>Background image</h2>
</section>
<section>
<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">
<h2>Background image</h2>
</section>
</section>
<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>
<section data-background="#888888">
<h2>Same background twice (1/2)</h2>
</section>
<section data-background="#888888">
<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/news/make-better-presentations/embed?style=hidden&autoSlide=4000">
<h2>Iframe background</h2>
</section>
<section>
<section data-background="#417203">
<h2>Same background twice vertical (1/2)</h2>
</section>
<section data-background="#417203">
<h2>Same background twice vertical (2/2)</h2>
</section>
</section>
<section data-background="#934f4d">
<h2>Same background from horizontal to vertical (1/3)</h2>
</section>
<section>
<section data-background="#934f4d">
<h2>Same background from horizontal to vertical (2/3)</h2>
</section>
<section data-background="#934f4d">
<h2>Same background from horizontal to vertical (3/3)</h2>
</section>
</section>
</div>
</div>
<script src="../dist/reveal.js"></script>
<script>
// Full list of configuration options:
// https://revealjs.revealjs.com/config/
Reveal.initialize({
center: true,
transition: 'linear',
// transitionSpeed: 'slow',
// backgroundTransition: 'slide'
});
</script>
</body>
</html>

View File

@ -1,32 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - Barebones</title>
<link rel="stylesheet" href="../dist/reveal.css">
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<h2>Barebones Presentation</h2>
<p>This example contains the bare minimum includes and markup required to run a reveal.js presentation.</p>
</section>
<section>
<h2>No Theme</h2>
<p>There's no theme included, so it will fall back on browser defaults.</p>
</section>
</div>
</div>
<script src="../dist/reveal.js"></script>
<script>
Reveal.initialize();
</script>
</body>
</html>

View File

@ -1,160 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - Layout Helpers</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../dist/theme/white.css" id="theme">
<link rel="stylesheet" href="../plugin/highlight/monokai.css">
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<h2>Layout Helper Examples</h2>
<ul>
<li><a href="#/fit-text">Big Text</a></li>
<li><a href="#/stretch">Stretch</a></li>
<li><a href="#/stack">Stack</a></li>
<li><a href="#/hstack">HStack</a></li>
<li><a href="#/vstack">VStack</a></li>
</ul>
</section>
<section id="fit-text">
<h2>Fit Text</h2>
<p>Resizes text to be as large as possible within its container.</p>
<pre><code class="html" data-trim data-line-numbers>
<h2 class="r-fit-text">FIT</h2>
</code></pre>
</section>
<section>
<h2 class="r-fit-text">FIT</h2>
</section>
<section>
<h2 class="r-fit-text">HELLO WORLD</h2>
<h2 class="r-fit-text">BOTH THESE TITLES USE FIT-TEXT</h2>
</section>
<section id="stretch">
<h2>Stretch</h2>
<p>Makes an element as tall as possible while remaining within the slide bounds.</p>
<pre><code class="html" data-trim data-line-numbers>
<h2>Stretch Example</h2>
<img src="assets/image2.png" class="r-stretch">
<p>Image byline</p>
</code></pre>
</section>
<section>
<h2>Stretch Example</h2>
<img src="assets/image2.png" class="r-stretch">
<p>Image byline</p>
</section>
<section id="stack">
<h2>Stack</h2>
<p>Stacks multiple elements on top of each other, for use with fragments.</p>
<pre><code class="html" data-trim data-line-numbers>
<div class="r-stack">
&lt;img class="fragment" width="450" height="300" src="..."&gt;
&lt;img class="fragment" width="300" height="450" src="..."&gt;
&lt;img class="fragment" width="400" height="400" src="..."&gt;
</div>
</code></pre>
</section>
<section>
<h2>Stack Example</h2>
<div class="r-stack">
<p class="fragment fade-in-then-out">One</p>
<p class="fragment fade-in-then-out">Two</p>
<p class="fragment fade-in-then-out">Three</p>
<p class="fragment fade-in-then-out">Four</p>
</div>
<div class="r-stack">
<img src="https://placekitten.com/450/300" width="450" height="300" class="fragment">
<img src="https://placekitten.com/300/450" width="300" height="450" class="fragment">
<img src="https://placekitten.com/400/400" width="400" height="400" class="fragment">
</div>
</section>
<section>
<h2>Stack Example</h2>
<p>fade-in-then-out fragments</p>
<div class="r-stack">
<img src="https://placekitten.com/450/300" width="450" height="300" class="fragment fade-in-then-out">
<img src="https://placekitten.com/300/450" width="300" height="450" class="fragment fade-in-then-out">
<img src="https://placekitten.com/400/400" width="400" height="400" class="fragment fade-in-then-out">
</div>
</section>
<section id="hstack">
<h2>HStack</h2>
<p>Stacks multiple elements horizontally.</p>
<pre><code class="html" data-trim data-line-numbers>
<div class="r-hstack">
&lt;img width="450" height="300" src="..."&gt;
&lt;img width="300" height="450" src="..."&gt;
&lt;img width="400" height="400" src="..."&gt;
</div>
</code></pre>
</section>
<section data-auto-animate>
<h2>HStack Example</h2>
<div class="r-hstack">
<p style="padding: 0.50em; background: #eee; margin: 0.25em">One</p>
<p style="padding: 0.75em; background: #eee; margin: 0.25em">Two</p>
<p style="padding: 1.00em; background: #eee; margin: 0.25em">Three</p>
</div>
</section>
<section id="vstack">
<h2>VStack</h2>
<p>Stacks multiple elements horizontally.</p>
<pre><code class="html" data-trim data-line-numbers>
<div class="r-vstack">
&lt;img width="450" height="300" src="..."&gt;
&lt;img width="300" height="450" src="..."&gt;
&lt;img width="400" height="400" src="..."&gt;
</div>
</code></pre>
</section>
<section data-auto-animate>
<h2>VStack Example</h2>
<div class="r-vstack">
<p style="padding: 0.50em; background: #eee; margin: 0.25em">One</p>
<p style="padding: 0.75em; background: #eee; margin: 0.25em">Two</p>
<p style="padding: 1.00em; background: #eee; margin: 0.25em">Three</p>
</div>
</section>
</div>
</div>
<script src="../dist/reveal.js"></script>
<script src="../plugin/highlight/highlight.js"></script>
<script>
Reveal.initialize({
center: true,
hash: true,
plugins: [ RevealHighlight ]
});
</script>
</body>
</html>

View File

@ -1,131 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - Markdown Example</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../dist/theme/white.css" id="theme">
<link rel="stylesheet" href="../plugin/highlight/monokai.css">
</head>
<body>
<div class="reveal">
<div class="slides">
<!-- Use external markdown resource, separate slides by three newlines; vertical slides by two newlines -->
<section data-markdown="markdown.md" data-separator="^\n\n\n" data-separator-vertical="^\n\n"></section>
<!-- Slides are separated by three dashes (quick 'n dirty regular expression) -->
<section data-markdown data-separator="---">
<script type="text/template">
## Demo 1
Slide 1
---
## Demo 1
Slide 2
---
## Demo 1
Slide 3
</script>
</section>
<!-- Slides are separated by newline + three dashes + newline, vertical slides identical but two dashes -->
<section data-markdown data-separator="^\n---\n$" data-separator-vertical="^\n--\n$">
<script type="text/template">
## Demo 2
Slide 1.1
--
## Demo 2
Slide 1.2
---
## Demo 2
Slide 2
</script>
</section>
<!-- No "extra" slides, since there are no separators defined (so they'll become horizontal rulers) -->
<section data-markdown>
<script type="text/template">
A
---
B
---
C
</script>
</section>
<!-- Slide attributes -->
<section data-markdown>
<script type="text/template">
<!-- .slide: data-background="#000000" -->
## Slide attributes
</script>
</section>
<!-- Element attributes -->
<section data-markdown>
<script type="text/template">
## Element attributes
- Item 1 <!-- .element: class="fragment" data-fragment-index="2" -->
- Item 2 <!-- .element: class="fragment" data-fragment-index="1" -->
</script>
</section>
<!-- Code -->
<section data-markdown>
<script type="text/template">
```php [1|3-5]
public function foo()
{
$foo = array(
'bar' => 'bar'
)
}
```
</script>
</section>
<!-- Images -->
<section data-markdown>
<script type="text/template">
![Sample image](https://s3.amazonaws.com/static.slid.es/logo/v2/slides-symbol-512x512.png)
</script>
</section>
</div>
</div>
<script src="../dist/reveal.js"></script>
<script src="../plugin/markdown/markdown.js"></script>
<script src="../plugin/highlight/highlight.js"></script>
<script src="../plugin/notes/notes.js"></script>
<script>
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
plugins: [ RevealMarkdown, RevealHighlight, RevealNotes ]
});
</script>
</body>
</html>

View File

@ -1,36 +0,0 @@
# Markdown Demo
## External 1.1
Content 1.1
Note: This will only appear in the speaker notes window.
## External 1.2
Content 1.2
## External 2
Content 2.1
## External 3.1
Content 3.1
## External 3.2
Content 3.2
## External 3.3
![External Image](https://s3.amazonaws.com/static.slid.es/logo/v2/slides-symbol-512x512.png)

View File

@ -1,201 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - Math Plugin</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../dist/theme/night.css" id="theme">
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<h2>reveal.js Math Plugin</h2>
<p>A thin wrapper for MathJax</p>
</section>
<section>
<h3>The Lorenz Equations</h3>
\[\begin{aligned}
\dot{x} &amp; = \sigma(y-x) \\
\dot{y} &amp; = \rho x - y - xz \\
\dot{z} &amp; = -\beta z + xy
\end{aligned} \]
</section>
<section>
<h3>The Cauchy-Schwarz Inequality</h3>
<script type="math/tex; mode=display">
\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)
</script>
</section>
<section>
<h3>A Cross Product Formula</h3>
\[\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}
\mathbf{i} &amp; \mathbf{j} &amp; \mathbf{k} \\
\frac{\partial X}{\partial u} &amp; \frac{\partial Y}{\partial u} &amp; 0 \\
\frac{\partial X}{\partial v} &amp; \frac{\partial Y}{\partial v} &amp; 0
\end{vmatrix} \]
</section>
<section>
<h3>The probability of getting \(k\) heads when flipping \(n\) coins is</h3>
\[P(E) = {n \choose k} p^k (1-p)^{ n-k} \]
</section>
<section>
<h3>An Identity of Ramanujan</h3>
\[ \frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} =
1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}}
{1+\frac{e^{-8\pi}} {1+\ldots} } } } \]
</section>
<section>
<h3>A Rogers-Ramanujan Identity</h3>
\[ 1 + \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots =
\prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})}\]
</section>
<section>
<h3>Maxwell&#8217;s Equations</h3>
\[ \begin{aligned}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} &amp; = \frac{4\pi}{c}\vec{\mathbf{j}} \\ \nabla \cdot \vec{\mathbf{E}} &amp; = 4 \pi \rho \\
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} &amp; = \vec{\mathbf{0}} \\
\nabla \cdot \vec{\mathbf{B}} &amp; = 0 \end{aligned}
\]
</section>
<section>
<h3>TeX Macros</h3>
Here is a common vector space:
\[L^2(\R) = \set{u : \R \to \R}{\int_\R |u|^2 &lt; +\infty}\]
used in functional analysis.
</section>
<section>
<section>
<h3>The Lorenz Equations</h3>
<div class="fragment">
\[\begin{aligned}
\dot{x} &amp; = \sigma(y-x) \\
\dot{y} &amp; = \rho x - y - xz \\
\dot{z} &amp; = -\beta z + xy
\end{aligned} \]
</div>
</section>
<section>
<h3>The Cauchy-Schwarz Inequality</h3>
<div class="fragment">
\[ \left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right) \]
</div>
</section>
<section>
<h3>A Cross Product Formula</h3>
<div class="fragment">
\[\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}
\mathbf{i} &amp; \mathbf{j} &amp; \mathbf{k} \\
\frac{\partial X}{\partial u} &amp; \frac{\partial Y}{\partial u} &amp; 0 \\
\frac{\partial X}{\partial v} &amp; \frac{\partial Y}{\partial v} &amp; 0
\end{vmatrix} \]
</div>
</section>
<section>
<h3>The probability of getting \(k\) heads when flipping \(n\) coins is</h3>
<div class="fragment">
\[P(E) = {n \choose k} p^k (1-p)^{ n-k} \]
</div>
</section>
<section>
<h3>An Identity of Ramanujan</h3>
<div class="fragment">
\[ \frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} =
1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}}
{1+\frac{e^{-8\pi}} {1+\ldots} } } } \]
</div>
</section>
<section>
<h3>A Rogers-Ramanujan Identity</h3>
<div class="fragment">
\[ 1 + \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots =
\prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})}\]
</div>
</section>
<section>
<h3>Maxwell&#8217;s Equations</h3>
<div class="fragment">
\[ \begin{aligned}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} &amp; = \frac{4\pi}{c}\vec{\mathbf{j}} \\ \nabla \cdot \vec{\mathbf{E}} &amp; = 4 \pi \rho \\
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} &amp; = \vec{\mathbf{0}} \\
\nabla \cdot \vec{\mathbf{B}} &amp; = 0 \end{aligned}
\]
</div>
</section>
<section>
<h3>TeX Macros</h3>
Here is a common vector space:
\[L^2(\R) = \set{u : \R \to \R}{\int_\R |u|^2 &lt; +\infty}\]
used in functional analysis.
</section>
</section>
</div>
</div>
<script src="../dist/reveal.js"></script>
<script src="../plugin/math/math.js"></script>
<script>
Reveal.initialize({
history: true,
transition: 'linear',
math: {
// mathjax: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js',
config: 'TeX-AMS_HTML-full',
TeX: {
Macros: {
R: '\\mathbb{R}',
set: [ '\\left\\{#1 \\; ; \\; #2\\right\\}', 2 ]
}
}
},
plugins: [ RevealMath ]
});
</script>
</body>
</html>

View File

@ -1,75 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - Video, Audio and Iframes</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../dist/theme/white.css" id="theme">
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<h2>Examples of embedded Video, Audio and Iframes</h2>
</section>
<section>
<h2>Iframe</h2>
<iframe data-autoplay width="700" height="540" src="https://slides.com/news/auto-animate/embed" frameborder="0"></iframe>
</section>
<section data-background-iframe="https://www.youtube.com/embed/h1_nyI3z8gI" data-background-interactive>
<h2 style="color: #fff;">Iframe Background</h2>
</section>
<section>
<h2>Video</h2>
<video src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" data-autoplay></video>
</section>
<section data-background-video="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4">
<h2>Background Video</h2>
</section>
<section>
<h2>Auto-playing audio</h2>
<audio src="assets/beeping.wav" data-autoplay></audio>
</section>
<section>
<h2>Audio inside slide fragments</h2>
<div class="fragment">
Beep 1
<audio src="assets/beeping.wav" data-autoplay></audio>
</div>
<div class="fragment">
Beep 2
<audio src="assets/beeping.wav" data-autoplay></audio>
</div>
</section>
<section>
<h2>Audio with controls</h2>
<audio src="assets/beeping.wav" controls></audio>
</section>
</div>
</div>
<script src="../dist/reveal.js"></script>
<script>
Reveal.initialize({hash: true});
</script>
</body>
</html>

View File

@ -1,102 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - Multiple Presentations</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../dist/theme/white.css" id="theme">
<link rel="stylesheet" href="../plugin/highlight/monokai.css">
</head>
<body style="background: #ddd;">
<div style="display: flex; flex-direction: row;">
<div class="reveal deck1" style="width: 100%; height: 50vh; margin: 10px;">
<div class="slides">
<section>Deck 1, Slide 1</section>
<section>Deck 1, Slide 2</section>
<section>
<pre data-id="code-animation"><code class="hljs" data-trim data-line-numbers>
import React, { useState } from 'react';
function Example() {
const [count, setCount] = useState(0);
}
</code></pre>
</section>
</div>
</div>
<div class="reveal deck2" style="width: 100%; height: 50vh; margin: 10px;">
<div class="slides">
<section>Deck 2, Slide 1</section>
<section>Deck 2, Slide 2</section>
<section data-markdown>
<script type="text/template">
## Markdown plugin
- 1
- 2
- 3
</script>
</section>
<section>
<h3>The Lorenz Equations</h3>
\[\begin{aligned}
\dot{x} &amp; = \sigma(y-x) \\
\dot{y} &amp; = \rho x - y - xz \\
\dot{z} &amp; = -\beta z + xy
\end{aligned} \]
</section>
</div>
</div>
</div>
<style>
.reveal {
border: 4px solid #ccc;
}
.reveal.focused {
border-color: #94b5ff;
}
</style>
<script src="../dist/reveal.js"></script>
<script src="../plugin/highlight/highlight.js"></script>
<script src="../plugin/markdown/markdown.js"></script>
<script src="../plugin/math/math.js"></script>
<script>
let deck1 = new Reveal( document.querySelector( '.deck1' ), {
embedded: true,
progress: false,
keyboardCondition: 'focused',
plugins: [ RevealHighlight ]
} );
deck1.on( 'slidechanged', () => {
console.log( 'Deck 1 slide changed' );
} );
deck1.initialize();
let deck2 = new Reveal( document.querySelector( '.deck2' ), {
embedded: true,
progress: false,
keyboardCondition: 'focused',
plugins: [ RevealMarkdown, RevealMath ]
} );
deck2.initialize().then( () => {
deck2.slide(1);
} );
deck2.on( 'slidechanged', () => {
console.log( 'Deck 2 slide changed' );
} );
</script>
</body>
</html>

View File

@ -1,97 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - Slide Transitions</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../dist/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="../dist/reveal.js"></script>
<script>
Reveal.initialize({
center: true,
history: true,
// transition: 'slide',
// transitionSpeed: 'slow',
// backgroundTransition: 'slide'
});
</script>
</body>
</html>

View File

@ -1 +0,0 @@
window.externalScriptSequence += 'A';

View File

@ -1 +0,0 @@
window.externalScriptSequence += 'B';

View File

@ -1 +0,0 @@
window.externalScriptSequence += 'C';

View File

@ -1 +0,0 @@
window.externalScriptSequence += 'D';

View File

@ -1,12 +0,0 @@
## Slide 1.1
```js
var a = 1;
```
## Slide 1.2
## Slide 2

View File

@ -1,166 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - Test Auto-Animate</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div class="reveal">
<div class="slides">
<section data-auto-animate>
<h1>h1</h1>
<h2>h2</h2>
<h3 style="position: absolute; left: 0;">h3</h2>
</section>
<section data-auto-animate>
<h1 data-auto-animate-duration="0.1">h1</h1>
<h2 style="opacity: 0;">h2</h2>
<h3 style="position: absolute; left: 100px;">h3</h2>
</section>
<section data-auto-animate data-auto-animate-duration="0.1">
<h1>h1</h1>
<h2>h2</h2>
<h3>h3</h2>
</section>
<section>
<h1>Non-auto-animate slide</h1>
</section>
<section data-auto-animate>
<h1 class="fragment">h1</h1>
<h2 class="fragment">h2</h2>
<h3>h3</h3>
</section>
<section data-auto-animate>
<h1 class="fragment">h1</h1>
<h2 class="fragment">h2</h2>
<h3 class="fragment">h3</h3>
</section>
<section>
<h1>Non-auto-animate slide</h1>
</section>
</div>
</div>
<script src="../dist/reveal.js"></script>
<script>
QUnit.config.reorder = false;
const slides = Array.prototype.map.call( document.querySelectorAll( '.slides section' ), slide => {
return {
slide: slide,
h1: slide.querySelector( 'h1' ),
h2: slide.querySelector( 'h2' ),
h3: slide.querySelector( 'h3' )
};
} );
Reveal.initialize().then( async () => {
QUnit.module( 'Auto-Animate' );
QUnit.test( 'Adds data-auto-animate-target', assert => {
Reveal.slide(1);
assert.strictEqual( slides[0].h1.getAttribute( 'data-auto-animate-target' ), '', 'From elements have blank data-auto-animate-target' );
assert.ok( slides[1].h1.getAttribute( 'data-auto-animate-target' ).length > 0, 'To elements have a data-auto-animate-target value' );
});
QUnit.test( 'Ends on correct target styles', assert => {
Reveal.slide(1);
assert.strictEqual( slides[1].h2.style.opacity, "0" );
assert.strictEqual( slides[1].h3.offsetLeft, 100 );
});
QUnit.test( 'Does not add [data-auto-animate] on non auto-animated slides', assert => {
Reveal.slide(2);
Reveal.next();
assert.ok( slides[3].slide.hasAttribute( 'data-auto-animate' ) === false )
});
QUnit.test( 'autoAnimate config option', assert => {
Reveal.configure({ autoAnimate: false });
assert.ok( document.querySelectorAll( 'data-auto-animate-target' ).length === 0, 'Removes all [data-auto-animate-target]' )
assert.ok( Array.prototype.every.call( document.querySelectorAll( 'section[data-auto-animate]' ), el => {
return el.dataset.autoAnimate === '';
}, 'All data-auto-animate attributes are reset' ) );
Reveal.configure({ autoAnimate: true });
});
QUnit.test( 'Carries forward matching fragment visibility', assert => {
Reveal.slide(4);
assert.ok( !slides[5].h1.classList.contains( 'visible' ) )
Reveal.next();
Reveal.next();
Reveal.next();
assert.ok( slides[5].h1.classList.contains( 'visible' ) )
assert.ok( slides[5].h2.classList.contains( 'visible' ) )
assert.ok( !slides[5].h3.classList.contains( 'visible' ) )
Reveal.next();
assert.ok( slides[5].h3.classList.contains( 'visible' ) )
Reveal.next();
assert.ok( slides[6].slide === Reveal.getCurrentSlide() )
});
QUnit.test( 'Slide specific data-auto-animate-duration', assert => {
assert.timeout( 400 );
assert.expect( 1 );
return new Promise( resolve => {
let callback = () => {
slides[2].h3.removeEventListener( 'transitionend', callback );
assert.ok( true, 'Transition ended within time window' );
resolve();
}
Reveal.slide(1);
Reveal.slide(2);
slides[2].h3.addEventListener( 'transitionend', callback );
} );
});
// QUnit.test( 'Element specific data-auto-animate-duration', assert => {
// assert.timeout( 400 );
// assert.expect( 1 );
// return new Promise( resolve => {
// let callback = () => {
// slides[1].h1.removeEventListener( 'transitionend', callback );
// assert.ok( true, 'Transition ended within time window' );
// resolve()
// }
// Reveal.slide(1);
// slides[1].h1.addEventListener( 'transitionend', callback );
// } );
// });
} );
</script>
</body>
</html>

View File

@ -1,77 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - Test Async Dependencies</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div class="reveal" style="display: none;">
<div class="slides">
<section>Slide content</section>
</div>
</div>
<script src="../dist/reveal.js"></script>
<script>
var externalScriptSequence = '';
var scriptCount = 0;
QUnit.config.autostart = false;
QUnit.module( 'Async Dependencies' );
QUnit.test( 'Async scripts are loaded', function( assert ) {
assert.expect( 5 );
var done = assert.async( 5 );
function callback( event ) {
if( externalScriptSequence.length === 1 ) {
assert.ok( externalScriptSequence === 'A', 'first callback was sync script' );
done();
}
else {
assert.ok( true, 'async script loaded' );
done();
}
if( externalScriptSequence.length === 4 ) {
assert.ok( externalScriptSequence.indexOf( 'A' ) !== -1 &&
externalScriptSequence.indexOf( 'B' ) !== -1 &&
externalScriptSequence.indexOf( 'C' ) !== -1 &&
externalScriptSequence.indexOf( 'D' ) !== -1, 'four unique scripts were loaded' );
done();
}
scriptCount ++;
}
Reveal.initialize({
dependencies: [
{ src: 'assets/external-script-a.js', async: false, callback: callback },
{ src: 'assets/external-script-b.js', async: true, callback: callback },
{ src: 'assets/external-script-c.js', async: true, callback: callback },
{ src: 'assets/external-script-d.js', async: true, callback: callback }
]
});
});
QUnit.start();
</script>
</body>
</html>

View File

@ -1,51 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - Test Dependencies</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div class="reveal" style="display: none;">
<div class="slides">
<section>Slide content</section>
</div>
</div>
<script src="../dist/reveal.js"></script>
<script>
window.externalScriptSequence = '';
Reveal.initialize({
dependencies: [
{ src: 'assets/external-script-a.js' },
{ src: 'assets/external-script-b.js' },
{ src: 'assets/external-script-c.js' }
]
}).then( () => {
QUnit.module( 'Dependencies' );
QUnit.test( 'Load synchronous scripts', function( assert ) {
assert.strictEqual( window.externalScriptSequence, 'ABC', 'Loaded and executed in order' );
});
} );
</script>
</body>
</html>

View File

@ -1,71 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - Test Grid</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div class="reveal" style="display: none;">
<div class="slides">
<section>0</section>
<section>
<section>1.1</section>
<section>1.2</section>
<section>1.3</section>
<section>1.4</section>
</section>
<section>
<section>2.1</section>
<section>2.2</section>
<section>2.3</section>
<section>2.4</section>
</section>
</div>
</div>
<script src="../dist/reveal.js"></script>
<script>
Reveal.initialize().then( () => {
QUnit.module( 'Grid Navigation' );
QUnit.test( 'Disabled', function( assert ) {
Reveal.right();
Reveal.down();
Reveal.down();
assert.deepEqual( Reveal.getIndices(), { h: 1, v: 2, f: undefined }, 'Correct starting point' );
Reveal.right();
assert.deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: undefined }, 'Moves to top when going to adjacent stack' );
});
QUnit.test( 'Enabled', function( assert ) {
Reveal.configure({ navigationMode: 'grid' });
Reveal.slide( 0, 0 );
Reveal.right();
Reveal.down();
Reveal.down();
assert.deepEqual( Reveal.getIndices(), { h: 1, v: 2, f: undefined }, 'Correct starting point' );
Reveal.right();
assert.deepEqual( Reveal.getIndices(), { h: 2, v: 2, f: undefined }, 'Remains at same vertical index when going to adjacent stack' );
});
} );
</script>
</body>
</html>

View File

@ -1,98 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - Test Iframe Backgrounds</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div class="reveal" style="display: none;">
<div class="slides">
<section data-background-iframe="https://revealjs.com">1</section>
<section data-background-iframe="https://revealjs.com">2</section>
<section data-background-iframe="https://revealjs.com" data-preload>3</section>
<section data-background-iframe="https://revealjs.com">4</section>
<section data-background-iframe="https://revealjs.com">5</section>
<section data-background-iframe="https://revealjs.com">6</section>
</div>
</div>
<script src="../dist/reveal.js"></script>
<script>
Reveal.initialize({ viewDistance: 3 }).then( () => {
function getIframe( index ) {
return document.querySelectorAll( '.slide-background' )[index].querySelector( 'iframe' );
}
QUnit.module( 'Iframe' );
QUnit.test( 'Using default settings', function( assert ) {
Reveal.slide(0);
assert.strictEqual( getIframe(1).hasAttribute( 'src' ), false, 'not preloaded when within viewDistance' );
Reveal.slide(1);
assert.strictEqual( getIframe(1).hasAttribute( 'src' ), true, 'loaded when slide becomes visible' );
Reveal.slide(0);
assert.strictEqual( getIframe(1).hasAttribute( 'src' ), false, 'unloaded when slide becomes invisible' );
});
QUnit.test( 'Using data-preload', function( assert ) {
Reveal.slide(1);
assert.strictEqual( getIframe(2).hasAttribute( 'src' ), true, 'preloaded within viewDistance' );
assert.strictEqual( getIframe(1).hasAttribute( 'src' ), true, 'loaded when slide becomes visible' );
Reveal.slide(0);
assert.strictEqual( getIframe(3).hasAttribute( 'src' ), false, 'unloads outside of viewDistance' );
});
QUnit.test( 'Using preloadIframes: true', function( assert ) {
Reveal.configure({ preloadIframes: true });
Reveal.slide(1);
assert.strictEqual( getIframe(0).hasAttribute( 'src' ), true, 'preloaded within viewDistance' );
assert.strictEqual( getIframe(1).hasAttribute( 'src' ), true, 'preloaded within viewDistance' );
assert.strictEqual( getIframe(2).hasAttribute( 'src' ), true, 'preloaded within viewDistance' );
});
QUnit.test( 'Using preloadIframes: false', function( assert ) {
Reveal.configure({ preloadIframes: false });
Reveal.slide(0);
assert.strictEqual( getIframe(1).hasAttribute( 'src' ), false, 'not preloaded within viewDistance' );
assert.strictEqual( getIframe(2).hasAttribute( 'src' ), false, 'not preloaded within viewDistance' );
Reveal.slide(1);
assert.strictEqual( getIframe(1).hasAttribute( 'src' ), true, 'loaded when slide becomes visible' );
});
} );
</script>
</body>
</html>

View File

@ -1,102 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - Test Iframes</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div class="reveal" style="display: none;">
<div class="slides">
<section>1</section>
<section>2</section>
<section>
<iframe class="default-iframe" data-src="#"></iframe>
<iframe class="preload-iframe" data-src="#" data-preload></iframe>
</section>
</div>
</div>
<script src="../dist/reveal.js"></script>
<script>
Reveal.initialize({ viewDistance: 2 }).then( () => {
var defaultIframe = document.querySelector( '.default-iframe' ),
preloadIframe = document.querySelector( '.preload-iframe' );
QUnit.module( 'Iframe' );
QUnit.test( 'Using default settings', function( assert ) {
Reveal.slide(1);
assert.strictEqual( defaultIframe.hasAttribute( 'src' ), false, 'not preloaded when within viewDistance' );
Reveal.slide(2);
assert.strictEqual( defaultIframe.hasAttribute( 'src' ), true, 'loaded when slide becomes visible' );
Reveal.slide(1);
assert.strictEqual( defaultIframe.hasAttribute( 'src' ), false, 'unloaded when slide becomes invisible' );
});
QUnit.test( 'Using data-preload', function( assert ) {
Reveal.slide(1);
assert.strictEqual( preloadIframe.hasAttribute( 'src' ), true, 'preloaded within viewDistance' );
Reveal.slide(2);
assert.strictEqual( preloadIframe.hasAttribute( 'src' ), true, 'loaded when slide becoems visible' );
Reveal.slide(0);
assert.strictEqual( preloadIframe.hasAttribute( 'src' ), false, 'unloads outside of viewDistance' );
});
QUnit.test( 'Using preloadIframes: true', function( assert ) {
Reveal.configure({ preloadIframes: true });
Reveal.slide(1);
assert.strictEqual( defaultIframe.hasAttribute( 'src' ), true, 'preloaded within viewDistance' );
assert.strictEqual( preloadIframe.hasAttribute( 'src' ), true, 'preloaded within viewDistance' );
Reveal.slide(2);
assert.strictEqual( defaultIframe.hasAttribute( 'src' ), true, 'loaded when slide becomes visible' );
assert.strictEqual( preloadIframe.hasAttribute( 'src' ), true, 'loaded when slide becomes visible' );
});
QUnit.test( 'Using preloadIframes: false', function( assert ) {
Reveal.configure({ preloadIframes: false });
Reveal.slide(0);
assert.strictEqual( defaultIframe.hasAttribute( 'src' ), false, 'not preloaded within viewDistance' );
assert.strictEqual( preloadIframe.hasAttribute( 'src' ), false, 'not preloaded within viewDistance' );
Reveal.slide(2);
assert.strictEqual( defaultIframe.hasAttribute( 'src' ), true, 'loaded when slide becomes visible' );
assert.strictEqual( preloadIframe.hasAttribute( 'src' ), true, 'loaded when slide becomes visible' );
});
} );
</script>
</body>
</html>

View File

@ -1,480 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - Test Markdown</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div class="reveal deck1" style="display: none;">
<div class="slides">
<section data-markdown data-separator="^\n---\n$" data-separator-vertical="^\n--\n$">
<script type="text/template">
## Slide 1.1
--
## Slide 1.2
---
## Slide 2
</script>
</section>
</div>
</div>
<div class="reveal deck2" style="display: none;">
<div class="slides">
<section data-markdown="simple.md" data-separator="^\r?\n\r?\n\r?\n" data-separator-vertical="^\r?\n\r?\n"></section>
</div>
</div>
<div class="reveal deck3" style="display: none;">
<div class="slides">
<section data-markdown data-separator="^\n\n\n"
data-separator-vertical="^\n\n"
data-separator-notes="^Note:"
data-attributes="--\s(.*?)$"
data-charset="utf-8">
<script type="text/template">
# Test attributes in Markdown
## Slide 1
## Slide 2
<!-- -- id="slide2" data-transition="zoom" data-background="#A0C66B" -->
## Slide 2.1
<!-- -- data-background="#ff0000" data-transition="fade" -->
## Slide 2.2
[Link to Slide2](#/slide2)
## Slide 3
<!-- -- data-transition="zoom" data-background="#C6916B" -->
## Slide 4
</script>
</section>
<section data-markdown data-separator="^\n\n\n"
data-separator-vertical="^\n\n"
data-separator-notes="^Note:"
data-charset="utf-8">
<script type="text/template">
# Test attributes in Markdown with default separator
## Slide 1 Def
## Slide 2 Def
<!-- .slide: id="slide2def" data-transition="concave" data-background="#A7C66B" -->
## Slide 2.1 Def
<!-- .slide: data-background="#f70000" data-transition="page" -->
## Slide 2.2 Def
[Link to Slide2](#/slide2def)
## Slide 3 Def
<!-- .slide: data-transition="concave" data-background="#C7916B" -->
## Slide 4
</script>
</section>
<section data-markdown>
<script type="text/template">
<!-- .slide: data-background="#ff0000" -->
## Hello world
</script>
</section>
<section data-markdown>
<script type="text/template">
## Hello world
<!-- .slide: data-background="#ff0000" -->
</script>
</section>
<section data-markdown>
<script type="text/template">
## Hello world
Test
<!-- .slide: data-background="#ff0000" -->
More Test
</script>
</section>
</div>
</div>
<div class="reveal deck4" style="display: none;">
<div class="slides">
<section data-markdown>
<script type="text/template">
## Testing Markdown Options
This "slide" should contain 'smart' quotes.
</script>
</section>
</div>
</div>
<div class="reveal deck5" style="display: none;">
<div class="slides">
<section data-markdown data-separator="^\n---\n$" data-separator-vertical="^\n--\n$" data-element-attributes="{_\s*?([^}]+?)}">>
<script type="text/template">
## Slide 1.1
<!-- {_class="fragment fade-out" data-fragment-index="1"} -->
--
## Slide 1.2
<!-- {_class="fragment shrink"} -->
Paragraph 1
<!-- {_class="fragment grow"} -->
Paragraph 2
<!-- {_class="fragment grow"} -->
- list item 1 <!-- {_class="fragment grow"} -->
- list item 2 <!-- {_class="fragment grow"} -->
- list item 3 <!-- {_class="fragment grow"} -->
---
## Slide 2
Paragraph 1.2
multi-line <!-- {_class="fragment highlight-red"} -->
Paragraph 2.2 <!-- {_class="fragment highlight-red"} -->
Paragraph 2.3 <!-- {_class="fragment highlight-red"} -->
Paragraph 2.4 <!-- {_class="fragment highlight-red"} -->
- list item 1 <!-- {_class="fragment highlight-green"} -->
- list item 2<!-- {_class="fragment highlight-green"} -->
- list item 3<!-- {_class="fragment highlight-green"} -->
- list item 4
<!-- {_class="fragment highlight-green"} -->
- list item 5<!-- {_class="fragment highlight-green"} -->
Test
![Example Picture](examples/assets/image2.png) <!-- {_class="reveal stretch"} -->
</script>
</section>
<section data-markdown data-separator="^\n\n\n"
data-separator-vertical="^\n\n"
data-separator-notes="^Note:"
data-charset="utf-8">
<script type="text/template">
# Test attributes in Markdown with default separator
## Slide 1 Def <!-- .element: class="fragment highlight-red" data-fragment-index="1" -->
## Slide 2 Def
<!-- .element: class="fragment highlight-red" -->
</script>
</section>
<section data-markdown>
<script type="text/template">
## Hello world
A paragraph
<!-- .element: class="fragment highlight-blue" -->
</script>
</section>
<section data-markdown>
<script type="text/template">
## Hello world
Multiple
Line
<!-- .element: class="fragment highlight-blue" -->
</script>
</section>
<section data-markdown>
<script type="text/template">
## Hello world
Test<!-- .element: class="fragment highlight-blue" -->
More Test
</script>
</section>
</div>
</div>
<div class="reveal deck6" style="display: block;">
<div class="slides">
<section data-markdown class="defaults">
<script type="text/template">
```
code
```
</script>
</section>
<section data-markdown class="with-language">
<script type="text/template">
```javascript
code
```
</script>
</section>
<section data-markdown class="with-line-numbers">
<script type="text/template">
```[]
code
```
</script>
</section>
<section data-markdown class="with-line-highlights">
<script type="text/template">
```[1,2,3]
code
```
</script>
</section>
<section data-markdown class="with-line-highlights-and-lanugage">
<script type="text/template">
```javascript [1,2,3]
code
```
</script>
</section>
<section data-markdown class="with-code-in-fragment">
<script type="text/template">
```js
foo.bar();
```
<!-- .element: class="fragment" -->
</script>
</section>
</div>
</div>
<script type="module">
import Reveal from '../dist/reveal.esm.js'
import Markdown from '../plugin/markdown/markdown.esm.js'
import Highlight from '../plugin/highlight/highlight.esm.js'
let deck1 = new Reveal( document.querySelector( '.deck1' ), { plugins: [ Markdown ] })
deck1.addEventListener( 'ready', function() {
QUnit.module( 'Inline' );
QUnit.test( 'Vertical separator', function( assert ) {
assert.strictEqual( deck1.getRevealElement().querySelectorAll( '.reveal .slides>section>section' ).length, 2, 'found two slides' );
});
QUnit.test( 'Horizontal separator', function( assert ) {
assert.strictEqual( deck1.getRevealElement().querySelectorAll( '.reveal .slides>section' ).length, 2, 'found two slides' );
});
} );
let deck2 = new Reveal( document.querySelector( '.deck2' ), { plugins: [ Markdown ] })
deck2.addEventListener( 'ready', function() {
QUnit.module( 'External' );
QUnit.test( 'Vertical separator', function( assert ) {
assert.strictEqual( deck2.getRevealElement().querySelectorAll( '.reveal .slides>section>section' ).length, 2, 'found two slides' );
});
QUnit.test( 'Horizontal separator', function( assert ) {
assert.strictEqual( deck2.getRevealElement().querySelectorAll( '.reveal .slides>section' ).length, 2, 'found two slides' );
});
} );
let deck3 = new Reveal( document.querySelector( '.deck3' ), { plugins: [ Markdown ] })
deck3.addEventListener( 'ready', function() {
QUnit.module( 'Slide Attributes' );
QUnit.test( 'Id on slide', function( assert ) {
assert.strictEqual( deck3.getRevealElement().querySelectorAll( '.reveal .slides>section>section#slide2' ).length, 1, 'found one slide with id slide2' );
assert.strictEqual( deck3.getRevealElement().querySelectorAll( '.reveal .slides>section>section a[href="#/slide2"]' ).length, 1, 'found one slide with a link to slide2' );
});
QUnit.test( 'data-background attributes', function( assert ) {
assert.strictEqual( deck3.getRevealElement().querySelectorAll( '.reveal .slides>section>section[data-background="#A0C66B"]' ).length, 1, 'found one vertical slide with data-background="#A0C66B"' );
assert.strictEqual( deck3.getRevealElement().querySelectorAll( '.reveal .slides>section>section[data-background="#ff0000"]' ).length, 1, 'found one vertical slide with data-background="#ff0000"' );
assert.strictEqual( deck3.getRevealElement().querySelectorAll( '.reveal .slides>section[data-background="#C6916B"]' ).length, 1, 'found one slide with data-background="#C6916B"' );
});
QUnit.test( 'data-transition attributes', function( assert ) {
assert.strictEqual( deck3.getRevealElement().querySelectorAll( '.reveal .slides>section>section[data-transition="zoom"]' ).length, 1, 'found one vertical slide with data-transition="zoom"' );
assert.strictEqual( deck3.getRevealElement().querySelectorAll( '.reveal .slides>section>section[data-transition="fade"]' ).length, 1, 'found one vertical slide with data-transition="fade"' );
assert.strictEqual( deck3.getRevealElement().querySelectorAll( '.reveal .slides section [data-transition="zoom"]' ).length, 1, 'found one slide with data-transition="zoom"' );
});
QUnit.test( 'data-background attributes with default separator', function( assert ) {
assert.strictEqual( deck3.getRevealElement().querySelectorAll( '.reveal .slides>section>section[data-background="#A7C66B"]' ).length, 1, 'found one vertical slide with data-background="#A0C66B"' );
assert.strictEqual( deck3.getRevealElement().querySelectorAll( '.reveal .slides>section>section[data-background="#f70000"]' ).length, 1, 'found one vertical slide with data-background="#ff0000"' );
assert.strictEqual( deck3.getRevealElement().querySelectorAll( '.reveal .slides>section[data-background="#C7916B"]' ).length, 1, 'found one slide with data-background="#C6916B"' );
});
QUnit.test( 'data-transition attributes with default separator', function( assert ) {
assert.strictEqual( deck3.getRevealElement().querySelectorAll( '.reveal .slides>section>section[data-transition="concave"]' ).length, 1, 'found one vertical slide with data-transition="zoom"' );
assert.strictEqual( deck3.getRevealElement().querySelectorAll( '.reveal .slides>section>section[data-transition="page"]' ).length, 1, 'found one vertical slide with data-transition="fade"' );
assert.strictEqual( deck3.getRevealElement().querySelectorAll( '.reveal .slides section [data-transition="concave"]' ).length, 1, 'found one slide with data-transition="zoom"' );
});
QUnit.test( 'data-transition attributes with inline content', function( assert ) {
assert.strictEqual( deck3.getRevealElement().querySelectorAll( '.reveal .slides>section[data-background="#ff0000"]' ).length, 3, 'found three horizontal slides with data-background="#ff0000"' );
});
} );
let deck4 = new Reveal( document.querySelector( '.deck4' ), {
markdown: {
smartypants: true
},
plugins: [ Markdown ]
})
deck4.addEventListener( 'ready', function() {
QUnit.module( 'Options' );
QUnit.test( 'Options are set', function( assert ) {
assert.strictEqual( deck4.getPlugin( 'markdown' ).marked.defaults.smartypants, true );
});
QUnit.test( 'Smart quotes are activated', function( assert ) {
var text = deck4.getRevealElement().querySelector( '.reveal .slides>section>p' ).textContent;
assert.strictEqual( /['"]/.test( text ), false );
assert.strictEqual( /[“”‘’]/.test( text ), true );
});
} );
let deck5 = new Reveal( document.querySelector( '.deck5' ), { plugins: [ Markdown ] })
deck5.addEventListener( 'ready', function() {
QUnit.module( 'Element Attributes' );
QUnit.test( 'Vertical separator', function( assert ) {
assert.strictEqual( deck5.getRevealElement().querySelectorAll( '.reveal .slides>section>section' ).length, 4, 'found four slides' );
});
QUnit.test( 'Attributes on element header in vertical slides', function( assert ) {
assert.strictEqual( deck5.getRevealElement().querySelectorAll( '.reveal .slides section>section h2.fragment.fade-out' ).length, 1, 'found one vertical slide with class fragment.fade-out on header' );
assert.strictEqual( deck5.getRevealElement().querySelectorAll( '.reveal .slides section>section h2.fragment.shrink' ).length, 1, 'found one vertical slide with class fragment.shrink on header' );
});
QUnit.test( 'Attributes on element paragraphs in vertical slides', function( assert ) {
assert.strictEqual( deck5.getRevealElement().querySelectorAll( '.reveal .slides section>section p.fragment.grow' ).length, 2, 'found a vertical slide with two paragraphs with class fragment.grow' );
});
QUnit.test( 'Attributes on element list items in vertical slides', function( assert ) {
assert.strictEqual( deck5.getRevealElement().querySelectorAll( '.reveal .slides section>section li.fragment.grow' ).length, 3, 'found a vertical slide with three list items with class fragment.grow' );
});
QUnit.test( 'Attributes on element paragraphs in horizontal slides', function( assert ) {
assert.strictEqual( deck5.getRevealElement().querySelectorAll( '.reveal .slides section p.fragment.highlight-red' ).length, 4, 'found a horizontal slide with four paragraphs with class fragment.grow' );
});
QUnit.test( 'Attributes on element list items in horizontal slides', function( assert ) {
assert.strictEqual( deck5.getRevealElement().querySelectorAll( '.reveal .slides section li.fragment.highlight-green' ).length, 5, 'found a horizontal slide with five list items with class fragment.roll-in' );
});
QUnit.test( 'Attributes on element image in horizontal slides', function( assert ) {
assert.strictEqual( deck5.getRevealElement().querySelectorAll( '.reveal .slides section img.reveal.stretch' ).length, 1, 'found a horizontal slide with stretched image, class img.reveal.stretch' );
});
QUnit.test( 'Attributes on elements in vertical slides with default element attribute separator', function( assert ) {
assert.strictEqual( deck5.getRevealElement().querySelectorAll( '.reveal .slides section h2.fragment.highlight-red' ).length, 2, 'found two h2 titles with fragment highlight-red in vertical slides with default element attribute separator' );
});
QUnit.test( 'Attributes on elements in single slides with default element attribute separator', function( assert ) {
assert.strictEqual( deck5.getRevealElement().querySelectorAll( '.reveal .slides section p.fragment.highlight-blue' ).length, 3, 'found three elements with fragment highlight-blue in single slide with default element attribute separator' );
});
} );
let deck6 = new Reveal( document.querySelector( '.deck6' ), {
plugins: [ Markdown, Highlight ]
})
deck6.addEventListener( 'ready', function() {
QUnit.module( 'Code Blocks' );
QUnit.test( 'Defaults to no line numbers', function( assert ) {
assert.strictEqual( deck6.getRevealElement().querySelectorAll( '.defaults .hljs:not([data-line-numbers])' ).length, 1 );
});
QUnit.test( 'Can set language', function( assert ) {
assert.strictEqual( deck6.getRevealElement().querySelectorAll( '.with-language .hljs.javascript:not([data-line-numbers])' ).length, 1 );
});
QUnit.test( '```[] enables line numbers', function( assert ) {
assert.strictEqual( deck6.getRevealElement().querySelectorAll( '.with-line-numbers .hljs[data-line-numbers=""]' ).length, 1 );
});
QUnit.test( '```[1,2,3] enables line highlights', function( assert ) {
assert.strictEqual( deck6.getRevealElement().querySelectorAll( '.with-line-highlights .hljs[data-line-numbers="1,2,3"]' ).length, 1 );
});
QUnit.test( '```javascript [1,2,3] enables line highlights and sets language', function( assert ) {
assert.strictEqual( deck6.getRevealElement().querySelectorAll( '.with-line-highlights-and-lanugage .hljs.javascript[data-line-numbers="1,2,3"]' ).length, 1 );
});
QUnit.test( '```block should allow custom fragment', function( assert ) {
assert.strictEqual( deck6.getRevealElement().querySelectorAll( '.with-code-in-fragment pre.fragment' ).length, 1 );
});
} );
deck1.initialize();
deck2.initialize();
deck3.initialize();
deck4.initialize();
deck5.initialize();
deck6.initialize();
</script>
</body>
</html>

View File

@ -1,85 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - Test Iframes</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div class="deck1">
<div class="reveal" style="display: none;">
<div class="slides">
<section>1.1</section>
<section>1.2</section>
<section>1.3</section>
</div>
</div>
</div>
<div class="deck2">
<div class="reveal" style="display: none;">
<div class="slides">
<section>2.1</section>
<section>2.2</section>
<section>2.3</section>
</div>
</div>
</div>
<script src="../dist/reveal.js"></script>
<script src="../plugin/zoom/zoom.js"></script>
<script>
QUnit.module( 'Multiple reveal.js instances' );
let r1 = new Reveal( document.querySelector( '.deck1 .reveal' ), {
embedded: true,
keyboard: true,
plugins: [RevealZoom()]
} );
r1.initialize();
let r2 = new Reveal( document.querySelector( '.deck2 .reveal' ), {
embedded: true,
keyboard: false
} );
r2.initialize();
QUnit.test( 'Can make independent changes', function( assert ) {
r1.slide(1);
r2.slide(2);
assert.strictEqual( r1.getCurrentSlide().textContent, '1.2' );
assert.strictEqual( r2.getCurrentSlide().textContent, '2.3' );
r2.toggleOverview( true );
assert.strictEqual( r1.isOverview(), false );
assert.strictEqual( r2.isOverview(), true );
r2.toggleOverview( false );
assert.strictEqual( r1.getConfig().keyboard, true );
assert.strictEqual( r2.getConfig().keyboard, false );
});
QUnit.test( 'Can register plugins independently', function( assert ) {
assert.ok( r1.hasPlugin( 'zoom' ) );
assert.notOk( r2.hasPlugin( 'zoom' ) );
});
</script>
</body>
</html>

View File

@ -1,103 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - Test Iframes</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div class="deck1">
<div class="reveal" style="display: none;">
<div class="slides">
<section>1.1</section>
<section data-state="deck1slide2">1.2</section>
<section>1.3</section>
</div>
</div>
</div>
<div class="deck2">
<div class="reveal" style="display: none;">
<div class="slides">
<section>2.1</section>
<section>2.2</section>
<section>2.3</section>
</div>
</div>
</div>
<script type="module">
import Reveal from '../dist/reveal.esm.js';
import Zoom from '../plugin/zoom/zoom.esm.js';
QUnit.module( 'Multiple reveal.js instances' );
let r1 = new Reveal( document.querySelector( '.deck1 .reveal' ), {
embedded: true,
keyboard: true,
plugins: [ Zoom ]
} );
r1.initialize();
let r2 = new Reveal( document.querySelector( '.deck2 .reveal' ), {
embedded: true,
keyboard: false
} );
r2.initialize();
QUnit.test( 'Can make independent changes', function( assert ) {
r1.slide(1);
r2.slide(2);
assert.strictEqual( r1.getCurrentSlide().textContent, '1.2' );
assert.strictEqual( r2.getCurrentSlide().textContent, '2.3' );
r2.toggleOverview( true );
assert.strictEqual( r1.isOverview(), false );
assert.strictEqual( r2.isOverview(), true );
r2.toggleOverview( false );
assert.strictEqual( r1.getConfig().keyboard, true );
assert.strictEqual( r2.getConfig().keyboard, false );
});
QUnit.test( 'Can register plugins independently', function( assert ) {
assert.ok( r1.hasPlugin( 'zoom' ) );
assert.notOk( r2.hasPlugin( 'zoom' ) );
});
QUnit.test( 'Slide state is set at the viewport level', function( assert ) {
r1.slide(1);
assert.ok( r1.getViewportElement().classList.contains( r1.getCurrentSlide().getAttribute( 'data-state' ) ) );
r1.slide(2);
assert.ok( !r1.getViewportElement().classList.contains( r1.getCurrentSlide().getAttribute( 'data-state' ) ), 'unset' );
});
</script>
<script>
QUnit.test( 'Reveal does not leak to window', function( assert ) {
assert.strictEqual( window.Reveal, undefined );
});
</script>
</body>
</html>

View File

@ -1,92 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - Test PDF exports</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div class="reveal" style="display: none;">
<div class="slides">
<section>
<h1>1</h1>
<img data-src="">
</section>
<section>
<section>
<h1>2.1</h1>
</section>
<section>
<h1>2.2</h1>
</section>
<section>
<h1>2.3</h1>
</section>
</section>
<section id="fragment-slides">
<section>
<h1>3.1</h1>
<ul>
<li class="fragment">4.1</li>
<li class="fragment">4.2</li>
<li class="fragment">4.3</li>
</ul>
</section>
<section>
<h1>3.2</h1>
<ul>
<li class="fragment" data-fragment-index="0">4.1</li>
<li class="fragment" data-fragment-index="0">4.2</li>
</ul>
</section>
<section>
<h1>3.3</h1>
<ul>
<li class="fragment" data-fragment-index="1">3.3.1</li>
<li class="fragment" data-fragment-index="4">3.3.2</li>
<li class="fragment" data-fragment-index="4">3.3.3</li>
</ul>
</section>
</section>
<section>
<h1>4</h1>
</section>
</div>
</div>
<script src="../dist/reveal.js"></script>
<script>
Reveal.initialize({ pdf: true }).then( function() {
// Only one test for now, we're mainly ensuring that there
// are no execution errors when running PDF mode
QUnit.test( 'Reveal.isReady', function( assert ) {
assert.strictEqual( Reveal.isReady(), true, 'returns true' );
});
} );
</script>
</body>
</html>

View File

@ -1,107 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - Test Plugins</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div class="reveal" style="display: none;">
<div class="slides">
<section>Slide content</section>
</div>
</div>
<script src="../dist/reveal.js"></script>
<script>
QUnit.module( 'Plugins' );
var initCounter = { PluginB: 0, PluginC: 0, PluginD: 0 };
// Plugin with no init method
var PluginA = { id: 'PluginA' };
// Plugin with init method
var PluginB = { id: 'PluginB', init: function() {
initCounter['PluginB'] += 1;
} };
// Async plugin with init method
var PluginC = { id: 'PluginC', init: function() {
return new Promise(function( resolve ) {
setTimeout( () => {
initCounter['PluginC'] += 1;
resolve();
}, 1000 );
});
} };
// Plugin initialized after reveal.js is ready
var PluginD = { id: 'PluginD', init: function() {
initCounter['PluginD'] += 1;
} };
var PluginE = { id: 'PluginE' };
var reveal = new Reveal( document.querySelector( '.reveal' ), {
plugins: [ PluginA ]
} );
reveal.registerPlugin( PluginB );
reveal.registerPlugin( PluginC );
reveal.initialize();
QUnit.test( 'Can initialize synchronously', function( assert ) {
assert.strictEqual( initCounter['PluginB'], 1 );
reveal.registerPlugin( PluginB );
assert.strictEqual( initCounter['PluginB'], 1, 'prevents duplicate registration' );
});
QUnit.test( 'Can initialize asynchronously', function( assert ) {
assert.expect( 3 );
var done = assert.async( 2 );
assert.strictEqual( initCounter['PluginC'], 0, 'async plugin not immediately initialized' );
reveal.on( 'ready', function() {
assert.strictEqual( initCounter['PluginC'], 1, 'finsihed initializing when reveal.js dispatches "ready"' );
done();
reveal.registerPlugin( PluginD );
assert.strictEqual( initCounter['PluginD'], 1, 'plugin registered after reveal.js is ready still initiailizes' );
done();
});
} );
QUnit.test( 'Can check if plugin is registered', function( assert ) {
assert.strictEqual( reveal.hasPlugin( 'PluginA' ), true );
assert.strictEqual( reveal.hasPlugin( 'PluginE' ), false );
reveal.registerPlugin( PluginE );
assert.strictEqual( reveal.hasPlugin( 'PluginE' ), true );
} );
QUnit.test( 'Can retrieve plugin instance', function( assert ) {
assert.strictEqual( reveal.getPlugin( 'PluginB' ), PluginB );
} );
</script>
</body>
</html>

View File

@ -1,136 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - Test State</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div class="reveal" style="display: none;">
<div class="slides">
<section>No state</section>
<section id="slide2" data-state="state1">State 1</section>
<section data-state="state1">State 1</section>
<section data-state="state2">State 2</section>
<section>
<section>No state</section>
<section data-state="state1">State 1</section>
<section data-state="state3">State 3</section>
<section>No state</section>
</section>
<section>No state</section>
</div>
</div>
<script src="../dist/reveal.js"></script>
<script>
Reveal.initialize().then( function() {
console.log(Reveal);
QUnit.module( 'State' );
QUnit.test( 'Fire events when changing slide', function( assert ) {
assert.expect( 2 );
var state1 = assert.async();
var state2 = assert.async();
var _onState1 = function( event ) {
assert.ok( true, 'state1 fired' );
state1();
}
var _onState2 = function( event ) {
assert.ok( true, 'state2 fired' );
state2();
}
Reveal.on( 'state1', _onState1 );
Reveal.on( 'state2', _onState2 );
Reveal.slide( 1 );
Reveal.slide( 3 );
Reveal.off( 'state1', _onState1 );
Reveal.off( 'state2', _onState2 );
});
QUnit.test( 'Fire state events for vertical slides', function( assert ) {
assert.expect( 2 );
var done = assert.async( 2 );
var _onState1 = function( event ) {
assert.ok( true, 'state1 fired' );
done();
}
var _onState3 = function( event ) {
assert.ok( true, 'state3 fired' );
done();
}
Reveal.on( 'state1', _onState1 );
Reveal.on( 'state3', _onState3 );
Reveal.slide( 0 );
Reveal.slide( 4, 1 );
Reveal.slide( 4, 2 );
Reveal.off( 'state1', _onState1 );
Reveal.off( 'state3', _onState3 );
});
QUnit.test( 'No events if state remains unchanged', function( assert ) {
var stateChanges = 0;
var _onEvent = function( event ) {
stateChanges += 1;
}
Reveal.on( 'state1', _onEvent );
Reveal.slide( 0 ); // no state
Reveal.slide( 1 ); // state1
Reveal.slide( 2 ); // state1
Reveal.prev(); // state1
Reveal.next(); // state1
Reveal.slide( 4, 1 ); // state1
Reveal.slide( 0 ); // no state
Reveal.off( 'state1', _onEvent );
assert.strictEqual( stateChanges, 1, 'no event was fired when going to slide with same state' );
});
QUnit.test( 'Event order', function( assert ) {
var _onEvent = function( event ) {
assert.ok( Reveal.getCurrentSlide() == document.querySelector( '#slide2' ), 'correct current slide immediately after state event' );
}
Reveal.on( 'state1', _onEvent );
Reveal.slide( 0 );
Reveal.slide( 1 );
Reveal.off( 'state1', _onEvent );
});
} );
</script>
</body>
</html>

View File

@ -1,829 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - Tests</title>
<link rel="stylesheet" href="../dist/reveal.css">
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<script src="../node_modules/qunit/qunit/qunit.js"></script>
</head>
<body style="overflow: auto;">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div class="reveal" style="visibility: hidden;">
<div class="slides">
<section data-visibility="hidden">
This should be remove by reveal.js before our tests run.
</section>
<section data-background-image="examples/assets/image1.png">
<h1>1</h1>
<img data-src="">
<video data-src=""></video>
<audio data-src=""></audio>
<aside class="notes">speaker notes 1</aside>
</section>
<section>
<section data-background="examples/assets/image2.png" data-notes="speaker notes 2">
<h1>2.1</h1>
</section>
<section>
<h1>2.2</h1>
</section>
<section>
<h1>2.3</h1>
</section>
</section>
<section id="fragment-slides">
<section>
<h1>3.1</h1>
<ul>
<li class="fragment">4.1</li>
<li class="fragment">4.2</li>
<li class="fragment">4.3</li>
</ul>
</section>
<section>
<h1>3.2</h1>
<ul>
<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 id="fragments3">
<h1>3.3</h1>
<ul>
<li class="fragment" data-fragment-index="1">3.3.1</li>
<li class="fragment" data-fragment-index="4">3.3.2</li>
<li class="fragment" data-fragment-index="4">3.3.3</li>
</ul>
</section>
</section>
<section>
<h1>4</h1>
</section>
</div>
</div>
<script src="../dist/reveal.js"></script>
<script>
window.location.hash = '';
Reveal.configure({maxScale: 1.11});
// These tests expect the DOM to contain a presentation
// with the following slide structure:
//
// 1
// 2 - Three sub-slides
// 3 - Three fragment elements
// 3 - Two fragments with same data-fragment-index
// 4
Reveal.initialize().then( function() {
// ---------------------------------------------------------------
// DOM TESTS
QUnit.module( 'DOM' );
QUnit.test( 'Initial slides classes', function( assert ) {
var horizontalSlides = document.querySelectorAll( '.reveal .slides>section' )
assert.strictEqual( document.querySelectorAll( '.reveal .slides section[data-visibility="hidden"]' ).length, 0, 'no data-visibility="hidden" slides' );
assert.strictEqual( document.querySelectorAll( '.reveal .slides section.past' ).length, 0, 'no .past slides' );
assert.strictEqual( document.querySelectorAll( '.reveal .slides section.present' ).length, 1, 'one .present slide' );
assert.strictEqual( document.querySelectorAll( '.reveal .slides>section.future' ).length, horizontalSlides.length - 1, 'remaining horizontal slides are .future' );
assert.strictEqual( document.querySelectorAll( '.reveal .slides section.stack' ).length, 2, 'two .stacks' );
assert.ok( document.querySelectorAll( '.reveal .slides section.stack' )[0].querySelectorAll( '.future' ).length > 0, 'vertical slides are given .future' );
});
// ---------------------------------------------------------------
// API TESTS
QUnit.module( 'API' );
QUnit.test( 'Reveal.configure before initialization', function( assert ) {
assert.strictEqual( Reveal.getConfig().maxScale, 1.11 );
});
QUnit.test( 'Reveal.isReady', function( assert ) {
assert.strictEqual( Reveal.isReady(), true, 'returns true' );
});
QUnit.test( 'Reveal.isOverview', function( assert ) {
assert.strictEqual( Reveal.isOverview(), false, 'false by default' );
Reveal.toggleOverview();
assert.strictEqual( Reveal.isOverview(), true, 'true after toggling on' );
Reveal.toggleOverview();
assert.strictEqual( Reveal.isOverview(), false, 'false after toggling off' );
});
QUnit.test( 'Reveal.isPaused', function( assert ) {
assert.strictEqual( Reveal.isPaused(), false, 'false by default' );
Reveal.togglePause();
assert.strictEqual( Reveal.isPaused(), true, 'true after pausing' );
Reveal.togglePause();
assert.strictEqual( Reveal.isPaused(), false, 'false after resuming' );
});
QUnit.test( 'Reveal.isFirstSlide', function( assert ) {
Reveal.slide( 0, 0 );
assert.strictEqual( Reveal.isFirstSlide(), true, 'true after Reveal.slide( 0, 0 )' );
Reveal.slide( 1, 0 );
assert.strictEqual( Reveal.isFirstSlide(), false, 'false after Reveal.slide( 1, 0 )' );
Reveal.slide( 0, 0 );
assert.strictEqual( Reveal.isFirstSlide(), true, 'true after Reveal.slide( 0, 0 )' );
});
QUnit.test( 'Reveal.isFirstSlide after vertical slide', function( assert ) {
Reveal.slide( 1, 1 );
Reveal.slide( 0, 0 );
assert.strictEqual( Reveal.isFirstSlide(), true, 'true after Reveal.slide( 1, 1 ) and then Reveal.slide( 0, 0 )' );
});
QUnit.test( 'Reveal.isLastSlide', function( assert ) {
Reveal.slide( 0, 0 );
assert.strictEqual( Reveal.isLastSlide(), false, 'false after Reveal.slide( 0, 0 )' );
var lastSlideIndex = document.querySelectorAll( '.reveal .slides>section' ).length - 1;
Reveal.slide( lastSlideIndex, 0 );
assert.strictEqual( Reveal.isLastSlide(), true, 'true after Reveal.slide( '+ lastSlideIndex +', 0 )' );
Reveal.slide( 0, 0 );
assert.strictEqual( Reveal.isLastSlide(), false, 'false after Reveal.slide( 0, 0 )' );
});
QUnit.test( 'Reveal.isLastSlide after vertical slide', function( assert ) {
var lastSlideIndex = document.querySelectorAll( '.reveal .slides>section' ).length - 1;
Reveal.slide( 1, 1 );
Reveal.slide( lastSlideIndex );
assert.strictEqual( Reveal.isLastSlide(), true, 'true after Reveal.slide( 1, 1 ) and then Reveal.slide( '+ lastSlideIndex +', 0 )' );
});
QUnit.test( 'Reveal.getTotalSlides', function( assert ) {
assert.strictEqual( Reveal.getTotalSlides(), 8, 'eight slides in total' );
});
QUnit.test( 'Reveal.getIndices', function( assert ) {
var indices = Reveal.getIndices();
assert.ok( indices.hasOwnProperty( 'h' ), 'h exists' );
assert.ok( indices.hasOwnProperty( 'v' ), 'v exists' );
assert.ok( indices.hasOwnProperty( 'f' ), 'f exists' );
Reveal.slide( 1, 0 );
assert.strictEqual( Reveal.getIndices().h, 1, 'h 1' );
assert.strictEqual( Reveal.getIndices().v, 0, 'v 0' );
Reveal.slide( 1, 2 );
assert.strictEqual( Reveal.getIndices().h, 1, 'h 1' );
assert.strictEqual( Reveal.getIndices().v, 2, 'v 2' );
Reveal.slide( 0, 0 );
assert.strictEqual( Reveal.getIndices().h, 0, 'h 0' );
assert.strictEqual( Reveal.getIndices().v, 0, 'v 0' );
});
QUnit.test( 'Reveal.getSlide', function( assert ) {
assert.equal( Reveal.getSlide( 0 ), document.querySelector( '.reveal .slides>section:first-child' ), 'gets correct first slide' );
assert.equal( Reveal.getSlide( 1 ), document.querySelector( '.reveal .slides>section:nth-child(2)' ), 'no v index returns stack' );
assert.equal( Reveal.getSlide( 1, 0 ), document.querySelector( '.reveal .slides>section:nth-child(2)>section:nth-child(1)' ), 'v index 0 returns first vertical child' );
assert.equal( Reveal.getSlide( 1, 1 ), document.querySelector( '.reveal .slides>section:nth-child(2)>section:nth-child(2)' ), 'v index 1 returns second vertical child' );
assert.strictEqual( Reveal.getSlide( 100 ), undefined, 'undefined when out of horizontal bounds' );
assert.strictEqual( Reveal.getSlide( 1, 100 ), undefined, 'undefined when out of vertical bounds' );
});
QUnit.test( 'Reveal.getSlideBackground', function( assert ) {
assert.equal( Reveal.getSlideBackground( 0 ), document.querySelector( '.reveal .backgrounds>.slide-background:first-child' ), 'gets correct first background' );
assert.equal( Reveal.getSlideBackground( 1 ), document.querySelector( '.reveal .backgrounds>.slide-background:nth-child(2)' ), 'no v index returns stack' );
assert.equal( Reveal.getSlideBackground( 1, 0 ), document.querySelector( '.reveal .backgrounds>.slide-background:nth-child(2) .slide-background:nth-child(2)' ), 'v index 0 returns first vertical child' );
assert.equal( Reveal.getSlideBackground( 1, 1 ), document.querySelector( '.reveal .backgrounds>.slide-background:nth-child(2) .slide-background:nth-child(3)' ), 'v index 1 returns second vertical child' );
assert.strictEqual( Reveal.getSlideBackground( 100 ), undefined, 'undefined when out of horizontal bounds' );
assert.strictEqual( Reveal.getSlideBackground( 1, 100 ), undefined, 'undefined when out of vertical bounds' );
});
QUnit.test( 'Reveal.getSlideNotes', function( assert ) {
Reveal.slide( 0, 0 );
assert.ok( Reveal.getSlideNotes() === 'speaker notes 1', 'works with <aside class="notes">' );
Reveal.slide( 1, 0 );
assert.ok( Reveal.getSlideNotes() === 'speaker notes 2', 'works with <section data-notes="">' );
});
QUnit.test( 'Reveal.getPreviousSlide/getCurrentSlide', function( assert ) {
Reveal.slide( 0, 0 );
Reveal.slide( 1, 0 );
var firstSlide = document.querySelector( '.reveal .slides>section:first-child' );
var secondSlide = document.querySelector( '.reveal .slides>section:nth-child(2)>section' );
assert.equal( Reveal.getPreviousSlide(), firstSlide, 'previous is slide #0' );
assert.equal( Reveal.getCurrentSlide(), secondSlide, 'current is slide #1' );
});
QUnit.test( 'Reveal.getProgress', function( assert ) {
Reveal.slide( 0, 0 );
assert.strictEqual( Reveal.getProgress(), 0, 'progress is 0 on first slide' );
var lastSlideIndex = document.querySelectorAll( '.reveal .slides>section' ).length - 1;
Reveal.slide( lastSlideIndex, 0 );
assert.strictEqual( Reveal.getProgress(), 1, 'progress is 1 on last slide' );
});
QUnit.test( 'Reveal.getScale', function( assert ) {
assert.ok( typeof Reveal.getScale() === 'number', 'has scale' );
});
QUnit.test( 'Reveal.getConfig', function( assert ) {
assert.ok( typeof Reveal.getConfig() === 'object', 'has config' );
});
QUnit.test( 'Reveal.configure', function( assert ) {
assert.strictEqual( Reveal.getConfig().loop, false, '"loop" is false to start with' );
Reveal.configure({ loop: true });
assert.strictEqual( Reveal.getConfig().loop, true, '"loop" has changed to true' );
Reveal.configure({ loop: false, customTestValue: 1 });
assert.strictEqual( Reveal.getConfig().customTestValue, 1, 'supports custom values' );
});
QUnit.test( 'Reveal.availableRoutes', function( assert ) {
Reveal.slide( 0, 0 );
assert.deepEqual( Reveal.availableRoutes(), { left: false, up: false, down: false, right: true }, 'correct for first slide' );
Reveal.slide( 1, 0 );
assert.deepEqual( Reveal.availableRoutes(), { left: true, up: false, down: true, right: true }, 'correct for vertical slide' );
Reveal.slide( 0, 0 );
assert.deepEqual( Reveal.availableRoutes({ includeFragments: true }), { left: false, up: false, down: false, right: true }, 'correct with fragments included' );
});
QUnit.test( 'Reveal.next', function( assert ) {
Reveal.slide( 0, 0 );
// Step through vertical child slides
Reveal.next();
assert.deepEqual( Reveal.getIndices(), { h: 1, v: 0, f: undefined } );
Reveal.next();
assert.deepEqual( Reveal.getIndices(), { h: 1, v: 1, f: undefined } );
Reveal.next();
assert.deepEqual( Reveal.getIndices(), { h: 1, v: 2, f: undefined } );
// Step through fragments
Reveal.next();
assert.deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: -1 } );
Reveal.next();
assert.deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 0 } );
Reveal.next();
assert.deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 1 } );
Reveal.next();
assert.deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 2 } );
});
QUnit.test( 'Reveal.next at end', function( assert ) {
Reveal.slide( 3 );
// We're at the end, this should have no effect
Reveal.next();
assert.deepEqual( Reveal.getIndices(), { h: 3, v: 0, f: undefined } );
Reveal.next();
assert.deepEqual( Reveal.getIndices(), { h: 3, v: 0, f: undefined } );
});
// ---------------------------------------------------------------
// URL TESTS
QUnit.module( 'URL' );
QUnit.test( 'Write (fragmentInURL: false)', function( assert ) {
Reveal.configure({ hash: true, fragmentInURL: false });
Reveal.slide( 2, 0 );
assert.strictEqual( window.location.hash, '#/2' );
Reveal.slide( 2, 1 );
assert.strictEqual( window.location.hash, '#/2/1' );
Reveal.slide( 2, 0, 1 );
assert.strictEqual( window.location.hash, '#/2' );
Reveal.slide( 2, 2, 0 );
assert.strictEqual( window.location.hash, '#/fragments3' );
Reveal.slide( 2, 2, 1 );
assert.strictEqual( window.location.hash, '#/fragments3' );
});
QUnit.test( 'Write (fragmentInURL: true)', function( assert ) {
Reveal.configure({ hash: true, fragmentInURL: true });
Reveal.slide( 2, 0, -1 );
assert.strictEqual( window.location.hash, '#/2' );
Reveal.slide( 2, 1, -1 );
assert.strictEqual( window.location.hash, '#/2/1' );
Reveal.slide( 2, 0, 1 );
assert.strictEqual( window.location.hash, '#/2/0/1' );
Reveal.slide( 2, 2, -1 );
assert.strictEqual( window.location.hash, '#/fragments3' );
Reveal.slide( 2, 2, 1 );
assert.strictEqual( window.location.hash, '#/fragments3/1' );
});
QUnit.test( 'Read', async function( assert ) {
Reveal.configure({ hash: true, fragmentInURL: true });
let test = function( hash, indices ) {
return new Promise( resolve => {
window.onhashchange = () => {
assert.deepEqual( Reveal.getIndices(), indices );
resolve();
};
window.location.hash = hash;
} );
}
await test( '#/0', { h: 0, v: 0, f: undefined } ); // horizontal
await test( '#/1/1', { h: 1, v: 1, f: undefined } ); // vertical
await test( '#/0/', { h: 0, v: 0, f: undefined } ); // trailing /
await test( '#/1/1/', { h: 1, v: 1, f: undefined } ); // trailing /
await test( '#/2/0/1', { h: 2, v: 0, f: 1 } ); // fragment
});
// ---------------------------------------------------------------
// KEYBOARD TESTS
QUnit.module( 'Keyboard' );
QUnit.test( 'Add key bindings', function( assert ) {
var done = assert.async( 1 );
Reveal.addKeyBinding({keyCode: 88, key: 'X', description: 'X-SHORTCUT-X'}, function() {
assert.ok( true, 'callback triggered' );
done();
} );
Reveal.toggleHelp( true );
assert.ok( /X\-SHORTCUT\-X/.test( document.body.innerHTML ), 'binding is added to help overlay' );
Reveal.toggleHelp( false );
let event = new KeyboardEvent( 'keydown', { 'keyCode':88 } );
document.dispatchEvent( event );
Reveal.removeKeyBinding( 88 );
// should do nothing
document.dispatchEvent( event );
});
// ---------------------------------------------------------------
// FRAGMENT TESTS
QUnit.module( 'Fragments' );
QUnit.test( 'Sliding to fragments', function( assert ) {
Reveal.slide( 2, 0, -1 );
assert.deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: -1 }, 'Reveal.slide( 2, 0, -1 )' );
Reveal.slide( 2, 0, 0 );
assert.deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 0 }, 'Reveal.slide( 2, 0, 0 )' );
Reveal.slide( 2, 0, 2 );
assert.deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 2 }, 'Reveal.slide( 2, 0, 2 )' );
Reveal.slide( 2, 0, 1 );
assert.deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 1 }, 'Reveal.slide( 2, 0, 1 )' );
});
QUnit.test( 'data-fragment is set on slide <section>', function( assert ) {
Reveal.slide( 2, 0, -1 );
assert.deepEqual( Reveal.getCurrentSlide().getAttribute( 'data-fragment' ), '-1' );
Reveal.slide( 2, 0, 2 );
assert.deepEqual( Reveal.getCurrentSlide().getAttribute( 'data-fragment' ), '2' );
Reveal.slide( 2, 0, 0 );
assert.deepEqual( Reveal.getCurrentSlide().getAttribute( 'data-fragment' ), '0' );
var fragmentSlide = Reveal.getCurrentSlide();
Reveal.slide( 3, 0 );
assert.deepEqual( fragmentSlide.getAttribute( 'data-fragment' ), '0', 'data-fragment persists when jumping to another slide' );
});
QUnit.test( 'Hiding all fragments', function( assert ) {
var fragmentSlide = document.querySelector( '#fragment-slides>section:nth-child(1)' );
Reveal.slide( 2, 0, 0 );
assert.strictEqual( fragmentSlide.querySelectorAll( '.fragment.visible' ).length, 1, 'one fragment visible when index is 0' );
Reveal.slide( 2, 0, -1 );
assert.strictEqual( fragmentSlide.querySelectorAll( '.fragment.visible' ).length, 0, 'no fragments visible when index is -1' );
});
QUnit.test( 'Current fragment', function( assert ) {
var fragmentSlide = document.querySelector( '#fragment-slides>section:nth-child(1)' );
var lastFragmentIndex = [].slice.call( fragmentSlide.querySelectorAll( '.fragment' ) ).pop().getAttribute( 'data-fragment-index' );
Reveal.slide( 2, 0 );
assert.strictEqual( fragmentSlide.querySelectorAll( '.fragment.current-fragment' ).length, 0, 'no current fragment at index -1' );
Reveal.slide( 2, 0, 0 );
assert.strictEqual( fragmentSlide.querySelectorAll( '.fragment.current-fragment' ).length, 1, 'one current fragment at index 0' );
Reveal.slide( 1, 0, 0 );
assert.strictEqual( fragmentSlide.querySelectorAll( '.fragment.current-fragment' ).length, 0, 'no current fragment when navigating to previous slide' );
Reveal.slide( 3, 0, 0 );
assert.strictEqual( fragmentSlide.querySelectorAll( '.fragment.current-fragment' ).length, 0, 'no current fragment when navigating to next slide' );
Reveal.slide( 2, 1, -1 );
Reveal.prev();
assert.strictEqual( fragmentSlide.querySelector( '.fragment.current-fragment' ).getAttribute( 'data-fragment-index' ), lastFragmentIndex, 'last fragment is current fragment when returning from future slide' );
});
QUnit.test( 'Stepping through fragments', function( assert ) {
Reveal.slide( 2, 0, -1 );
// forwards:
Reveal.next();
assert.deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 0 }, 'next() goes to next fragment' );
Reveal.right();
assert.deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 1 }, 'right() goes to next fragment' );
Reveal.down();
assert.deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 2 }, 'down() goes to next fragment' );
Reveal.down(); // moves to f #3
// backwards:
Reveal.prev();
assert.deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 2 }, 'prev() goes to prev fragment' );
Reveal.left();
assert.deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 1 }, 'left() goes to prev fragment' );
Reveal.up();
assert.deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 0 }, 'up() goes to prev fragment' );
});
QUnit.test( 'Stepping past fragments', function( assert ) {
var fragmentSlide = document.querySelector( '#fragment-slides>section:nth-child(1)' );
Reveal.slide( 0, 0, 0 );
assert.equal( fragmentSlide.querySelectorAll( '.fragment.visible' ).length, 0, 'no fragments visible when on previous slide' );
Reveal.slide( 3, 0, 0 );
assert.equal( fragmentSlide.querySelectorAll( '.fragment.visible' ).length, 3, 'all fragments visible when on future slide' );
});
QUnit.test( 'Fragment indices', function( assert ) {
var fragmentSlide = document.querySelector( '#fragment-slides>section:nth-child(2)' );
Reveal.slide( 3, 0, 0 );
assert.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 );
assert.equal( Reveal.getIndices().f, 0, 'returns correct index for first fragment' );
Reveal.slide( 2, 2, 1 );
assert.equal( Reveal.getIndices().f, 1, 'returns correct index for two fragments with same index' );
});
QUnit.test( 'Index generation', function( assert ) {
var fragmentSlide = document.querySelector( '#fragment-slides>section:nth-child(1)' );
// These have no indices defined to start with
assert.equal( fragmentSlide.querySelectorAll( '.fragment' )[0].getAttribute( 'data-fragment-index' ), '0' );
assert.equal( fragmentSlide.querySelectorAll( '.fragment' )[1].getAttribute( 'data-fragment-index' ), '1' );
assert.equal( fragmentSlide.querySelectorAll( '.fragment' )[2].getAttribute( 'data-fragment-index' ), '2' );
});
QUnit.test( 'Index normalization', function( assert ) {
var fragmentSlide = document.querySelector( '#fragment-slides>section:nth-child(3)' );
// These start out as 1-4-4 and should normalize to 0-1-1
assert.equal( fragmentSlide.querySelectorAll( '.fragment' )[0].getAttribute( 'data-fragment-index' ), '0' );
assert.equal( fragmentSlide.querySelectorAll( '.fragment' )[1].getAttribute( 'data-fragment-index' ), '1' );
assert.equal( fragmentSlide.querySelectorAll( '.fragment' )[2].getAttribute( 'data-fragment-index' ), '1' );
});
QUnit.test( 'fragmentshown event', function( assert ) {
assert.expect( 2 );
var done = assert.async( 2 );
var _onEvent = function( event ) {
assert.ok( true, 'event fired' );
done();
}
Reveal.on( 'fragmentshown', _onEvent );
Reveal.slide( 2, 0 );
Reveal.slide( 2, 0 ); // should do nothing
Reveal.slide( 2, 0, 0 ); // should do nothing
Reveal.next();
Reveal.next();
Reveal.prev(); // shouldn't fire fragmentshown
Reveal.off( 'fragmentshown', _onEvent );
});
QUnit.test( 'fragmenthidden event', function( assert ) {
assert.expect( 2 );
var done = assert.async( 2 );
var _onEvent = function( event ) {
assert.ok( true, 'event fired' );
done();
}
Reveal.on( 'fragmenthidden', _onEvent );
Reveal.slide( 2, 0, 2 );
Reveal.slide( 2, 0, 2 ); // should do nothing
Reveal.prev();
Reveal.prev();
Reveal.next(); // shouldn't fire fragmenthidden
Reveal.off( 'fragmenthidden', _onEvent );
});
// ---------------------------------------------------------------
// AUTO-SLIDE TESTS
QUnit.module( 'Auto Sliding' );
QUnit.test( 'Reveal.isAutoSliding', function( assert ) {
assert.strictEqual( Reveal.isAutoSliding(), false, 'false by default' );
Reveal.configure({ autoSlide: 10000 });
assert.strictEqual( Reveal.isAutoSliding(), true, 'true after starting' );
Reveal.configure({ autoSlide: 0 });
assert.strictEqual( Reveal.isAutoSliding(), false, 'false after setting to 0' );
});
QUnit.test( 'Reveal.toggleAutoSlide', function( assert ) {
Reveal.configure({ autoSlide: 10000 });
Reveal.toggleAutoSlide();
assert.strictEqual( Reveal.isAutoSliding(), false, 'false after first toggle' );
Reveal.toggleAutoSlide();
assert.strictEqual( Reveal.isAutoSliding(), true, 'true after second toggle' );
Reveal.configure({ autoSlide: 0 });
});
QUnit.test( 'autoslidepaused', function( assert ) {
assert.expect( 1 );
var done = assert.async();
var _onEvent = function( event ) {
assert.ok( true, 'event fired' );
done();
}
Reveal.on( 'autoslidepaused', _onEvent );
Reveal.configure({ autoSlide: 10000 });
Reveal.toggleAutoSlide();
// cleanup
Reveal.configure({ autoSlide: 0 });
Reveal.off( 'autoslidepaused', _onEvent );
});
QUnit.test( 'autoslideresumed', function( assert ) {
assert.expect( 1 );
var done = assert.async();
var _onEvent = function( event ) {
assert.ok( true, 'event fired' );
done();
}
Reveal.on( 'autoslideresumed', _onEvent );
Reveal.configure({ autoSlide: 10000 });
Reveal.toggleAutoSlide();
Reveal.toggleAutoSlide();
// cleanup
Reveal.configure({ autoSlide: 0 });
Reveal.off( 'autoslideresumed', _onEvent );
});
// ---------------------------------------------------------------
// CONFIGURATION VALUES
QUnit.module( 'Configuration' );
QUnit.test( 'Controls', function( assert ) {
var controlsElement = document.querySelector( '.reveal>.controls' );
Reveal.configure({ controls: false });
assert.equal( controlsElement.style.display, 'none', 'controls are hidden' );
Reveal.configure({ controls: true });
assert.equal( controlsElement.style.display, 'block', 'controls are visible' );
});
QUnit.test( 'Progress', function( assert ) {
var progressElement = document.querySelector( '.reveal>.progress' );
Reveal.configure({ progress: false });
assert.equal( progressElement.style.display, 'none', 'progress are hidden' );
Reveal.configure({ progress: true });
assert.equal( progressElement.style.display, 'block', 'progress are visible' );
});
QUnit.test( 'Loop', function( assert ) {
Reveal.configure({ loop: true });
Reveal.slide( 0, 0 );
Reveal.left();
assert.notEqual( Reveal.getIndices().h, 0, 'looped from start to end' );
Reveal.right();
assert.equal( Reveal.getIndices().h, 0, 'looped from end to start' );
Reveal.configure({ loop: false });
});
// ---------------------------------------------------------------
// LAZY-LOADING TESTS
QUnit.module( 'Lazy-Loading' );
QUnit.test( 'img with data-src', function( assert ) {
assert.strictEqual( document.querySelectorAll( '.reveal section img[src]' ).length, 1, 'Image source has been set' );
});
QUnit.test( 'video with data-src', function( assert ) {
assert.strictEqual( document.querySelectorAll( '.reveal section video[src]' ).length, 1, 'Video source has been set' );
});
QUnit.test( 'audio with data-src', function( assert ) {
assert.strictEqual( document.querySelectorAll( '.reveal section audio[src]' ).length, 1, 'Audio source has been set' );
});
QUnit.test( 'iframe with data-src', function( assert ) {
Reveal.slide( 0, 0 );
assert.strictEqual( document.querySelectorAll( '.reveal section iframe[src]' ).length, 0, 'Iframe source is not set' );
Reveal.slide( 2, 1 );
assert.strictEqual( document.querySelectorAll( '.reveal section iframe[src]' ).length, 1, 'Iframe source is set' );
Reveal.slide( 2, 2 );
assert.strictEqual( document.querySelectorAll( '.reveal section iframe[src]' ).length, 0, 'Iframe source is not set' );
});
QUnit.test( 'background images', function( assert ) {
var imageSource1 = Reveal.getSlide( 0 ).getAttribute( 'data-background-image' );
var imageSource2 = Reveal.getSlide( 1, 0 ).getAttribute( 'data-background' );
// check that the images are applied to the background elements
assert.ok( Reveal.getSlideBackground( 0 ).querySelector( '.slide-background-content' ).style.backgroundImage.indexOf( imageSource1 ) !== -1, 'data-background-image worked' );
assert.ok( Reveal.getSlideBackground( 1, 0 ).querySelector( '.slide-background-content' ).style.backgroundImage.indexOf( imageSource2 ) !== -1, 'data-background worked' );
});
// ---------------------------------------------------------------
// EVENT TESTS
QUnit.module( 'Events' );
QUnit.test( 'slidechanged', function( assert ) {
assert.expect( 3 );
var done = assert.async( 3 );
var _onEvent = function( event ) {
assert.ok( true, 'event fired' );
done();
}
Reveal.on( 'slidechanged', _onEvent );
Reveal.slide( 1, 0 ); // should trigger
Reveal.slide( 1, 0 ); // should do nothing
Reveal.next(); // should trigger
Reveal.slide( 3, 0 ); // should trigger
Reveal.next(); // should do nothing
Reveal.off( 'slidechanged', _onEvent );
});
/* Fails intermittently...
QUnit.test( 'slidetransitionend', function( assert ) {
assert.expect( 2 );
let done = assert.async( 2 );
let time = Date.now();
let horizontalCallback = event => {
assert.ok( Date.now() - time > 200, 'horizontal event fired' );
done();
let verticalCallback = event => {
assert.ok( true, 'vertical event fired' );
done();
Reveal.off( 'slidetransitionend', verticalCallback );
}
Reveal.off( 'slidetransitionend', horizontalCallback );
Reveal.on( 'slidetransitionend', verticalCallback );
Reveal.slide( 1, 1 );
}
Reveal.slide( 0, 0 );
Reveal.on( 'slidetransitionend', horizontalCallback );
Reveal.slide( 1, 0 );
});
*/
QUnit.test( 'paused', function( assert ) {
assert.expect( 1 );
var done = assert.async();
var _onEvent = function( event ) {
assert.ok( true, 'event fired' );
done();
}
Reveal.on( 'paused', _onEvent );
Reveal.togglePause();
Reveal.togglePause();
Reveal.off( 'paused', _onEvent );
});
QUnit.test( 'resumed', function( assert ) {
assert.expect( 1 );
var done = assert.async();
var _onEvent = function( event ) {
assert.ok( true, 'event fired' );
done();
}
Reveal.on( 'resumed', _onEvent );
Reveal.togglePause();
Reveal.togglePause();
Reveal.off( 'resumed', _onEvent );
});
} );
</script>
</body>
</html>