diff --git a/AUTHORS.txt b/AUTHORS.txt
index b2168655ee0..e4be5e747c4 100644
--- a/AUTHORS.txt
+++ b/AUTHORS.txt
@@ -28,3 +28,4 @@ Keith Wood (kbwood@virginbroadband.com.au)
Maggie Costello Wachs
Richard D. Worth (rdworth.org)
Jörn Zaefferer (bassistance.de)
+Kai Schlamp (schlamp@gmx.de)
diff --git a/tests/static/ticker/default.html b/tests/static/ticker/default.html
new file mode 100644
index 00000000000..bf8625a7c73
--- /dev/null
+++ b/tests/static/ticker/default.html
@@ -0,0 +1,36 @@
+
+
+
+
+ Ticker Static Test : Default
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/unit/ticker/ticker.html b/tests/unit/ticker/ticker.html
new file mode 100644
index 00000000000..7110982edd0
--- /dev/null
+++ b/tests/unit/ticker/ticker.html
@@ -0,0 +1,48 @@
+
+
+
+
+ jQuery UI Ticker Test Suite
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Item1
+ Item2
+ Item3
+ Item4
+ Item5
+ Item6
+
+
+
+
+
diff --git a/tests/unit/ticker/ticker_core.js b/tests/unit/ticker/ticker_core.js
new file mode 100644
index 00000000000..4d501a79472
--- /dev/null
+++ b/tests/unit/ticker/ticker_core.js
@@ -0,0 +1,54 @@
+/*
+ * ticker_core.js
+ */
+
+var el;
+
+(function($) {
+
+module("ticker: core");
+
+test("nextItem returns null", function() {
+ expect(2);
+ stop();
+
+ $("#ticker").ticker({
+ initialTimeout: 0,
+ scrollTime: 0,
+ fadeTime: 0,
+ nextItem: function(lastItem) {
+ ok(true, "nextItem is called")
+ return null;
+ }
+ });
+
+ window.setTimeout(function() {
+ equals($("#ticker li:first").text(), "Item1", "ticker has not scrolled");
+ start();
+ }, 100);
+});
+
+test("last item clone retains data and bindings", function() {
+ expect(3);
+ stop();
+
+ $("#ticker li:last")
+ .data("test", "123")
+ .bind("click", function() {});
+
+ $("#ticker").ticker({
+ initialTimeout: 0,
+ scrollTime: 0,
+ fadeTime: 0,
+ nextItem: function(lastItem) {
+ ok(true, "nextItem is called");
+ equals(lastItem.data("test"), "123", "last item clone retains data");
+ ok(lastItem.data("events") != null, "last item clone retains events");
+ return null;
+ }
+ });
+
+ window.setTimeout(function() { start(); }, 200);
+});
+
+})(jQuery);
diff --git a/tests/unit/ticker/ticker_defaults.js b/tests/unit/ticker/ticker_defaults.js
new file mode 100644
index 00000000000..2bb157fb00d
--- /dev/null
+++ b/tests/unit/ticker/ticker_defaults.js
@@ -0,0 +1,16 @@
+/*
+ * ticker_defaults.js
+ */
+
+var ticker_defaults = {
+ disabled: false,
+ active: true,
+ initialTimeout: 4000,
+ mouseOnTimeout: 8000,
+ mouseOffTimeout: 4000,
+ scrollTime: 800,
+ fadeTime: 1000,
+ nextItem: null
+};
+
+commonWidgetTests('ticker', { defaults: ticker_defaults });
diff --git a/tests/unit/ticker/ticker_events.js b/tests/unit/ticker/ticker_events.js
new file mode 100644
index 00000000000..2ef682e0f43
--- /dev/null
+++ b/tests/unit/ticker/ticker_events.js
@@ -0,0 +1,106 @@
+/*
+ * ticker_events.js
+ */
+(function($) {
+
+module("ticker: events");
+
+test("beforeScroll", function() {
+ expect(4);
+ stop();
+
+ $("#ticker").ticker({
+ initialTimeout: 0,
+ scrollTime: 0,
+ fadeTime: 0,
+ nextItem: function(lastItem) { return $('TestItem '); },
+ beforeScroll: function(event, ui) {
+ ok(true, 'before scrolling fires beforeScroll callback');
+ equals($("#ticker li").length, 6, "list does have all items");
+ equals($("#ticker li:first").text(), "Item1", "Item1 still on first position");
+ equals($("#ticker li:last").text(), "Item6", "last item still in the list");
+ }
+ });
+
+ window.setTimeout(function() { start(); }, 100);
+});
+
+test("afterScroll", function() {
+ expect(5);
+ stop();
+
+ $("#ticker").ticker({
+ initialTimeout: 0,
+ scrollTime: 0,
+ fadeTime: 10000,
+ nextItem: function(lastItem) { return $('TestItem '); },
+ afterScroll: function(event, ui) {
+ ok(true, 'after scrolling fires afterScroll callback');
+ equals($("#ticker li").length, 6, "list does have all items");
+ equals($("#ticker li:first").text(), "TestItem", "TestItem is first list item");
+ ok($("#ticker li:first").css("opacity") < 1, "TestItem is not fully visible yet");
+ equals($("#ticker li:last").text(), "Item5", "Item5 is last list item");
+ }
+ });
+
+ window.setTimeout(function() { start(); }, 100);
+});
+
+test("afterFade", function() {
+ expect(5);
+ stop();
+
+ $("#ticker").ticker({
+ initialTimeout: 0,
+ scrollTime: 0,
+ fadeTime: 100,
+ nextItem: function(lastItem) { return $('TestItem '); },
+ afterFade: function(event, ui) {
+ ok(true, 'after fade fires afterFade callback');
+ equals($("#ticker li").length, 6, "list does have all items");
+ equals($("#ticker li:first").text(), "TestItem", "TestItem is first list item");
+ ok($("#ticker li:first").css("opacity") == 1, "TestItem is fully visible");
+ equals($("#ticker li:last").text(), "Item5", "Item5 is last list item");
+ }
+ });
+
+ window.setTimeout(function() { start(); }, 300);
+});
+
+test("correct order of nextItem call and events", function() {
+ expect(4);
+ stop();
+
+ var counter = 0;
+
+ $("#ticker").ticker({
+ initialTimeout: 0,
+ scrollTime: 50,
+ fadeTime: 50,
+ nextItem: function(lastItem) {
+ if (counter == 0) {
+ ok(true, "nextItem was called first")
+ }
+ return $('TestItem ');
+ },
+ beforeScroll: function(event, ui) {
+ if (counter == 0) {
+ ok(true, "beforeScroll was called second")
+ }
+ },
+ afterScroll: function(event, ui) {
+ if (counter == 0) {
+ ok(true, "afterScroll was called third")
+ }
+ },
+ afterFade: function(event, ui) {
+ if (counter == 0) {
+ ok(true, "afterFade was called fourth")
+ }
+ }
+ });
+
+ window.setTimeout(function() { start(); }, 200);
+});
+
+})(jQuery);
diff --git a/tests/unit/ticker/ticker_methods.js b/tests/unit/ticker/ticker_methods.js
new file mode 100644
index 00000000000..21d4edda38c
--- /dev/null
+++ b/tests/unit/ticker/ticker_methods.js
@@ -0,0 +1,105 @@
+/*
+ * ticker_methods.js
+ */
+(function($) {
+
+module("ticker: methods");
+
+test("init", function() {
+ $("").appendTo('body').ticker().remove();
+ ok(true, '.ticker() called on element');
+
+ $([]).ticker().remove();
+ ok(true, '.ticker() called on empty collection');
+
+ $('').ticker().remove();
+ ok(true, '.ticker() called on disconnected DOMElement - never connected');
+
+ $('').appendTo('body').remove().ticker().remove();
+ ok(true, '.ticker() called on disconnected DOMElement - removed');
+
+ var el = $('').ticker();
+ var foo = el.ticker("option", "foo");
+ el.remove();
+ ok(true, 'arbitrary option getter after init');
+
+ $('').ticker().ticker("option", "foo", "bar").remove();
+ ok(true, 'arbitrary option setter after init');
+});
+
+test("destroy", function() {
+ var beforeHtml = $("#ticker").find("div").css("font-style", "normal").end().parent().html();
+ var afterHtml = $("#ticker").ticker().ticker("destroy").parent().html();
+ equal( afterHtml, beforeHtml );
+});
+
+test("initial stop", function() {
+ expect(0);
+ stop();
+
+ $("#ticker").ticker({
+ initialTimeout: 100,
+ nextItem: function(lastItem) {
+ ok(false, "ticker should not scroll after it was stopped");
+ return lastItem;
+ }
+ });
+ $("#ticker").ticker("stop");
+
+ setTimeout(function() { start(); }, 200);
+});
+
+test("stop after scroll", function() {
+ expect(1);
+ stop();
+
+ var counter = 0;
+
+ $("#ticker").ticker({
+ initialTimeout: 0,
+ mouseOnTimeout: 100,
+ mouseOffTimeout: 100,
+ scrollTime: 0,
+ fadeTime: 0,
+ nextItem: function(lastItem) {
+ if (counter == 0) {
+ ok(true, "ticker scrolled one time");
+ $("#ticker").ticker("stop");
+ counter++;
+ return lastItem;
+ }
+ else {
+ ok(false, "ticker should not scroll after it was stopped");
+ return lastItem;
+ }
+ }
+ });
+
+ setTimeout(function() { start(); }, 300);
+});
+
+test("start", function() {
+ expect(1);
+ stop();
+
+ var started = false;
+
+ $("#ticker").ticker({
+ active: false,
+ initialTimeout: 0,
+ nextItem: function(lastItem) {
+ if (started) {
+ ok(true, "ticker scrolled after it was started");
+ $("#ticker").ticker("stop");
+ }
+ else {
+ ok(false, "ticker scrolled without being started");
+ }
+
+ }
+ });
+ window.setTimeout(function() { started = true; $("#ticker").ticker("start"); }, 200);
+ window.setTimeout(function() { start(); }, 600);
+});
+
+})(jQuery);
diff --git a/tests/unit/ticker/ticker_options.js b/tests/unit/ticker/ticker_options.js
new file mode 100644
index 00000000000..8be103670a9
--- /dev/null
+++ b/tests/unit/ticker/ticker_options.js
@@ -0,0 +1,136 @@
+/*
+ * ticker_options.js
+ */
+(function($) {
+
+module("ticker: options");
+
+test("{initalTimout: 200}", function() {
+ expect(1);
+ stop();
+ var nextCalled = false;
+ $("#ticker").ticker({
+ initialTimeout: 200,
+ nextItem: function(lastItem) {
+ nextCalled = true;
+ return lastItem;
+ }
+ });
+
+ window.setTimeout(function() {
+ if (nextCalled) {
+ ok(false, "next called in initial timeout");
+ }
+ }, 100);
+
+ window.setTimeout(function() {
+ if (nextCalled) {
+ ok(true, "next called after timeout");
+ }
+ start();
+ }, 200);
+});
+
+test("{initialTimeout: 200} after calling start method", function() {
+ expect(1);
+ stop();
+ var nextCalled = false;
+ $("#ticker").ticker({
+ initialTimeout: 200,
+ nextItem: function(lastItem) {
+ nextCalled = true;
+ return lastItem;
+ }
+ });
+
+ $("#ticker").ticker("stop");
+ $("#ticker").ticker("start");
+
+ window.setTimeout(function() {
+ if (nextCalled) {
+ ok(false, "next called in initial timeout");
+ }
+ }, 100);
+
+ window.setTimeout(function() {
+ if (nextCalled) {
+ ok(true, "next called after timeout");
+ }
+ start();
+ }, 200);
+});
+
+test("{mouseOffTimeout: 100}", function() {
+ expect(2);
+ stop();
+
+ var counter = 0;
+
+ var nextCalled = false;
+ $("#ticker").ticker({
+ initialTimeout: 0,
+ mouseOnTimeout: 10000,
+ mouseOffTimeout: 100,
+ nextItem: function(lastItem) {
+ ok(true, "Next called (one time after init and one time afterwards");
+ if (counter == 1) {
+ $("#ticker").ticker("stop");
+ }
+ counter++;
+ return lastItem;
+ }
+ });
+
+ window.setTimeout(function() { start(); }, 400 );
+});
+
+test("{mouseOnTimeout: 100}", function() {
+ expect(2);
+ stop();
+
+ var counter = 0;
+
+ var nextCalled = false;
+
+ $("#ticker").ticker({
+ initialTimeout: 0,
+ mouseOnTimeout: 100,
+ mouseOffTimeout: 10000,
+ nextItem: function(lastItem) {
+ ok(true, "Next called (one time after init and one time afterwards");
+ if (counter == 1) {
+ $("#ticker").ticker("stop");
+ }
+ counter++;
+ return lastItem;
+ }
+ });
+
+ $("#ticker").simulate("mouseover");
+ window.setTimeout(function() { start(); }, 400 );
+});
+
+test('{nextItem: function() {return $("TestItem")}}', function() {
+ expect(2);
+ stop();
+
+ var nextCalled = false;
+
+ $("#ticker").ticker({
+ initialTimeout: 0,
+ scrollTime: 0,
+ fadeTime: 0,
+ mouseOffTimeout: 10000,
+ nextItem: function(lastItem) {
+ return $("TestItem ");
+ }
+ });
+
+ window.setTimeout(function() {
+ equals($("#ticker li:first").html(), "TestItem", "new item was added");
+ equals($("#ticker li:last").html(), "Item5", "last item was removed");
+ start();
+ }, 100 );
+});
+
+})(jQuery);
diff --git a/tests/unit/ticker/ticker_tickets.js b/tests/unit/ticker/ticker_tickets.js
new file mode 100644
index 00000000000..cb0105a2847
--- /dev/null
+++ b/tests/unit/ticker/ticker_tickets.js
@@ -0,0 +1,8 @@
+/*
+ * ticker_tickets.js
+ */
+(function($) {
+
+module("ticker: tickets");
+
+})(jQuery);
diff --git a/tests/visual/all.css b/tests/visual/all.css
index d4b4805a1fb..8e44fa8aed2 100644
--- a/tests/visual/all.css
+++ b/tests/visual/all.css
@@ -82,3 +82,8 @@ li.plugin {
#droppable .draggable {
margin: 7px;
}
+
+#ticker {
+ width: 200px;
+ margin: 10px 10px 0px 10px;
+}
diff --git a/tests/visual/all.html b/tests/visual/all.html
index 6e800f344ae..4d6cd00c54c 100644
--- a/tests/visual/all.html
+++ b/tests/visual/all.html
@@ -23,6 +23,7 @@
+
@@ -183,6 +187,17 @@
Nam dui erat, auctor a, dignissim quis, sollicitudin eu, felis. Pellentesque nisi urna, interdum eget, sagittis et, consequat vestibulum, lacus. Mauris porttitor ullamcorper augue.
+
+ Ticker
+
+ Ticker Item 1
+ Ticker Item 2
+ Ticker Item 3
+ Ticker Item 4
+ Ticker Item 5
+ Ticker Item 6
+
+
+
+
+ Ticker Element 1
+ Ticker Element 2
+ Ticker Element 3
+ Ticker Element 4
+ Ticker Element 5
+ Ticker Element 6
+
+
+
diff --git a/tests/visual/ticker/ticker.html b/tests/visual/ticker/ticker.html
new file mode 100644
index 00000000000..f9bfed7a743
--- /dev/null
+++ b/tests/visual/ticker/ticker.html
@@ -0,0 +1,33 @@
+
+
+