Author: pyaschenko
Date: 2010-05-11 09:17:39 -0400 (Tue, 11 May 2010)
New Revision: 16985
Modified:
root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces-queue.js
root/core/trunk/impl/src/test/resources/javascript/richfaces-queue-qunit-clear.js
root/core/trunk/impl/src/test/resources/javascript/richfaces-queue-qunit-getSize.js
root/core/trunk/impl/src/test/resources/javascript/richfaces-queue-qunit-isEmpty.js
root/core/trunk/impl/src/test/resources/javascript/richfaces-queue-qunit-request.js
root/core/trunk/impl/src/test/resources/javascript/richfaces-queue-qunit-submitFirst.js
Log:
queue bug fix and tests fix
Modified: root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces-queue.js
===================================================================
---
root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces-queue.js 2010-05-11
13:04:45 UTC (rev 16984)
+++
root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces-queue.js 2010-05-11
13:17:39 UTC (rev 16985)
@@ -56,16 +56,16 @@
var QueueEntry = function(queue, source, event, options) {
this.queue = queue;
this.source = source;
- this.options = options || {};
+ this.options = $.extend({}, options || {});
this.queueOptions = {}
var id;
// find default options for QueueEntry
- if (options.queueId) {
- if (defaultQueueOptions[options.queueId]) {
- id = options.queueId;
+ if (this.options.queueId) {
+ if (defaultQueueOptions[this.options.queueId]) {
+ id = this.options.queueId;
}
- delete options.queueId;
+ delete this.options.queueId;
} else {
var element = richfaces.getDomElement(source);
var form;
Modified:
root/core/trunk/impl/src/test/resources/javascript/richfaces-queue-qunit-clear.js
===================================================================
---
root/core/trunk/impl/src/test/resources/javascript/richfaces-queue-qunit-clear.js 2010-05-11
13:04:45 UTC (rev 16984)
+++
root/core/trunk/impl/src/test/resources/javascript/richfaces-queue-qunit-clear.js 2010-05-11
13:17:39 UTC (rev 16985)
@@ -3,15 +3,17 @@
var element = document.getElementById("testDiv");
var event = {type:"testevent"};
- var options = {requestDelay:1000, param:"value"};
+ var options = {requestDelay:1000};
+ var opts = {queueId:"myQueue", param:"value"};
// queue.clear
test("RichFaces.queue.clear", function() {
expect(3);
+ RichFaces.queue.setQueueOptions(opts.queueId, options);
ok(RichFaces.queue.isEmpty(), "empty");
- jsf.ajax.request(element, event, options);
- jsf.ajax.request(element, event, options);
- jsf.ajax.request(element, event, options);
+ jsf.ajax.request(element, event, opts);
+ jsf.ajax.request(element, event, opts);
+ jsf.ajax.request(element, event, opts);
ok(!RichFaces.queue.isEmpty(), "not empty");
RichFaces.queue.clear();
ok(RichFaces.queue.isEmpty(), "empty");
Modified:
root/core/trunk/impl/src/test/resources/javascript/richfaces-queue-qunit-getSize.js
===================================================================
---
root/core/trunk/impl/src/test/resources/javascript/richfaces-queue-qunit-getSize.js 2010-05-11
13:04:45 UTC (rev 16984)
+++
root/core/trunk/impl/src/test/resources/javascript/richfaces-queue-qunit-getSize.js 2010-05-11
13:17:39 UTC (rev 16985)
@@ -3,14 +3,16 @@
var element = document.getElementById("testDiv");
var event = {type:"testevent"};
- var options = {requestDelay:1000, param:"value"};
+ var options = {requestDelay:1000};
+ var opts = {queueId:"myQueue", param:"value"};
// queue.getSize
test("RichFaces.queue.getSize", function() {
expect(2);
+ RichFaces.queue.setQueueOptions(opts.queueId, options);
var size = RichFaces.queue.getSize();
equals(size, 0, "empty queue");
- jsf.ajax.request(element, event, options);
+ jsf.ajax.request(element, event, opts);
size = RichFaces.queue.getSize();
equals(size, 1, "not empty");
});
Modified:
root/core/trunk/impl/src/test/resources/javascript/richfaces-queue-qunit-isEmpty.js
===================================================================
---
root/core/trunk/impl/src/test/resources/javascript/richfaces-queue-qunit-isEmpty.js 2010-05-11
13:04:45 UTC (rev 16984)
+++
root/core/trunk/impl/src/test/resources/javascript/richfaces-queue-qunit-isEmpty.js 2010-05-11
13:17:39 UTC (rev 16985)
@@ -3,14 +3,16 @@
var element = document.getElementById("testDiv");
var event = {type:"testevent"};
- var options = {requestDelay:1000, param:"value"};
+ var options = {requestDelay:1000};
+ var opts = {queueId:"myQueue", param:"value"};
// queue.isEmpty
test("RichFaces.queue.isEmpty", function() {
expect(2);
+ RichFaces.queue.setQueueOptions(opts.queueId, options);
var size = RichFaces.queue.isEmpty();
ok(RichFaces.queue.isEmpty(), "empty queue");
- jsf.ajax.request(element, event, options);
+ jsf.ajax.request(element, event, opts);
size = RichFaces.queue.isEmpty();
ok(!RichFaces.queue.isEmpty(), "not empty");
});
Modified:
root/core/trunk/impl/src/test/resources/javascript/richfaces-queue-qunit-request.js
===================================================================
---
root/core/trunk/impl/src/test/resources/javascript/richfaces-queue-qunit-request.js 2010-05-11
13:04:45 UTC (rev 16984)
+++
root/core/trunk/impl/src/test/resources/javascript/richfaces-queue-qunit-request.js 2010-05-11
13:17:39 UTC (rev 16985)
@@ -3,7 +3,8 @@
var element = document.getElementById("testDiv");
var event = {type:"testevent"};
- var options = {requestDelay:1000, param:"value"};
+ var options = {requestDelay:1000};
+ var opts = {queueId:"myQueue", param:"value"};
var body = document.getElementsByTagName("body")[0];
@@ -38,6 +39,7 @@
//jsf.ajax.request
test("jsf.ajax.request - ", function() {
expect(2);
+ RichFaces.queue.setQueueOptions(opts.queueId, options);
RichFaces.ajax.jsfRequest = function (source, event, options) {
for (var i=0; i<jsf.ajax.eventHandlers.length;i++) {
Modified:
root/core/trunk/impl/src/test/resources/javascript/richfaces-queue-qunit-submitFirst.js
===================================================================
---
root/core/trunk/impl/src/test/resources/javascript/richfaces-queue-qunit-submitFirst.js 2010-05-11
13:04:45 UTC (rev 16984)
+++
root/core/trunk/impl/src/test/resources/javascript/richfaces-queue-qunit-submitFirst.js 2010-05-11
13:17:39 UTC (rev 16985)
@@ -3,12 +3,14 @@
var element = document.getElementById("testDiv");
var event = {type:"testevent"};
- var options = {requestDelay: 1000, param:"value"};
+ var options = {requestDelay: 1000};
+ var opts = {queueId:"myQueue", param:"value"};
// queue.submitFirst
test("RichFaces.queue.submitFirst", function() {
expect(2);
- jsf.ajax.request(element, event, options);
+ RichFaces.queue.setQueueOptions(opts.queueId, options);
+ jsf.ajax.request(element, event, opts);
equals(RichFaces.queue.getSize(), 1, "one queueEntry is waiting");
RichFaces.queue.submitFirst();
equals(RichFaces.queue.getSize(), 0, "empty after submitFirst()");