Popcorn.p[key] = Popcorn.events.fn[key];
});
+ Popcorn.protect = {
+ natives: "load play pause currentTime playbackRate mute volume duration".toLowerCase().split(/\s+/)
+ };
+
// Plugins are registered
Popcorn.registry = [];
// An interface for extending Popcorn
// with plugin functionality
Popcorn.plugin = function( name, definition ) {
+ if ( Popcorn.protect.natives.indexOf( name.toLowerCase() ) >= 0 ) {
+ Popcorn.error("'" + name + "' is a protected function name");
+ return;
+ }
+
// Provides some sugar, but ultimately extends
// the definition into Popcorn.p
});
+test("Protected", function () {
+
+ expect(1);
+ // TODO: comprehensive tests for these utilities
+
+ ok( !!Popcorn.protect , "Popcorn.protect exists");
+
+
+});
});
});
+test("Protected Names", function () {
+
+ //QUnit.reset();
+
+ expect(8);
+
+ var popped = Popcorn("#video");
+
+ $.each( "load play pause currentTime playbackRate mute volume duration".split(/\s+/), function (k, name) {
+ try {
+ Popcorn.plugin( name, {});
+ } catch (e) {
+ ok( name, "Attempting to overwrite '" + name + "' threw an exception " );
+
+ };
+ });
+});
+/*
test("Events Extended", function () {
- //QUnit.reset();
+ QUnit.reset();
// needs expectation
expects = 11,
count = 0;
- //expect(expects);
+ expect(expects);
// not in full use
function plus(){
if ( ++count == expects ) start();
Popcorn.plugin("extendedEvents", (function () {
+ var fired = [];
var pluginObj = {
$.each( Setup.events, function ( k, type ) {
pluginObj[type] = function (event, opts) {
- ok( true, type + " fired!" );
+
+ if ( fired.indexOf(type) === -1 ) {
+ fired.push(type);
+
+ ok( true, type + " fired" );
+
+ plus();
- plus();
+
+
+ }
};
});
popped.currentTime(19).play();
-
-});
+ $.each( Setup.events, function ( k, type ) {
+
+ popped.trigger(type);
+
+ });
+});
+*/
/*
module("Popcorn Video Object")