Prototype: Add a test for Form.Observer.

This commit is contained in:
Thomas Fuchs 2007-10-03 17:58:33 +00:00
parent 6c94af703d
commit cca235b1eb
2 changed files with 27 additions and 0 deletions

View File

@ -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]

View File

@ -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');