--- /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="http://widgets.twimg.com/j/2/widget.js"></script>
+ <script src="popcorn.twitter.js"></script>
+
+ <script src="popcorn.twitter.unit.js"></script>
+</head>
+<body>
+
+ <h1 id="qunit-header">Popcorn Twitter 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'
+ 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="twitterdiv"></div>
+</body>
+</html>
--- /dev/null
+test("Popcorn Twitter Plugin", function () {
+
+ var popped = Popcorn("#video"),
+ expects = 6,
+ count = 0,
+ interval,
+ interval2,
+ twitterdiv = document.getElementById('twitterdiv');
+
+ expect( expects );
+
+ function plus() {
+ if ( ++count === expects) {
+ start();
+ }
+ }
+
+ stop();
+
+ ok('twitter' in popped, "twitter is a method of the popped instance");
+ plus();
+
+ equals ( twitterdiv.innerHTML, "", "initially, there is nothing inside the twitterdiv" );
+ plus();
+
+ try {
+
+ ok( TWTR, "Twitter constructor exists");
+ plus();
+
+ } catch (e) {};
+
+ popped.twitter({
+ start: 1, // seconds
+ end: 3, // seconds
+ title: 'Steve Song',
+ src: '@stevesong',
+ target: 'twitterdiv',
+ } );
+
+ interval = setInterval( function() {
+ if( popped.currentTime() > 1 && popped.currentTime() < 3 ) {
+ ok( /display: inline;/.test( twitterdiv.innerHTML ), "Div contents are displayed" );
+ plus();
+ ok( /twtr-widget/.test( twitterdiv.innerHTML ), "A Twitter widget exists" );
+ plus();
+ clearInterval( interval );
+ }
+ }, 500);
+
+ interval2 = setInterval( function() {
+ if( popped.currentTime() > 3 ) {
+ ok( /display: none;/.test( twitterdiv.innerHTML ), "Div contents are hidden again" );
+ plus();
+ clearInterval( interval2 );
+ }
+ }, 500);
+
+ popped.play();
+
+});