Skip to content

Commit

Permalink
v1.0.8 release
Browse files Browse the repository at this point in the history
Feature improvements:
  - Improvements (and associated bug fixes) when converters return arrays.
    With minor breakng change for some advanced scenarios:

    Converters which return arrays now have an improved heuristic behavior
    to determine whether to return the array (retArray) as value for the
    first argument, or as an array of values for multiple bindTo/bindFrom
    targets.
    (If bindTo/bindFrom is an array of length l, l > 1 and the converter
    is returning an array retArray of length l, then treat retArray as an
    array of values for the multiple targets bindTo/bindFrom targets)
    In addition the heurisic default behavior can be overidden by setting
    retArray.arg0 = true/false.

    See http://jsviews.com/#tagoptions@bindto
    and http://jsviews.com/#hierarchypatterns@picker-multi

Several bug fixes, and code improvements, particularly for data-linked
<select> tags (including multiselect), and {{checkboxgroup}} tags:

  - #450
    multiiselect not updating when linked array changes

  - #449
    If the selected value of a data-linked <select> is set prior to adding
    options, selection is not always established correctly

Additional small corrections or improvements to documentation, and some
additional unit tests...
  • Loading branch information
BorisMoore committed Oct 25, 2020
1 parent 3b3f669 commit 9bb4aab
Show file tree
Hide file tree
Showing 30 changed files with 4,932 additions and 2,311 deletions.
4 changes: 2 additions & 2 deletions jquery.observable.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! JsObservable v1.0.7: http://jsviews.com/#jsobservable */
/*! JsObservable v1.0.8: http://jsviews.com/#jsobservable */
/*
* Subcomponent of JsViews
* Data change events for data-linking
Expand Down Expand Up @@ -44,7 +44,7 @@ if (!$ || !$.fn) {
throw "jquery.observable.js requires jQuery"; // We require jQuery
}

var versionNumber = "v1.0.7",
var versionNumber = "v1.0.8",
_ocp = "_ocp", // Observable contextual parameter
$observe, $observable,

Expand Down
4 changes: 2 additions & 2 deletions jquery.observable.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion jquery.observable.min.js.map

Large diffs are not rendered by default.

176 changes: 115 additions & 61 deletions jquery.views.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions jquery.views.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion jquery.views.min.js.map

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions jsrender.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! JsRender v1.0.7: http://jsviews.com/#jsrender */
/*! JsRender v1.0.8: http://jsviews.com/#jsrender */
/*! **VERSION FOR WEB** (For NODE.JS see http://jsviews.com/download/jsrender-node.js) */
/*
* Best-of-breed templating in browser or on Node.js.
Expand Down Expand Up @@ -44,7 +44,7 @@ var setGlobals = $ === false; // Only set globals if script block in browser (no

$ = $ && $.fn ? $ : global.jQuery; // $ is jQuery passed in by CommonJS loader (Browserify), or global jQuery.

var versionNumber = "v1.0.7",
var versionNumber = "v1.0.8",
jsvStoreName, rTag, rTmplString, topView, $views, $expando,
_ocp = "_ocp", // Observable contextual parameter

Expand Down Expand Up @@ -617,8 +617,8 @@ function convertArgs(tagElse, bound) { // tag.cvtArgs() or tag.cvtArgs(tagElse?,
}
bindFrom = bindFrom || [0];
l = bindFrom.length;
if (!$isArray(converter) || converter.length !== l) {
converter = [converter];
if (!$isArray(converter) || (converter.arg0 !== false && (l === 1 || converter.length !== l || converter.arg0))) {
converter = [converter]; // Returning converter as first arg, even if converter value is an array
bindFrom = [0];
l = 1;
}
Expand Down Expand Up @@ -1008,7 +1008,7 @@ View.prototype = {
if ($subSettings._cchCt > this.cache._ct) {
this.cache = {_ct: $subSettings._cchCt};
}
return this.cache[key] || (this.cache[key] = cpFnStore[key](this.data, this, $sub));
return this.cache[key] !== undefined ? this.cache[key] : (this.cache[key] = cpFnStore[key](this.data, this, $sub));
},
_is: "view"
};
Expand Down
4 changes: 2 additions & 2 deletions jsrender.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion jsrender.min.js.map

Large diffs are not rendered by default.

182 changes: 118 additions & 64 deletions jsviews.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions jsviews.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion jsviews.min.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jsviews",
"version": "v1.0.7",
"version": "v1.0.8",
"description": "Next-generation MVVM and MVP framework - built on top of JsRender templates. Bringing templates to life...",
"main": "./jsviews.js",
"author": {
Expand Down Expand Up @@ -35,7 +35,7 @@
"browserify": "^11.0.1",
"glob-stream": "^5.0.0",
"gulp": "^3.9.0",
"jsrender": "^1.0.7",
"jsrender": "^1.0.8",
"qunit": "^0.7.6"
},
"dependencies": {
Expand Down
12 changes: 6 additions & 6 deletions test/browserify/bundles/1-bundle.js

Large diffs are not rendered by default.

192 changes: 123 additions & 69 deletions test/browserify/bundles/10-errors-bundle.js

Large diffs are not rendered by default.

370 changes: 239 additions & 131 deletions test/browserify/bundles/11-errors-bundle.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions test/browserify/bundles/12-nested-bundle.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions test/browserify/bundles/2-bundle.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions test/browserify/bundles/3-bundle.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions test/browserify/bundles/4-bundle.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions test/browserify/bundles/5-bundle.js

Large diffs are not rendered by default.

192 changes: 123 additions & 69 deletions test/browserify/bundles/6-bundle.js

Large diffs are not rendered by default.

192 changes: 123 additions & 69 deletions test/browserify/bundles/7-bundle.js

Large diffs are not rendered by default.

184 changes: 119 additions & 65 deletions test/browserify/bundles/8-bundle.js

Large diffs are not rendered by default.

194 changes: 124 additions & 70 deletions test/browserify/bundles/8B-bundle.js

Large diffs are not rendered by default.

184 changes: 119 additions & 65 deletions test/browserify/bundles/9-bundle.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions test/unit-tests/requirejs-config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Configure loading modules from the download directory,
requirejs.config({
"baseUrl": "//www.jsviews.com/download", // Or point to correct local path on your system: "baseUrl": "/",
// "baseUrl": "../../", // Or point to correct local path on your system: "baseUrl": "/",
"baseUrl": "//www.jsviews.com/download", // Or point to correct local path on your system: "baseUrl": "/download",
// "baseUrl": "../../download", // Or point to correct local path on your system: "baseUrl": "/download",
"paths": {
"jquery": "//code.jquery.com/jquery-3.5.1",
"jsrender": "./jsrender",
Expand Down
26 changes: 26 additions & 0 deletions test/unit-tests/tests-jsrender-no-jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ QUnit.test("expressions", function(assert) {
assert.equal($.templates("{{:!true === false}}").render({}), "true", "!true === false");
assert.equal($.templates("{{:false === !true}}").render({}), "true", "false === !true");
assert.equal($.templates("{{:false === !null}}").render({}), "false", "false === !null");
assert.equal($.templates("{{:\"'\" + 1 + '\"' + 2 + '\\' + 3}}").render({}), "'1\"2\\3", "'1\"2\\3");
});

QUnit.module("{{for}}");
Expand Down Expand Up @@ -1233,6 +1234,31 @@ QUnit.test("itemVar", function(assert) {
"itemVar with {{props}}{{else}}{{/props}}, and passing context to nested templates");
});

QUnit.test("contextual parameter", function(assert) {
var teams = [
{title: "The A Team", members: [{name: "Jeff"}, {name: "Maria"}]},
{title: "The B Team", members: [{name: "Francis"}]}
];

assert.equal($.templates(
"{{if members.length ~teamTitle=title ~teamData=#data ~teamIndex=#index}}"
+ "{{for members itemVar='~member'}}"
+ "{{:~teamTitle}} "
+ "{{:~teamData.title}} "
+ "{{:~teamIndex}} "
+ "{{:~member.name}} "
+ "{{/for}}"
+ "{{/if}}"
).render(teams),
"The A Team The A Team 0 Jeff The A Team The A Team 0 Maria The B Team The B Team 1 Francis ",
"contextual parameter passing to inner context");

assert.equal($.templates(
"{^{if 1 ~a='A'+\"B\"+'\"'+\"'\"+\"\\'\"}}{^{:'Inner'+~a}}{{/if}}").render(),
"InnerAB\"'\\'",
"contextual parameter correctly escaping quotes and backslash");
});

QUnit.module("api no jQuery");
QUnit.test("templates", function(assert) {
// ................................ Arrange ..................................
Expand Down
Loading

0 comments on commit 9bb4aab

Please sign in to comment.