Permalink
Browse files

Minor tweaks. Updated to versions in parallel commit of JsViews (pre …

…beta 13)
  • Loading branch information...
1 parent 203f39b commit 6d31cf7eb8a10d63bd4f43872cd8f5ef7557ef44 @BorisMoore committed May 20, 2012
Showing with 7 additions and 6 deletions.
  1. +4 −4 jsrender.js
  2. +1 −1 test/perf-compare.html
  3. +2 −1 test/unit/jsrender-tests-no-jquery.js
View
@@ -6,9 +6,9 @@
* Copyright 2012, Boris Moore
* Released under the MIT License.
*/
-// informal pre beta commit counter: 11
+// informal pre beta commit counter: 13
-this.jsviews || this.jQuery && jQuery.views || (function(window, undefined) {
+this.jsviews || this.jQuery && jQuery.views || (function(global, undefined) {
//========================== Top-level vars ==========================
@@ -17,7 +17,7 @@ this.jsviews || this.jQuery && jQuery.views || (function(window, undefined) {
$, rTag, rTmplString, extend,
sub = {},
FALSE = false, TRUE = true,
- jQuery = window.jQuery,
+ jQuery = global.jQuery,
rPath = /^(?:null|true|false|\d[\d.]*|([\w$]+|~([\w$]+)|#(view|([\w$]+))?)([\w$.]*?)(?:[.[]([\w$]+)\]?)?|(['"]).*\8)$/g,
// nil object helper view viewProperty pathTokens leafToken string
@@ -781,7 +781,7 @@ this.jsviews || this.jQuery && jQuery.views || (function(window, undefined) {
////////////////////////////////////////////////////////////////////////////////////////////////
// jQuery is not loaded.
- $ = window.jsviews = jsv;
+ $ = global.jsviews = jsv;
$.extend = function(target, source) {
var name;
target = target || {};
View
@@ -18,7 +18,7 @@
<em>Rendered content:</em><br /><br />
<table><tbody id="output"></tbody></table>
-<br /><em>Times in milliseconds:</em>
+<br /><em>Times in microseconds:</em>
<table><tbody id="results"></tbody></table>
<script type="text/javascript">
@@ -166,14 +166,15 @@ test("values", function() {
});
test("expressions", function() {
- expect(7);
+ expect(8);
equal( compileTmpl( "{{:a++}}" ), "error:Syntax error", "a++" );
equal( compileTmpl( "{{:(a,b)}}" ), "error:Syntax error", "(a,b)" );
equal( jsviews.templates( "{{: a+2}}" ).render({ a: 2, b: false }), "4", "a+2");
equal( jsviews.templates( "{{: b?'yes':'no' }}" ).render({ a: 2, b: false }), "no", "b?'yes':'no'");
equal( jsviews.templates( "{{:(a||-1) + (b||-1) }}" ).render({ a: 2, b: 0 }), "1", "a||-1");
equal( jsviews.templates( "{{:3*b()*!a*4/3}}" ).render({ a: false, b: function () { return 3; }}), "12", "3*b()*!a*4/3");
equal( jsviews.templates( "{{:a%b}}" ).render({ a: 30, b: 16}), "14", "a%b");
+ equal( jsviews.templates( "A_{{if v1 && v2 && v3 && v4}}no{{else !v1 && v2 || v3 && v4}}yes{{/if}}_B" ).render({v1:true,v2:false,v3:2,v4:"foo"}), "A_yes_B", "x && y || z");
});
module( "{{for}}" );

0 comments on commit 6d31cf7

Please sign in to comment.