You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2013/02/08 09:24:14 UTC
[12/20] git commit: Improve the test for ChannelManager#drop(). It
should work with higher order functions too.
Improve the test for ChannelManager#drop(). It should work with higher order functions too.
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/1fa1094d
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/1fa1094d
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/1fa1094d
Branch: refs/heads/reference-guide
Commit: 1fa1094dc79eef135f4d8918a9956a2abb69ebb6
Parents: 7bc04e7
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed Feb 6 16:22:18 2013 +0100
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Feb 6 16:22:18 2013 +0100
----------------------------------------------------------------------
wicket-core/src/test/js/channels.js | 23 +++++++++++++++++------
1 files changed, 17 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/1fa1094d/wicket-core/src/test/js/channels.js
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/js/channels.js b/wicket-core/src/test/js/channels.js
index c97ae5b..b6b3cfa 100644
--- a/wicket-core/src/test/js/channels.js
+++ b/wicket-core/src/test/js/channels.js
@@ -30,21 +30,32 @@ jQuery(document).ready(function() {
* Verifies that the final result contains all values of the counter.
*/
test('queue', function () {
-
+
+ stop();
+
var cm = new Wicket.ChannelManager(),
ch = 'name|s',
i = 0,
result = '',
+ iterations = 10,
toExecute = function (j) {
- result += j;
- cm.done(ch);
+ return function() {
+ window.setTimeout(function() {
+ result += j;
+ cm.done(ch);
+
+ if (j === iterations - 1) {
+ start();
+
+ equal(result, '0123456789');
+ }
+ }, 1);
+ };
};
- for (; i < 10; i++) {
+ for (; i < iterations; i++) {
cm.schedule(ch, toExecute(i));
}
-
- equal(result, '0123456789');
});
/**