tao-test/app/tao/views/js/test/generis.tree.select/test.js

329 lines
685 KiB
JavaScript
Raw Normal View History

2022-08-29 20:14:13 +02:00
/**
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; under version 2
* of the License (non-upgradable).
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Copyright (c) 2013 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT);
*
*
*/
define(['jquery', 'lodash', 'lib/jquery.mockjax/jquery.mockjax','uri', 'generis.tree.select'], function($, _, ajaxMock, uri, GenerisTreeSelectClass) {
'use strict';
QUnit.module('generis.tree.select',{beforeEach: function() {
$.mockjax.clear();
}});
var fixture = 'qunit-fixture';
var fixtureVisible = 'qunit-fixture-visible';
$.mockjaxSettings.logger = null;
$.mockjaxSettings.responseTime = 1;
QUnit.test('generis.tree.select initialization usual and paginated', function(assert) {
var done = assert.async();
var rootNode = 'http://www.tao.lu/Ontologies/TAOSubject.rdf#Subject';
var selected = [];
var testTakers1000 = {"data":"Test-taker","type":"class","attributes":{"id":"http_2_www_0_tao_0_lu_1_Ontologies_1_TAOSubject_0_rdf_3_Subject","class":"node-class","data-uri":"http:\/\/www.tao.lu\/Ontologies\/TAOSubject.rdf#Subject","data-classUri":null,"data-signature":"4837dfe9a9ac93af9b404605843ac4bc31a16e4f898075a132a718c1c04d5406"},"state":"open","children":[{"data":"Generation yeGf","type":"class","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529018304924","class":"node-class","data-uri":"http:\/\/localhost:88\/#i1556529018304924","data-classUri":"http:\/\/www.tao.lu\/Ontologies\/TAOSubject.rdf#Subject","data-signature":"994b71c8921c9a75beef2d9395e1f7fd757a1fe202fa30ffc2cefcd36a5e98fe"},"state":"open","children":[{"data":"Test-Taker 0","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529019327625","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529019327625","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"dff3eff0857ea118c317c01f76f736bc3930f18b1afca81bafdeb3d2bcb6f534"}},{"data":"Test-Taker 1","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529019723426","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529019723426","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"8d813c7e5d1ad20dc31fd5d32f34b4a3c9a9b8ab6cf3c48cbb7c148b33949eed"}},{"data":"Test-Taker 10","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529021538635","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529021538635","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"7ccb3b451f2f435ce35008bb2112d40af8572cb199ab99d7ced9ad9951ac5b63"}},{"data":"Test-Taker 100","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290355669125","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290355669125","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"cf9735098a9ef2a33170d2deac6c5156e404fd6d26f7f4d3b4723759eb606b65"}},{"data":"Test-Taker 101","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529035778126","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529035778126","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"012ec45aa31d943f59a9b819d63dc3b4ea216e11ed487af6820f2fdf3a3a10ca"}},{"data":"Test-Taker 102","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290356882127","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290356882127","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"f6a7319336205ae4b1e75131e1115d691834aaddf7c6f6550b12dac6ecd00576"}},{"data":"Test-Taker 103","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290362076128","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290362076128","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"9b4960b4df95020c34e3a92b6e182dbf8895fc2c91fbdb5ef20351293febd716"}},{"data":"Test-Taker 104","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290369733129","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290369733129","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"130022af77f553fd0cc125159c0a353242a13da7841e554f47fd8b55bb9f3231"}},{"data":"Test-Taker 105","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290362440130","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290362440130","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"5af77f61d488d3f7482a73c764df232f7965301156c670a894d0e89adb9b2d0a"}},{"data":"Test-Taker 106","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290363000131","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290363000131","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"a06020054544ed2fcfe17be9bc07efe85ad51ab0ddfb8a06b46cdf7143d58ec2
var testTakers10 = {"data":"Test-taker","type":"class","attributes":{"id":"http_2_www_0_tao_0_lu_1_Ontologies_1_TAOSubject_0_rdf_3_Subject","class":"node-class","data-uri":"http:\/\/www.tao.lu\/Ontologies\/TAOSubject.rdf#Subject","data-classUri":null,"data-signature":"4837dfe9a9ac93af9b404605843ac4bc31a16e4f898075a132a718c1c04d5406"},"state":"open","children":[{"data":"Generation yeGf","type":"class","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529018304924","class":"node-class","data-uri":"http:\/\/localhost:88\/#i1556529018304924","data-classUri":"http:\/\/www.tao.lu\/Ontologies\/TAOSubject.rdf#Subject","data-signature":"994b71c8921c9a75beef2d9395e1f7fd757a1fe202fa30ffc2cefcd36a5e98fe"},"state":"open","children":[{"data":"Test-Taker 0","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529019327625","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529019327625","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"dff3eff0857ea118c317c01f76f736bc3930f18b1afca81bafdeb3d2bcb6f534"}},{"data":"Test-Taker 1","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529019723426","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529019723426","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"8d813c7e5d1ad20dc31fd5d32f34b4a3c9a9b8ab6cf3c48cbb7c148b33949eed"}},{"data":"Test-Taker 10","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529021538635","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529021538635","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"7ccb3b451f2f435ce35008bb2112d40af8572cb199ab99d7ced9ad9951ac5b63"}},{"data":"Test-Taker 100","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290355669125","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290355669125","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"cf9735098a9ef2a33170d2deac6c5156e404fd6d26f7f4d3b4723759eb606b65"}},{"data":"Test-Taker 101","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529035778126","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529035778126","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"012ec45aa31d943f59a9b819d63dc3b4ea216e11ed487af6820f2fdf3a3a10ca"}},{"data":"Test-Taker 102","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290356882127","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290356882127","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"f6a7319336205ae4b1e75131e1115d691834aaddf7c6f6550b12dac6ecd00576"}},{"data":"Test-Taker 103","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290362076128","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290362076128","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"9b4960b4df95020c34e3a92b6e182dbf8895fc2c91fbdb5ef20351293febd716"}},{"data":"Test-Taker 104","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290369733129","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290369733129","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"130022af77f553fd0cc125159c0a353242a13da7841e554f47fd8b55bb9f3231"}},{"data":"Test-Taker 105","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290362440130","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290362440130","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"5af77f61d488d3f7482a73c764df232f7965301156c670a894d0e89adb9b2d0a"}},{"data":"Test-Taker 106","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290363000131","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290363000131","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"a06020054544ed2fcfe17be9bc07efe85ad51ab0ddfb8a06b46cdf7143d58ec2"}
var options = {
dataUrl: "/tao/GenerisTree/getData",
dataUrl1000: "/tao/GenerisTree/getData1000",
deliveriesOrder: "http://www.tao.lu/Ontologies/TAODelivery.rdf#AssembledDeliveryCompilationTime",
deliveriesOrderdir: "desc",
deliveryTreeId: "eligible-delivery-tree-2",
editingMode: false,
isDacEnabled: false,
subjectTreeId: "eligible-testTaker-tree-1",
testTakerDataUrl: "/taoTestCenter/TestCenterManager/getData",
title: "Add Eligibility"
};
var treeContainerSelector = '#' + fixture +' .t10';
var treeContainerSelectorPaginated = '#' + fixture +' .t1000';
var paginateAllSelector = '.paginate-all';
var paginateMoreSelector = '.paginate-more';
$.mockjax({
url: options.dataUrl,
status: 200,
responseText: testTakers10
});
$.mockjax({
url: options.dataUrl1000,
status: 200,
responseText: testTakers1000
});
var tree10 = new GenerisTreeSelectClass(treeContainerSelector, options.dataUrl, {
actionId : 'treeOptions.actionId',
saveUrl : 'treeOptions.saveUrl',
saveData : {},
checkedNodes : _.map(selected, uri.encode), //generis tree uses "encoded uri" to check nodes
serverParameters : {
openParentNodes : selected, //generis tree uses normal if to open nodes...
rootNode : rootNode
},
paginate : 10,
checkResourcePermissions: options.isDacEnabled,
saveErrorCallback: {},
saveCallback: {},
});
var tree1000 = new GenerisTreeSelectClass(treeContainerSelectorPaginated, options.dataUrl1000, {
actionId : 'treeOptions.actionId',
saveUrl : 'treeOptions.saveUrl',
saveData : {},
checkedNodes : _.map(selected, uri.encode), //generis tree uses "encoded uri" to check nodes
serverParameters : {
openParentNodes : selected, //generis tree uses normal if to open nodes...
rootNode : rootNode
},
paginate : 10,
checkResourcePermissions: options.isDacEnabled
});
assert.expect(31);
assert.ok(tree10, 'tree was initialized and prepared');
assert.ok(tree1000, ' paginated tree was initialized and prepared');
assert.equal(tree10.checkedNodes.length, 0, 'checked nodes default ');
assert.equal(tree10.hiddenNodes.length, 0, 'hidden nodes default ');
assert.equal(tree10.state, 0, 'default state');
assert.ok(tree10.treeOptions.callback.beforecheck, 'beforecheck callback is defined');
assert.ok(tree10.treeOptions.callback.beforedata, 'beforedata callback is defined');
assert.ok(tree10.treeOptions.callback.beforeopen, 'beforeopen callback is defined');
assert.ok(tree10.treeOptions.callback.beforeuncheck, 'beforeuncheck callback is defined');
assert.ok(tree10.treeOptions.callback.onchange, 'onchange callback is defined');
assert.ok(tree10.treeOptions.callback.ondata, 'ondata callback is defined');
assert.ok(tree10.treeOptions.callback.onload, 'onload callback is defined');
assert.ok(tree10.treeOptions.callback.onopen, 'onopen callback is defined');
assert.ok(tree10.treeOptions.callback.onselect, 'onselect callback is defined');
assert.ok(tree10.options.saveCallback, 'saveCallback method is defined');
assert.ok(tree10.options.saveErrorCallback, 'saveCallback method is defined');
assert.ok(tree10.__proto__.check, 'check method is defined');
assert.ok(tree10.__proto__.checkPermissionsRecursively, 'checkPermissionsRecursively method is defined');
assert.ok(tree10.__proto__.convertDataWithPermissions, 'convertDataWithPermissions method is defined');
assert.ok(tree10.__proto__.getChecked, 'getChecked method is defined');
assert.ok(tree10.__proto__.init, 'init method is defined');
assert.ok(tree10.__proto__.paginateInstances, 'paginateInstances method is defined');
assert.ok(tree10.__proto__.removeHiddenNodes, 'removeHiddenNodes method is defined');
assert.ok(tree10.__proto__.saveData, 'saveData method is defined');
assert.ok(tree10.__proto__.trace, 'trace method is defined');
_.delay(function () {
assert.equal($(treeContainerSelector + ' '+ paginateAllSelector).length, 0, 'usual tree doesent have "pagination all" button');
assert.equal($(treeContainerSelector + ' '+ paginateMoreSelector).length, 0, 'usual tree doesent have "pagination more" button');
assert.equal($(treeContainerSelector + ' '+ '.leaf').length, 10, 'all received items were rendered');
assert.equal($(treeContainerSelectorPaginated + ' '+ paginateAllSelector).length, 1, 'paginated tree has 1 "pagination all" button');
assert.equal($(treeContainerSelectorPaginated + ' '+ paginateMoreSelector).length, 1, 'paginated tree has 1 "pagination more" button');
assert.equal($(treeContainerSelectorPaginated + ' '+ '.leaf').length, 12, 'all received items were rendered + pagination buttons as tree leafs');
done();
});
});
QUnit.test('check/uncheck functionality', function(assert) {
var done = assert.async();
var rootNode = 'http://www.tao.lu/Ontologies/TAOSubject.rdf#Subject';
var selected = [];
var testTakers10 = {"data":"Test-taker","type":"class","attributes":{"id":"http_2_www_0_tao_0_lu_1_Ontologies_1_TAOSubject_0_rdf_3_Subject","class":"node-class","data-uri":"http:\/\/www.tao.lu\/Ontologies\/TAOSubject.rdf#Subject","data-classUri":null,"data-signature":"4837dfe9a9ac93af9b404605843ac4bc31a16e4f898075a132a718c1c04d5406"},"state":"open","children":[{"data":"Generation yeGf","type":"class","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529018304924","class":"node-class","data-uri":"http:\/\/localhost:88\/#i1556529018304924","data-classUri":"http:\/\/www.tao.lu\/Ontologies\/TAOSubject.rdf#Subject","data-signature":"994b71c8921c9a75beef2d9395e1f7fd757a1fe202fa30ffc2cefcd36a5e98fe"},"state":"open","children":[{"data":"Test-Taker 0","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529019327625","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529019327625","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"dff3eff0857ea118c317c01f76f736bc3930f18b1afca81bafdeb3d2bcb6f534"}},{"data":"Test-Taker 1","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529019723426","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529019723426","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"8d813c7e5d1ad20dc31fd5d32f34b4a3c9a9b8ab6cf3c48cbb7c148b33949eed"}},{"data":"Test-Taker 10","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529021538635","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529021538635","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"7ccb3b451f2f435ce35008bb2112d40af8572cb199ab99d7ced9ad9951ac5b63"}},{"data":"Test-Taker 100","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290355669125","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290355669125","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"cf9735098a9ef2a33170d2deac6c5156e404fd6d26f7f4d3b4723759eb606b65"}},{"data":"Test-Taker 101","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529035778126","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529035778126","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"012ec45aa31d943f59a9b819d63dc3b4ea216e11ed487af6820f2fdf3a3a10ca"}},{"data":"Test-Taker 102","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290356882127","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290356882127","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"f6a7319336205ae4b1e75131e1115d691834aaddf7c6f6550b12dac6ecd00576"}},{"data":"Test-Taker 103","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290362076128","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290362076128","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"9b4960b4df95020c34e3a92b6e182dbf8895fc2c91fbdb5ef20351293febd716"}},{"data":"Test-Taker 104","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290369733129","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290369733129","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"130022af77f553fd0cc125159c0a353242a13da7841e554f47fd8b55bb9f3231"}},{"data":"Test-Taker 105","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290362440130","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290362440130","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"5af77f61d488d3f7482a73c764df232f7965301156c670a894d0e89adb9b2d0a"}},{"data":"Test-Taker 106","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290363000131","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290363000131","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"a06020054544ed2fcfe17be9bc07efe85ad51ab0ddfb8a06b46cdf7143d58ec2"}
var options = {
dataUrl: "/tao/GenerisTree/getData",
deliveriesOrder: "http://www.tao.lu/Ontologies/TAODelivery.rdf#AssembledDeliveryCompilationTime",
deliveriesOrderdir: "desc",
deliveryTreeId: "eligible-delivery-tree-2",
editingMode: false,
isDacEnabled: false,
subjectTreeId: "eligible-testTaker-tree-1",
testTakerDataUrl: "/taoTestCenter/TestCenterManager/getData",
title: "Add Eligibility"
};
var treeContainerSelector = '#' + fixture +' .t10';
var itemSelector = treeContainerSelector + ' .node-instance.leaf';
$.mockjax({
url: options.dataUrl,
status: 200,
responseText: testTakers10
});
var tree10 = new GenerisTreeSelectClass(treeContainerSelector, options.dataUrl, {
actionId : 'treeOptions.actionId',
saveUrl : 'treeOptions.saveUrl',
saveData : {},
checkedNodes : _.map(selected, uri.encode), //generis tree uses "encoded uri" to check nodes
serverParameters : {
openParentNodes : selected, //generis tree uses normal if to open nodes...
rootNode : rootNode
},
paginate : 10,
checkResourcePermissions: options.isDacEnabled
});
assert.ok(tree10, 'tree was initialized and prepared');
_.delay(function () {
$(itemSelector).eq(0).children('a').click();
assert.ok($(itemSelector).eq(0).children('a').hasClass('clicked'), 'item reacts to click and \'clicked\' class appended');
assert.ok($(itemSelector).eq(0).children('a').hasClass('checked'), 'item reacts to click and \'checked\' class appended');
$(itemSelector).eq(1).children('a').click();
assert.ok($(itemSelector + ' > a.checked').length === 2, 'several items are able to be selected');
done();
});
});
QUnit.test('pagination possibility check', function(assert) {
var done = assert.async();
var rootNode = 'http://www.tao.lu/Ontologies/TAOSubject.rdf#Subject';
var selected = [];
var testTakers1000 = {"data":"Test-taker","type":"class","attributes":{"id":"http_2_www_0_tao_0_lu_1_Ontologies_1_TAOSubject_0_rdf_3_Subject","class":"node-class","data-uri":"http:\/\/www.tao.lu\/Ontologies\/TAOSubject.rdf#Subject","data-classUri":null,"data-signature":"4837dfe9a9ac93af9b404605843ac4bc31a16e4f898075a132a718c1c04d5406"},"state":"open","children":[{"data":"Generation yeGf","type":"class","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529018304924","class":"node-class","data-uri":"http:\/\/localhost:88\/#i1556529018304924","data-classUri":"http:\/\/www.tao.lu\/Ontologies\/TAOSubject.rdf#Subject","data-signature":"994b71c8921c9a75beef2d9395e1f7fd757a1fe202fa30ffc2cefcd36a5e98fe"},"state":"open","children":[{"data":"Test-Taker 0","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529019327625","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529019327625","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"dff3eff0857ea118c317c01f76f736bc3930f18b1afca81bafdeb3d2bcb6f534"}},{"data":"Test-Taker 1","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529019723426","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529019723426","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"8d813c7e5d1ad20dc31fd5d32f34b4a3c9a9b8ab6cf3c48cbb7c148b33949eed"}},{"data":"Test-Taker 10","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529021538635","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529021538635","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"7ccb3b451f2f435ce35008bb2112d40af8572cb199ab99d7ced9ad9951ac5b63"}},{"data":"Test-Taker 100","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290355669125","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290355669125","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"cf9735098a9ef2a33170d2deac6c5156e404fd6d26f7f4d3b4723759eb606b65"}},{"data":"Test-Taker 101","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529035778126","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529035778126","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"012ec45aa31d943f59a9b819d63dc3b4ea216e11ed487af6820f2fdf3a3a10ca"}},{"data":"Test-Taker 102","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290356882127","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290356882127","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"f6a7319336205ae4b1e75131e1115d691834aaddf7c6f6550b12dac6ecd00576"}},{"data":"Test-Taker 103","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290362076128","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290362076128","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"9b4960b4df95020c34e3a92b6e182dbf8895fc2c91fbdb5ef20351293febd716"}},{"data":"Test-Taker 104","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290369733129","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290369733129","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"130022af77f553fd0cc125159c0a353242a13da7841e554f47fd8b55bb9f3231"}},{"data":"Test-Taker 105","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290362440130","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290362440130","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"5af77f61d488d3f7482a73c764df232f7965301156c670a894d0e89adb9b2d0a"}},{"data":"Test-Taker 106","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290363000131","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290363000131","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"a06020054544ed2fcfe17be9bc07efe85ad51ab0ddfb8a06b46cdf7143d58ec2
var testTakers1000Page2 = [{"data":"Test-Taker 107","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290367679132","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290367679132","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"0c86992bb0c3a6ca96c4bd59b4bf96901cf63b5ef050891e7058a4d2e768f0ff"}},{"data":"Test-Taker 108","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290369399133","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290369399133","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"37ab4a7406d02d31080a1c29b6c9f62bbbe99d11d0cfbc46a71906e5751ef5b0"}},{"data":"Test-Taker 109","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290373957134","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290373957134","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"db28f778665b179a442ed483f4664d23157d88182f364a496052d1c90ed68b16"}},{"data":"Test-Taker 11","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529021829636","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529021829636","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"f76cbb905c8bb90ddf18c6ee538723f56cab1757527a7b43f3e25fd456435805"}},{"data":"Test-Taker 110","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290371589135","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290371589135","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"c1f036ba5661e8bf5ce1af6a271d42f0dad3b50d0879897faa3164c8986be830"}},{"data":"Test-Taker 111","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290376074136","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290376074136","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"8e948fdba592c22d869ada1b13d9f8dbc6836ee292f7bf08bb747abfa6a7fa15"}},{"data":"Test-Taker 112","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290375603137","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290375603137","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"700c0ab18a6b38db65cc9c9dced6401f93f063f4c384dcec97bdfa065fde92b9"}},{"data":"Test-Taker 113","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290379795138","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290379795138","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"3c159c601ca67db2cd7047a6211f0461457da013fbd6b1652b291ee049b5f0dc"}},{"data":"Test-Taker 114","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290372164139","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290372164139","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"2d43cf7f94ea613bc307439119c582468182fb049e224adc0ef76178bea90855"}},{"data":"Test-Taker 115","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290381437140","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290381437140","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"6c4b884a712c80a837cab81fb8899aaa4230da1b7f629526832d48bb4e4078fa"}}];
var testTakers1000All = [{"data":"Test-Taker 116","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529038693141","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529038693141","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"a42427112d8c5fedffda08da87e8bc059c8c8d95652fdcd826ea724706239350"}},{"data":"Test-Taker 117","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290389156142","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290389156142","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"1fe0320da3aab6977607409abb1aec660da8788b6e856b0295fb3f8bee188147"}},{"data":"Test-Taker 118","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290383702143","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290383702143","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"803234ed2ee6777fd02dfb38d1732b2d2a2ac6c001cee36c8d6072a65b4959ed"}},{"data":"Test-Taker 119","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290381040144","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290381040144","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"b26de837bcbbd77af31df087b611802f8a8a053d220dc2842f4d6174297240e7"}},{"data":"Test-Taker 12","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529021532137","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529021532137","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"c970f00f7e93119bb323c7adb1c7d8731d9ba52baec634b8f27fb7569401db7c"}},{"data":"Test-Taker 120","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290394095145","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290394095145","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"07c15be52643dabc857fbcfefce05dc29dd7369a356b32769d9614c777738f10"}},{"data":"Test-Taker 121","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290397355146","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290397355146","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"316d456c18f61b1bd19e19768ff8924ffdee4875a8d42117c435ae53444d2940"}},{"data":"Test-Taker 122","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290394490147","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290394490147","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"9af156507c1d9033a518ff9484b496539ee96db20c3280d648347cb837a8d813"}},{"data":"Test-Taker 123","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529039387148","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529039387148","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"f7c2a1420dc962eb5526e673c3a268480ab77f03c8eaa85dbe2bd5b434efeaf3"}},{"data":"Test-Taker 124","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290398463149","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290398463149","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"e2e15d9ed75782d58289da7257b5089d19a7643619031d4d390d6adfdeaa2079"}},{"data":"Test-Taker 125","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290391157150","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290391157150","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"2bb5e24d8a816c5fe80747c97d1db464131f9bc10f8a157be9f364b6155374e4"}},{"data":"Test-Taker 126","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529040396151","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529040396151","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"ea1ef29f34444c2870e0f9e2897bdb462261a2e39c28a1c1d2be85537efce24c"}},{"data":"Test-Taker 127","
var options = {
dataUrl: "/tao/GenerisTree/getData1000",
deliveriesOrder: "http://www.tao.lu/Ontologies/TAODelivery.rdf#AssembledDeliveryCompilationTime",
deliveriesOrderdir: "desc",
deliveryTreeId: "eligible-delivery-tree-2",
editingMode: false,
isDacEnabled: false,
subjectTreeId: "eligible-testTaker-tree-1",
testTakerDataUrl: "/taoTestCenter/TestCenterManager/getData",
title: "Add Eligibility"
};
var treeContainerSelectorPaginated = '#' + fixture +' .t1000';
var itemSelector = treeContainerSelectorPaginated + ' .node-instance.leaf';
var paginateAllSelector = '.paginate-all';
var paginateMoreSelector = '.paginate-more';
$.mockjax({
url: options.dataUrl,
status: 200,
response: function (req) {
if(req.data.offset > 0 && req.data.limit ===10) {
this.responseText = testTakers1000Page2;
} else if (req.data.limit > 10){
this.responseText = testTakers1000All;
} else{
this.responseText = testTakers1000;
}
}
});
var tree1000 = new GenerisTreeSelectClass(treeContainerSelectorPaginated, options.dataUrl, {
actionId : 'treeOptions.actionId',
saveUrl : 'treeOptions.saveUrl',
saveData : {},
checkedNodes : _.map(selected, uri.encode), //generis tree uses "encoded uri" to check nodes
serverParameters : {
openParentNodes : selected, //generis tree uses normal if to open nodes...
rootNode : rootNode
},
paginate : 10,
checkResourcePermissions: options.isDacEnabled
});
assert.ok(tree1000, 'tree was initialized and prepared');
_.delay(function () {
assert.equal($(itemSelector).length, 10, 'ten items rendered as expected ');
$(treeContainerSelectorPaginated + ' '+ paginateMoreSelector).children('a').click();
_.delay(function(){
assert.equal($(itemSelector).length, 20, 'ten paginated items rendered as expected ');
$(treeContainerSelectorPaginated + ' '+ paginateAllSelector).children('a').click();
_.delay(function () {
assert.equal($(itemSelector).length, 1000, 'all items rendered as expected ');
done();
});
});
});
});
QUnit.test('visual playground', function(assert) {
var done = assert.async();
var rootNode = 'http://www.tao.lu/Ontologies/TAOSubject.rdf#Subject';
var selected = [];
var testTakers1000 = {"data":"Test-taker","type":"class","attributes":{"id":"http_2_www_0_tao_0_lu_1_Ontologies_1_TAOSubject_0_rdf_3_Subject","class":"node-class","data-uri":"http:\/\/www.tao.lu\/Ontologies\/TAOSubject.rdf#Subject","data-classUri":null,"data-signature":"4837dfe9a9ac93af9b404605843ac4bc31a16e4f898075a132a718c1c04d5406"},"state":"open","children":[{"data":"Generation yeGf","type":"class","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529018304924","class":"node-class","data-uri":"http:\/\/localhost:88\/#i1556529018304924","data-classUri":"http:\/\/www.tao.lu\/Ontologies\/TAOSubject.rdf#Subject","data-signature":"994b71c8921c9a75beef2d9395e1f7fd757a1fe202fa30ffc2cefcd36a5e98fe"},"state":"open","children":[{"data":"Test-Taker 0","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529019327625","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529019327625","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"dff3eff0857ea118c317c01f76f736bc3930f18b1afca81bafdeb3d2bcb6f534"}},{"data":"Test-Taker 1","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529019723426","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529019723426","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"8d813c7e5d1ad20dc31fd5d32f34b4a3c9a9b8ab6cf3c48cbb7c148b33949eed"}},{"data":"Test-Taker 10","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529021538635","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529021538635","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"7ccb3b451f2f435ce35008bb2112d40af8572cb199ab99d7ced9ad9951ac5b63"}},{"data":"Test-Taker 100","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290355669125","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290355669125","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"cf9735098a9ef2a33170d2deac6c5156e404fd6d26f7f4d3b4723759eb606b65"}},{"data":"Test-Taker 101","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529035778126","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529035778126","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"012ec45aa31d943f59a9b819d63dc3b4ea216e11ed487af6820f2fdf3a3a10ca"}},{"data":"Test-Taker 102","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290356882127","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290356882127","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"f6a7319336205ae4b1e75131e1115d691834aaddf7c6f6550b12dac6ecd00576"}},{"data":"Test-Taker 103","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290362076128","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290362076128","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"9b4960b4df95020c34e3a92b6e182dbf8895fc2c91fbdb5ef20351293febd716"}},{"data":"Test-Taker 104","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290369733129","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290369733129","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"130022af77f553fd0cc125159c0a353242a13da7841e554f47fd8b55bb9f3231"}},{"data":"Test-Taker 105","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290362440130","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290362440130","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"5af77f61d488d3f7482a73c764df232f7965301156c670a894d0e89adb9b2d0a"}},{"data":"Test-Taker 106","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290363000131","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290363000131","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"a06020054544ed2fcfe17be9bc07efe85ad51ab0ddfb8a06b46cdf7143d58ec2
var testTakers1000Page2 = [{"data":"Test-Taker 107","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290367679132","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290367679132","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"0c86992bb0c3a6ca96c4bd59b4bf96901cf63b5ef050891e7058a4d2e768f0ff"}},{"data":"Test-Taker 108","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290369399133","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290369399133","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"37ab4a7406d02d31080a1c29b6c9f62bbbe99d11d0cfbc46a71906e5751ef5b0"}},{"data":"Test-Taker 109","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290373957134","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290373957134","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"db28f778665b179a442ed483f4664d23157d88182f364a496052d1c90ed68b16"}},{"data":"Test-Taker 11","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529021829636","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529021829636","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"f76cbb905c8bb90ddf18c6ee538723f56cab1757527a7b43f3e25fd456435805"}},{"data":"Test-Taker 110","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290371589135","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290371589135","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"c1f036ba5661e8bf5ce1af6a271d42f0dad3b50d0879897faa3164c8986be830"}},{"data":"Test-Taker 111","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290376074136","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290376074136","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"8e948fdba592c22d869ada1b13d9f8dbc6836ee292f7bf08bb747abfa6a7fa15"}},{"data":"Test-Taker 112","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290375603137","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290375603137","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"700c0ab18a6b38db65cc9c9dced6401f93f063f4c384dcec97bdfa065fde92b9"}},{"data":"Test-Taker 113","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290379795138","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290379795138","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"3c159c601ca67db2cd7047a6211f0461457da013fbd6b1652b291ee049b5f0dc"}},{"data":"Test-Taker 114","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290372164139","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290372164139","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"2d43cf7f94ea613bc307439119c582468182fb049e224adc0ef76178bea90855"}},{"data":"Test-Taker 115","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290381437140","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290381437140","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"6c4b884a712c80a837cab81fb8899aaa4230da1b7f629526832d48bb4e4078fa"}}];
var testTakers1000All = [{"data":"Test-Taker 116","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529038693141","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529038693141","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"a42427112d8c5fedffda08da87e8bc059c8c8d95652fdcd826ea724706239350"}},{"data":"Test-Taker 117","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290389156142","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290389156142","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"1fe0320da3aab6977607409abb1aec660da8788b6e856b0295fb3f8bee188147"}},{"data":"Test-Taker 118","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290383702143","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290383702143","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"803234ed2ee6777fd02dfb38d1732b2d2a2ac6c001cee36c8d6072a65b4959ed"}},{"data":"Test-Taker 119","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290381040144","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290381040144","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"b26de837bcbbd77af31df087b611802f8a8a053d220dc2842f4d6174297240e7"}},{"data":"Test-Taker 12","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529021532137","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529021532137","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"c970f00f7e93119bb323c7adb1c7d8731d9ba52baec634b8f27fb7569401db7c"}},{"data":"Test-Taker 120","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290394095145","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290394095145","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"07c15be52643dabc857fbcfefce05dc29dd7369a356b32769d9614c777738f10"}},{"data":"Test-Taker 121","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290397355146","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290397355146","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"316d456c18f61b1bd19e19768ff8924ffdee4875a8d42117c435ae53444d2940"}},{"data":"Test-Taker 122","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290394490147","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290394490147","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"9af156507c1d9033a518ff9484b496539ee96db20c3280d648347cb837a8d813"}},{"data":"Test-Taker 123","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529039387148","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529039387148","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"f7c2a1420dc962eb5526e673c3a268480ab77f03c8eaa85dbe2bd5b434efeaf3"}},{"data":"Test-Taker 124","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290398463149","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290398463149","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"e2e15d9ed75782d58289da7257b5089d19a7643619031d4d390d6adfdeaa2079"}},{"data":"Test-Taker 125","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i15565290391157150","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i15565290391157150","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"2bb5e24d8a816c5fe80747c97d1db464131f9bc10f8a157be9f364b6155374e4"}},{"data":"Test-Taker 126","type":"instance","attributes":{"id":"http_2_localhost_4_88_1__3_i1556529040396151","class":"node-instance","data-uri":"http:\/\/localhost:88\/#i1556529040396151","data-classUri":"http:\/\/localhost:88\/#i1556529018304924","data-signature":"ea1ef29f34444c2870e0f9e2897bdb462261a2e39c28a1c1d2be85537efce24c"}},{"data":"Test-Taker 127","
var options = {
dataUrl: "/tao/GenerisTree/getData1000",
deliveriesOrder: "http://www.tao.lu/Ontologies/TAODelivery.rdf#AssembledDeliveryCompilationTime",
deliveriesOrderdir: "desc",
deliveryTreeId: "eligible-delivery-tree-2",
editingMode: false,
isDacEnabled: false,
subjectTreeId: "eligible-testTaker-tree-1",
testTakerDataUrl: "/taoTestCenter/TestCenterManager/getData",
title: "Add Eligibility"
};
var treeContainerSelectorPaginated = '#' + fixtureVisible +' .t1000';
var itemSelector = treeContainerSelectorPaginated + ' .node-instance.leaf';
$.mockjax({
url: options.dataUrl,
status: 200,
response: function (req) {
if(req.data.offset > 0 && req.data.limit ===10) {
this.responseText = testTakers1000Page2;
} else if (req.data.limit > 10){
this.responseText = testTakers1000All;
} else{
this.responseText = testTakers1000;
}
}
});
var tree1000 = new GenerisTreeSelectClass(treeContainerSelectorPaginated, options.dataUrl, {
actionId : 'treeOptions.actionId',
saveUrl : 'treeOptions.saveUrl',
saveData : {},
checkedNodes : _.map(selected, uri.encode), //generis tree uses "encoded uri" to check nodes
serverParameters : {
openParentNodes : selected, //generis tree uses normal if to open nodes...
rootNode : rootNode
},
paginate : 10,
checkResourcePermissions: options.isDacEnabled
});
assert.ok(tree1000, 'tree was initialized and prepared');
_.delay(function () {
assert.equal($(itemSelector).length, 10, 'ten items rendered as expected ');
done();
});
});
});