--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Popcorn API</title>
+ <link rel="stylesheet" href="../../test/qunit/qunit.css" type="text/css" media="screen">
+ <script src="../../test/qunit/qunit.js"></script>
+ <!--
+ do not move - this must be called immediately prior to
+ popcorn-api-draft.js
+ -->
+
+ <script src="../../popcorn.js"></script>
+ <script src="../../test/jquery.js"></script>
+ <script src="popcorn.mustache.js"></script>
+ <script src="popcorn.mustache.unit.js"></script>
+</head>
+<body>
+
+ <h1 id="qunit-header">Popcorn Mustache Plugin</h1>
+ <h2 id="qunit-banner"></h2>
+ <div id="qunit-testrunner-toolbar"></div>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture"> </div>
+
+ <video id='video'
+ autobuffer
+ preload="auto"
+ controls
+ width= '250px'
+ poster="../../test/poster.png">
+
+ <source id='mp4'
+ src="../../test/trailer.mp4"
+ type='video/mp4; codecs="avc1, mp4a"'>
+
+ <source id='ogv'
+ src="../../test/trailer.ogv"
+ type='video/ogg; codecs="theora, vorbis"'>
+
+ <p>Your user agent does not support the HTML5 Video element.</p>
+
+ </video>
+ <div id="mustache-div"></div>
+</body>
+</html>
--- /dev/null
+test("Popcorn Mustache Plugin", function () {
+
+ var popped = Popcorn("#video"),
+ expects = 3,
+ count = 0,
+ interval,
+ mustacheDiv = document.getElementById('mustache-div');
+
+ expect( expects );
+
+ function plus() {
+ if ( ++count === expects) {
+ start();
+ }
+ }
+
+ stop();
+
+ ok('mustache' in popped, "mustache is a method of the popped instance");
+ plus();
+
+ equals ( mustacheDiv.innerHTML, "", "initially, there is nothing inside the mustache-div" );
+ plus();
+
+ popped.mustache({
+ start: 1, // seconds
+ end: 3, // seconds
+ template: "<h1>{{heading}}</h1>",
+ data: '{"heading": "mustache"}',
+ target: 'mustache-div',
+ static: true
+ } );
+
+ interval = setInterval( function() {
+ if( popped.currentTime() > 1 && popped.currentTime() < 3 ) {
+ ok( /<h1>mustache<\/h1>/.test( mustacheDiv.innerHTML ), "Mustache template rendered" );
+ plus();
+ clearInterval( interval );
+ }
+ }, 500);
+
+ popped.volume(0);
+ popped.play();
+});