From cca235b1ebc1389ea6ecc7696f80231a9d04b0b0 Mon Sep 17 00:00:00 2001 From: Thomas Fuchs Date: Wed, 3 Oct 2007 17:58:33 +0000 Subject: [PATCH] Prototype: Add a test for Form.Observer. --- CHANGELOG | 2 ++ test/unit/form.html | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index bba031d..f99debd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Add a test for Form.Observer. [Christoph Sturm] + * Make sure setting opacity works on elements that have "no layout" in IE. [Thomas Fuchs] * Simplify Class.create by establishing a prototype chain when subclassing. Closes #9342. [Ben Newman] diff --git a/test/unit/form.html b/test/unit/form.html index bbb0e5f..4adcb2e 100644 --- a/test/unit/form.html +++ b/test/unit/form.html @@ -223,6 +223,31 @@ }); }}, + testFormObserver: function(){ with(this) { + var timedCounter = 0; + // should work the same way was Form.Element.Observer + var observer = new Form.Observer('form', 0.5, function(form, value) { + ++timedCounter; + }); + + // Test it's unchanged yet + assertEqual(0, timedCounter); + // Test it doesn't change on first check + wait(550, function() { + assertEqual(0, timedCounter); + // Change, test it doesn't immediately change + $('input_enabled').value = 'yowza!'; + assertEqual(0, timedCounter); + // Test it changes on next check, but not again on the next + wait(550, function() { + assertEqual(1, timedCounter); + wait(550, function() { + assertEqual(1, timedCounter); + }); + }); + }); + }}, + testFormEnabling: function(){ with(this) { var form = $('bigform') var input1 = $('dummy_disabled');