From 250afdd256b561917b1982813f38b35c8c79b99b Mon Sep 17 00:00:00 2001 From: costolo Date: Wed, 10 Jun 2015 15:30:55 -0400 Subject: [PATCH 01/17] Update documentation explaining new options parameters. --- plugins/footnote/popcorn.footnote.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/footnote/popcorn.footnote.js b/plugins/footnote/popcorn.footnote.js index d4631fce3..42a7e1ac9 100755 --- a/plugins/footnote/popcorn.footnote.js +++ b/plugins/footnote/popcorn.footnote.js @@ -11,6 +11,9 @@ * Text is the text that you want to appear in the target * Target is the id of the document element that the text needs to be * attached to, this target element must exist on the DOM + * Options parameter can take element or selector. + * Element will override the default div element and append a valid HTML element to the DOM + * Selector will add the CSS class of your choice to the appended footnotes * * @param {Object} options * From 1de6fc4ecc067c42b43f8c4573032dd7fa2afa4c Mon Sep 17 00:00:00 2001 From: costolo Date: Wed, 10 Jun 2015 15:31:14 -0400 Subject: [PATCH 02/17] Update example exhibiting new options parameters. --- plugins/footnote/popcorn.footnote.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/footnote/popcorn.footnote.js b/plugins/footnote/popcorn.footnote.js index 42a7e1ac9..10461a6c8 100755 --- a/plugins/footnote/popcorn.footnote.js +++ b/plugins/footnote/popcorn.footnote.js @@ -23,6 +23,8 @@ * start: 5, // seconds * end: 15, // seconds * text: 'This video made exclusively for drumbeat.org', + * element: 'li', + * selector: 'footnote', * target: 'footnotediv' * }); **/ From 83551e6127a4d05b9bb0e129b4db58befa179336 Mon Sep 17 00:00:00 2001 From: costolo Date: Wed, 10 Jun 2015 15:32:11 -0400 Subject: [PATCH 03/17] Add element to available options parameters. --- plugins/footnote/popcorn.footnote.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/footnote/popcorn.footnote.js b/plugins/footnote/popcorn.footnote.js index 10461a6c8..23488d3b0 100755 --- a/plugins/footnote/popcorn.footnote.js +++ b/plugins/footnote/popcorn.footnote.js @@ -54,6 +54,11 @@ type: "text", label: "Text" }, + element: { + elem: "input", + type: "text", + label: "Element" + }, target: "footnote-container" } }, From 43fa339274bd9164863816663b551b5a94686ed6 Mon Sep 17 00:00:00 2001 From: costolo Date: Wed, 10 Jun 2015 15:32:35 -0400 Subject: [PATCH 04/17] Add selector to available options parameters. --- plugins/footnote/popcorn.footnote.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/footnote/popcorn.footnote.js b/plugins/footnote/popcorn.footnote.js index 23488d3b0..71b678150 100755 --- a/plugins/footnote/popcorn.footnote.js +++ b/plugins/footnote/popcorn.footnote.js @@ -59,6 +59,11 @@ type: "text", label: "Element" }, + selector: { + elem: "input", + type: "text", + label: "Selector" + }, target: "footnote-container" } }, From 5b183de23fee650091441ea119a24aae67ce5160 Mon Sep 17 00:00:00 2001 From: costolo Date: Wed, 10 Jun 2015 15:34:50 -0400 Subject: [PATCH 05/17] Add conditionals for element and selector options parameters. --- plugins/footnote/popcorn.footnote.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/footnote/popcorn.footnote.js b/plugins/footnote/popcorn.footnote.js index 71b678150..6421f5ad9 100755 --- a/plugins/footnote/popcorn.footnote.js +++ b/plugins/footnote/popcorn.footnote.js @@ -72,7 +72,14 @@ var target = Popcorn.dom.find( options.target ); - options._container = document.createElement( "div" ); + if (options.element) { + options._container = document.createElement(options.element); + } else { + options._container = document.createElement("div"); + } + if (options.selector) { + options._container.classList.add(options.selector); + } options._container.style.display = "none"; options._container.innerHTML = options.text; From b65f2b0c9e513a90d5735f5cb48fc77c322b6f38 Mon Sep 17 00:00:00 2001 From: costolo Date: Wed, 10 Jun 2015 15:55:35 -0400 Subject: [PATCH 06/17] Increased number of tests from 8 to 10 --- plugins/footnote/popcorn.footnote.unit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/footnote/popcorn.footnote.unit.js b/plugins/footnote/popcorn.footnote.unit.js index 272143100..48c95acde 100755 --- a/plugins/footnote/popcorn.footnote.unit.js +++ b/plugins/footnote/popcorn.footnote.unit.js @@ -1,7 +1,7 @@ test( "Popcorn Footnote Plugin", function() { var popped = Popcorn( "#video" ), - expects = 8, + expects = 10, count = 0, setupId, footnotediv = document.getElementById( "footnotediv" ); From 214f1a450400aafccb147c78b023ace69b32ab4c Mon Sep 17 00:00:00 2001 From: costolo Date: Wed, 10 Jun 2015 15:56:43 -0400 Subject: [PATCH 07/17] Update test to reflect the addition of an element to footnotediv --- plugins/footnote/popcorn.footnote.unit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/footnote/popcorn.footnote.unit.js b/plugins/footnote/popcorn.footnote.unit.js index 48c95acde..1f4ae3bfe 100755 --- a/plugins/footnote/popcorn.footnote.unit.js +++ b/plugins/footnote/popcorn.footnote.unit.js @@ -38,7 +38,7 @@ test( "Popcorn Footnote Plugin", function() { setupId = popped.getLastTrackEventId(); popped.exec( 0, function() { - equal( footnotediv.childElementCount, 2, "footnotediv now has two inner elements" ); + equal( footnotediv.childElementCount, 3, "footnotediv now has three inner elements" ); plus(); equal( footnotediv.children[ 0 ].innerHTML, "This video made exclusively for drumbeat.org", "footnote displaing correct information" ); plus(); From e0ddf542ba1d1f76a3a29a019554a8b58ef251ae Mon Sep 17 00:00:00 2001 From: costolo Date: Wed, 10 Jun 2015 15:57:10 -0400 Subject: [PATCH 08/17] Fix spelling of method --- plugins/footnote/popcorn.footnote.unit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/footnote/popcorn.footnote.unit.js b/plugins/footnote/popcorn.footnote.unit.js index 1f4ae3bfe..2a12a0421 100755 --- a/plugins/footnote/popcorn.footnote.unit.js +++ b/plugins/footnote/popcorn.footnote.unit.js @@ -16,7 +16,7 @@ test( "Popcorn Footnote Plugin", function() { stop(); - ok( "footnote" in popped, "footnote is a mehtod of the popped instance" ); + ok( "footnote" in popped, "footnote is a method of the popped instance" ); plus(); equal( footnotediv.childElementCount, 0, "initially, there is nothing inside the footnotediv" ); From 01f35fc48a3794a982f0daeb44678f8ce54e6052 Mon Sep 17 00:00:00 2001 From: costolo Date: Wed, 10 Jun 2015 15:57:29 -0400 Subject: [PATCH 09/17] Add test footnote to assign element and selector parameters --- plugins/footnote/popcorn.footnote.unit.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/footnote/popcorn.footnote.unit.js b/plugins/footnote/popcorn.footnote.unit.js index 2a12a0421..292d841b3 100755 --- a/plugins/footnote/popcorn.footnote.unit.js +++ b/plugins/footnote/popcorn.footnote.unit.js @@ -28,6 +28,14 @@ test( "Popcorn Footnote Plugin", function() { text: "This video made exclusively for drumbeat.org", target: "footnotediv" }) + .footnote({ + start: 1, + end: 2, + text: "Element and selector test", + element: "li", + selector: "selector-test", + target: "footnotediv" + }) .footnote({ start: 2, end: 4, From cfc82576ca36abc4d743d90b1766eb423b6b9dca Mon Sep 17 00:00:00 2001 From: costolo Date: Wed, 10 Jun 2015 15:58:28 -0400 Subject: [PATCH 10/17] Update test to reflect the additional footnote created --- plugins/footnote/popcorn.footnote.unit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/footnote/popcorn.footnote.unit.js b/plugins/footnote/popcorn.footnote.unit.js index 292d841b3..2c243dc86 100755 --- a/plugins/footnote/popcorn.footnote.unit.js +++ b/plugins/footnote/popcorn.footnote.unit.js @@ -64,7 +64,7 @@ test( "Popcorn Footnote Plugin", function() { plus(); popped.pause().removeTrackEvent( setupId ); - ok( !footnotediv.children[ 1 ], "removed footnote was properly destroyed" ); + ok( !footnotediv.children[ 2 ], "removed footnote was properly destroyed" ); plus(); }); popped.play().volume( 0 ); From d98df31d87e392ec820dc390481f8e256e7a7c98 Mon Sep 17 00:00:00 2001 From: costolo Date: Wed, 10 Jun 2015 15:59:04 -0400 Subject: [PATCH 11/17] Update test to reflect the additional footnote created --- plugins/footnote/popcorn.footnote.unit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/footnote/popcorn.footnote.unit.js b/plugins/footnote/popcorn.footnote.unit.js index 2c243dc86..ae2bdf621 100755 --- a/plugins/footnote/popcorn.footnote.unit.js +++ b/plugins/footnote/popcorn.footnote.unit.js @@ -55,7 +55,7 @@ test( "Popcorn Footnote Plugin", function() { }); popped.exec( 3, function() { - equal( footnotediv.children[ 1 ].style.display, "inline", "second footnote is visible on the page" ); + equal( footnotediv.children[ 2 ].style.display, "inline", "second footnote is visible on the page" ); plus(); }); From 6770e77951ee40bba92034234fc934e4e6c1e7ff Mon Sep 17 00:00:00 2001 From: costolo Date: Wed, 10 Jun 2015 15:59:56 -0400 Subject: [PATCH 12/17] Add test to check that the proper selector is added by the selector parameter --- plugins/footnote/popcorn.footnote.unit.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/footnote/popcorn.footnote.unit.js b/plugins/footnote/popcorn.footnote.unit.js index ae2bdf621..c5ef6ad79 100755 --- a/plugins/footnote/popcorn.footnote.unit.js +++ b/plugins/footnote/popcorn.footnote.unit.js @@ -54,6 +54,11 @@ test( "Popcorn Footnote Plugin", function() { plus(); }); + popped.exec( 1, function() { + equal( footnotediv.children[ 1 ].className, "selector-test", "CSS selector is set by selector options parameter"); + plus(); + }); + popped.exec( 3, function() { equal( footnotediv.children[ 2 ].style.display, "inline", "second footnote is visible on the page" ); plus(); From 6b3490ab6b0b5ee3bd6a95d3539ee07588bda4c0 Mon Sep 17 00:00:00 2001 From: costolo Date: Wed, 10 Jun 2015 16:00:17 -0400 Subject: [PATCH 13/17] Add test to check that the proper HTML element was added by the element parameter --- plugins/footnote/popcorn.footnote.unit.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/footnote/popcorn.footnote.unit.js b/plugins/footnote/popcorn.footnote.unit.js index c5ef6ad79..81345c49a 100755 --- a/plugins/footnote/popcorn.footnote.unit.js +++ b/plugins/footnote/popcorn.footnote.unit.js @@ -57,6 +57,8 @@ test( "Popcorn Footnote Plugin", function() { popped.exec( 1, function() { equal( footnotediv.children[ 1 ].className, "selector-test", "CSS selector is set by selector options parameter"); plus(); + equal( footnotediv.children[ 1 ].nodeName, "LI", "HTML element is set by element options parameter"); + plus(); }); popped.exec( 3, function() { From 6ac6269aebe77292bf47fc52a786e2a210caf4b3 Mon Sep 17 00:00:00 2001 From: costolo Date: Wed, 10 Jun 2015 16:07:24 -0400 Subject: [PATCH 14/17] Increase number of tests --- plugins/footnote/popcorn.footnote.unit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/footnote/popcorn.footnote.unit.js b/plugins/footnote/popcorn.footnote.unit.js index 81345c49a..951e843ae 100755 --- a/plugins/footnote/popcorn.footnote.unit.js +++ b/plugins/footnote/popcorn.footnote.unit.js @@ -1,7 +1,7 @@ test( "Popcorn Footnote Plugin", function() { var popped = Popcorn( "#video" ), - expects = 10, + expects = 11, count = 0, setupId, footnotediv = document.getElementById( "footnotediv" ); From ab4ba8e68263069084b14444f2635acec8627e0b Mon Sep 17 00:00:00 2001 From: costolo Date: Wed, 10 Jun 2015 16:07:41 -0400 Subject: [PATCH 15/17] Add test to ensure default functionality of footnotes was preserved --- plugins/footnote/popcorn.footnote.unit.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/footnote/popcorn.footnote.unit.js b/plugins/footnote/popcorn.footnote.unit.js index 951e843ae..385e098db 100755 --- a/plugins/footnote/popcorn.footnote.unit.js +++ b/plugins/footnote/popcorn.footnote.unit.js @@ -52,6 +52,8 @@ test( "Popcorn Footnote Plugin", function() { plus(); equal( footnotediv.children[ 0 ].style.display, "inline", "footnote is visible on the page" ); plus(); + equal( footnotediv.children [ 0 ].nodeName, "DIV", "Default HTML element is a div"); + plus(); }); popped.exec( 1, function() { From 6afe7eb1b019b5bd1d10182ad9d79256308cda1e Mon Sep 17 00:00:00 2001 From: costolo Date: Wed, 10 Jun 2015 16:09:41 -0400 Subject: [PATCH 16/17] Update number of tests --- plugins/footnote/popcorn.footnote.unit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/footnote/popcorn.footnote.unit.js b/plugins/footnote/popcorn.footnote.unit.js index 385e098db..bcc565ce3 100755 --- a/plugins/footnote/popcorn.footnote.unit.js +++ b/plugins/footnote/popcorn.footnote.unit.js @@ -1,7 +1,7 @@ test( "Popcorn Footnote Plugin", function() { var popped = Popcorn( "#video" ), - expects = 11, + expects = 12, count = 0, setupId, footnotediv = document.getElementById( "footnotediv" ); From 7203ad686ec87d576fae863087ee1dcb05b12775 Mon Sep 17 00:00:00 2001 From: costolo Date: Wed, 10 Jun 2015 16:09:50 -0400 Subject: [PATCH 17/17] Add test to check that no CSS selector is set by default --- plugins/footnote/popcorn.footnote.unit.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/footnote/popcorn.footnote.unit.js b/plugins/footnote/popcorn.footnote.unit.js index bcc565ce3..88a08fe6f 100755 --- a/plugins/footnote/popcorn.footnote.unit.js +++ b/plugins/footnote/popcorn.footnote.unit.js @@ -54,6 +54,8 @@ test( "Popcorn Footnote Plugin", function() { plus(); equal( footnotediv.children [ 0 ].nodeName, "DIV", "Default HTML element is a div"); plus(); + equal ( footnotediv.children [ 0 ].className, "", "No CSS selector is set by default"); + plus(); }); popped.exec( 1, function() {