Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | 2x 2x 2x 2x 2x 10x 10x 10x 8x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x | /*! GPII Dynamic Component Indexer Tests Copyright 2012 OCAD University Copyright 2012 Raising The Floor - International Licensed under the New BSD license. You may not use this file except in compliance with this License. You may obtain a copy of the License at https://github.com/GPII/universal/blob/master/LICENSE.txt */ /* eslint-env browser */ /* eslint strict: ["error", "function"] */ /* global jqUnit, fluid */ (function () { "use strict"; var gpii = fluid.registerNamespace("gpii"); fluid.defaults("gpii.tests.sessionIndexer", { gradeNames: "gpii.indexedDynamicComponent", components: { dynamicIndexTarget: "{gpii.tests.dynamicIndexerHolder}" }, dynamicIndexTargetPath: "sessionIndex", dynamicIndexKeyPath: "options.userId" }); fluid.defaults("gpii.tests.dynamicIndexerHolder", { gradeNames: "fluid.component", members: { sessionIndex: {} }, dynamicComponents: { session: { type: "gpii.tests.sessionIndexer", options: { userId: "{arguments}.0" }, createOnEvent: "onSessionStart" } }, events: { onSessionStart: null } }); gpii.tests.sessionIndexer.assertIndexed = function (that, keys) { var sessionIndex = that.sessionIndex; jqUnit.assertDeepEq("Exactly those expected components indexed", keys, fluid.keys(sessionIndex)); fluid.each(keys, function (key) { jqUnit.assertEquals("Dynamic component with key " + key + " indexed", key, that[sessionIndex[key]].options.userId); }); }; jqUnit.test("Dynamic Component Indexer", function () { var holder = gpii.tests.dynamicIndexerHolder(); gpii.tests.sessionIndexer.assertIndexed(holder, []); holder.events.onSessionStart.fire("user1"); gpii.tests.sessionIndexer.assertIndexed(holder, ["user1"]); holder.events.onSessionStart.fire("user2"); gpii.tests.sessionIndexer.assertIndexed(holder, ["user1", "user2"]); holder[holder.sessionIndex.user1].destroy(); gpii.tests.sessionIndexer.assertIndexed(holder, ["user2"]); holder[holder.sessionIndex.user2].destroy(); gpii.tests.sessionIndexer.assertIndexed(holder, []); }); })(); |