]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
Style fix for quotes.
authorDavid Humphrey <david.humphrey@senecac.on.ca>
Tue, 15 Feb 2011 16:27:45 +0000 (11:27 -0500)
committerDavid Humphrey <david.humphrey@senecac.on.ca>
Tue, 15 Feb 2011 16:27:45 +0000 (11:27 -0500)
plugins/mustache/popcorn.mustache.html
plugins/mustache/popcorn.mustache.js
plugins/mustache/popcorn.mustache.unit.js

index 668ac2bd14151c2bbee73fcf95d4dbb78c589479..f0284fab4f27491e334a67c6af68ec794c221fb3 100644 (file)
           start: 5,  // seconds
           end:  10,  // seconds
           target: 'mustache-div',
-          template: "<h1>{{header}}</h1>"                         +
-                    "{{#items}}"                                  +
-                    "  {{#first}}"                                +
-                    "    <li><strong>{{name}}</strong></li>"      +
-                    "  {{/first}}"                                +
-                    "  {{#link}}"                                 +
-                    '    <li><a href="{{url}}">{{name}}</a></li>' +
-                    "  {{/link}}"                                 +
-                    "{{/items}}"                                  +
-                    ""                                            +
-                    "{{#empty}}"                                  +
-                    "  <p>The list is empty.</p>"                 +
-                    "{{/empty}}"                                  ,
+          template: '<h1>{{header}}</h1>'                           +
+                    '{{#items}}'                                    +
+                    '  {{#first}}'                                  +
+                    '    <li><strong>{{name}}</strong></li>'        +
+                    '  {{/first}}'                                  +
+                    '  {{#link}}'                                   +
+                    '    <li><a href="{{url}}">{{name}}</a></li>'   +
+                    '  {{/link}}'                                   +
+                    '{{/items}}'                                    +
+                    '                                               +
+                    '{{#empty}}'                                    +
+                    '  <p>The list is empty.</p>'                   +
+                    '{{/empty}}'                                    ,
 
           data:     '{'                                                        +
                     '  "header": "Test 1", '                                   +
           end: 20,
           target: 'mustache-div',
           template: function(plugin, options) {
-            return  "<h1>{{header}}</h1>"                         +
-                    "{{#items}}"                                  +
-                    "  {{#first}}"                                +
-                    "    <li><strong>{{name}}</strong></li>"      +
-                    "  {{/first}}"                                +
-                    "  {{#link}}"                                 +
+            return  '<h1>{{header}}</h1>'                         +
+                    '{{#items}}'                                  +
+                    '  {{#first}}'                                +
+                    '    <li><strong>{{name}}</strong></li>'      +
+                    '  {{/first}}'                                +
+                    '  {{#link}}'                                 +
                     '    <li><a href="{{url}}">{{name}}</a></li>' +
-                    "  {{/link}}"                                 +
-                    "{{/items}}"                                  +
-                    ""                                            +
-                    "{{#empty}}"                                  +
-                    "  <p>The list is empty.</p>"                 +
-                    "{{/empty}}"                                  ;
+                    '  {{/link}}'                                 +
+                    '{{/items}}'                                  +
+                    ''                                            +
+                    '{{#empty}}'                                  +
+                    '  <p>The list is empty.</p>'                 +
+                    '{{/empty}}'                                  ;
           },
           data: {
-                  header: "Test 2",
+                  header: 'Test 2',
                   items: [
-                    { name: "red", first: true, url: "#Red" },
-                    { name: "green", link: true, url: "#Green" },
-                    { name: "blue", link: true, url: "#Blue"}
+                    { name: 'red', first: true, url: '#Red' },
+                    { name: 'green', link: true, url: '#Green' },
+                    { name: 'blue', link: true, url: '#Blue'}
                   ],
                   empty: false
                 }
           end: 30,
           target: 'mustache-div',
           template: function(plugin, options) {
-            return  "<h1>{{header}}</h1>"                         +
-                    "{{#items}}"                                  +
-                    "  {{#first}}"                                +
-                    "    <li><strong>{{name}}</strong></li>"      +
-                    "  {{/first}}"                                +
-                    "  {{#link}}"                                 +
+            return  '<h1>{{header}}</h1>'                         +
+                    '{{#items}}'                                  +
+                    '  {{#first}}'                                +
+                    '    <li><strong>{{name}}</strong></li>'      +
+                    '  {{/first}}'                                +
+                    '  {{#link}}'                                 +
                     '    <li><a href="{{url}}">{{name}}</a></li>' +
-                    "  {{/link}}"                                 +
-                    "{{/items}}"                                  +
-                    ""                                            +
-                    "{{#empty}}"                                  +
-                    "  <p>The list is empty.</p>"                 +
-                    "{{/empty}}"                                  ;
+                    '  {{/link}}'                                 +
+                    '{{/items}}'                                  +
+                    ''                                            +
+                    '{{#empty}}'                                  +
+                    '  <p>The list is empty.</p>'                 +
+                    '{{/empty}}'                                  ;
           },
           data: function(plugin, options) {
             return  JSON.parse('' +
index abe69be89fac80d8e87cc78f9de4be989ea61cdc..d15e3878485a074bab657a7587680354e8da3362 100644 (file)
@@ -4,12 +4,12 @@
 
   // TODO: swap to getScript()
   (function() {
-    var mustacheUrl = "https://github.com/janl/mustache.js/raw/master/mustache.js";
+    var mustacheUrl = 'https://github.com/janl/mustache.js/raw/master/mustache.js';
 
     var head = document.getElementsByTagName('head')[0];
     var script = document.createElement('script');
 
-    script.type = "text/javascript";
+    script.type = 'text/javascript';
     script.src = mustacheUrl;
     head.insertBefore( script, head.firstChild );
   })();
           start: 5, // seconds
           end:  15,  // seconds
           target: 'mustache',
-          template: "<h1>{{header}}</h1>"                         +
-                    "{{#bug}}"                                    +
-                    "{{/bug}}"                                    +
-                    ""                                            +
-                    "{{#items}}"                                  +
-                    "  {{#first}}"                                +
-                    "    <li><strong>{{name}}</strong></li>"      +
-                    "  {{/first}}"                                +
-                    "  {{#link}}"                                 +
+          template: '<h1>{{header}}</h1>'                         +
+                    '{{#bug}}'                                    +
+                    '{{/bug}}'                                    +
+                    ''                                            +
+                    '{{#items}}'                                  +
+                    '  {{#first}}'                                +
+                    '    <li><strong>{{name}}</strong></li>'      +
+                    '  {{/first}}'                                +
+                    '  {{#link}}'                                 +
                     '    <li><a href="{{url}}">{{name}}</a></li>' +
-                    "  {{/link}}"                                 +
-                    "{{/items}}"                                  +
-                    ""                                            +
-                    "{{#empty}}"                                  +
-                    "  <p>The list is empty.</p>"                 +
-                    "{{/empty}}"                                  ,
+                    '  {{/link}}'                                 +
+                    '{{/items}}'                                  +
+                    ''                                            +
+                    '{{#empty}}'                                  +
+                    '  <p>The list is empty.</p>'                 +
+                    '{{/empty}}'                                  ,
 
           data:     '{'                                                        +
                     '  "header": "Colors", '                                   +
@@ -74,7 +74,7 @@
                     '      {"name": "green", "link": true, "url": "#Green"}, ' +
                     '      {"name": "blue", "link": true, "url": "#Blue"} '    +
                     '  ],'                                                     +
-                    '  "empty": false'                                         +
+                    '  'empty': false'                                         +
                     '}',
           dynamic: false // The json is not going to change, load it early.
         } )
@@ -96,7 +96,7 @@
   *
   */
 
-  Popcorn.plugin( "mustache" , function() {
+  Popcorn.plugin( 'mustache' , function() {
 
       function get( name, options ) {
         return options._instance[name];
       return {
         manifest: {
           about: {
-            name: "Popcorn Mustache Plugin",
-            version: "0.1",
-            author: "David Humphrey (@humphd)",
-            website: "http://vocamus.net/dave"
+            name: 'Popcorn Mustache Plugin',
+            version: '0.1',
+            author: 'David Humphrey (@humphd)',
+            website: 'http://vocamus.net/dave'
           },
           options: {
             start: {elem:'input', type:'text', label:'In'},
           } else if ( typeOfTemplate === 'string' ) {
             set( 'template', options, options.template );
           } else {
-            throw "Mustache Plugin Error: options.template must be a String or a Function.";
+            throw 'Mustache Plugin Error: options.template must be a String or a Function.';
           }
 
           if ( typeOfData === 'function' ) {
           } else if ( typeOfData === 'object' ) {
             set( 'data', options, options.data );
           } else {
-            throw "Mustache Plugin Error: options.data must be a String, Object, or Function.";
+            throw 'Mustache Plugin Error: options.data must be a String, Object, or Function.';
           }
         },
 
index 53b3af21e166e1910dc5665d9d5a5db5082e6622..d262081416cd833c645f551ffde69a66fc72369e 100644 (file)
@@ -1,6 +1,6 @@
-test("Popcorn Mustache Plugin", function () {
+test('Popcorn Mustache Plugin', function () {
 
-  var popped = Popcorn("#video"),
+  var popped = Popcorn('#video'),
       expects = 5,
       count = 0,
       mustacheDiv = document.getElementById('mustache-div');
@@ -15,17 +15,17 @@ test("Popcorn Mustache Plugin", function () {
 
   stop();
 
-  ok('mustache' in popped, "mustache is a method of the popped instance");
+  ok('mustache' in popped, 'mustache is a method of the popped instance');
   plus();
 
-  equals ( mustacheDiv.innerHTML, "", "initially, there is nothing inside the mustache-div" );
+  equals ( mustacheDiv.innerHTML, '', 'initially, there is nothing inside the mustache-div' );
   plus();
 
   // Static strings
   popped.mustache({
     start: 1, // seconds
     end: 3, // seconds
-    template: "<h1>{{heading}}</h1>",
+    template: '<h1>{{heading}}</h1>',
     data: '{"heading": "mustache - test 1/3"}',
     target: 'mustache-div',
     dynamic: false
@@ -36,7 +36,7 @@ test("Popcorn Mustache Plugin", function () {
     start: 5, // seconds
     end: 7, // seconds
     template: function(plugin, options) {
-      return "<h1>{{heading}}</h1>";
+      return '<h1>{{heading}}</h1>';
     },
     data: function(plugin, options) {
       return JSON.parse('{"heading": "mustache - test 2/3"}');
@@ -49,9 +49,9 @@ test("Popcorn Mustache Plugin", function () {
     start: 9, // seconds
     end: 11, // seconds
     template: function(plugin, options) {
-      return "<h1>{{heading}}</h1>";
+      return '<h1>{{heading}}</h1>';
     },
-    data: { heading: "mustache - test 3/3" },
+    data: { heading: 'mustache - test 3/3' },
     target: 'mustache-div',
     dynamic: false
   } );
@@ -62,7 +62,7 @@ test("Popcorn Mustache Plugin", function () {
   video.addEventListener('timeupdate', function() {
 
     function pass(a, b) {
-      ok( "<h1>mustache - test " + a + "/" + b + "<\/h1>" === mustacheDiv.innerHTML, "Mustache template rendered" );
+      equals( '<h1>mustache - test ' + a + '/' + b + '<\/h1>', mustacheDiv.innerHTML, 'Mustache template rendered' );
       plus();
     }