Selaa lähdekoodia

{{%IMPLICIT-ITERATOR}} should be a no-op

tags/0.5.0-vsc
thegrandpoobah 16 vuotta sitten
vanhempi
commit
12ce899b83
2 muutettua tiedostoa jossa 11 lisäystä ja 2 poistoa
  1. +1
    -1
      mustache.js
  2. +10
    -1
      test/unit.js

+ 1
- 1
mustache.js Näytä tiedosto

@@ -322,7 +322,7 @@ var Mustache = function() {
return _context; return _context;
} else { } else {
var iterator = "."; var iterator = ".";
if(this.pragmas["IMPLICIT-ITERATOR"]) {
if(this.pragmas["IMPLICIT-ITERATOR"] && this.pragmas["IMPLICIT-ITERATOR"].iterator) {
iterator = this.pragmas["IMPLICIT-ITERATOR"].iterator; iterator = this.pragmas["IMPLICIT-ITERATOR"].iterator;
} }
var ctx = {}; var ctx = {};


+ 10
- 1
test/unit.js Näytä tiedosto

@@ -389,7 +389,7 @@ test("'!' (Comments)", function() {
}); });


test("'%' (Pragmas)", function() { test("'%' (Pragmas)", function() {
expect(2);
expect(3);
// matches array_of_strings_options.html // matches array_of_strings_options.html
equals( equals(
@@ -417,6 +417,15 @@ test("'%' (Pragmas)", function() {
} catch (e) { } catch (e) {
equals(e.message, 'This implementation of mustache doesn\'t understand the \'I-HAVE-THE-GREATEST-MUSTACHE\' pragma'); equals(e.message, 'This implementation of mustache doesn\'t understand the \'I-HAVE-THE-GREATEST-MUSTACHE\' pragma');
} }
equals(
Mustache.to_html(
'{{%IMPLICIT-ITERATOR}}{{#dataSet}}{{.}}:{{/dataSet}}',
{ dataSet: [ 'Object 1', 'Object 2', 'Object 3' ] },
{}
),
"Object 1:Object 2:Object 3:"
);
}); });


test("Empty", function() { test("Empty", function() {


Loading…
Peruuta
Tallenna