[Html-widget] Select fields and '0' value - again

Carl Franks fireartist at gmail.com
Fri Sep 15 11:11:18 CEST 2006

On 08/09/06, Carl Franks <fireartist at gmail.com> wrote:
> On 07/09/06, Tobias Kremer <t at funkreich.de> wrote:
> >
> > if you set
> > the initial value to '1', mock the request to '0' and process the form.
> > It then jumps back to '1'.
> okay, I see the problem.
> I've come across this in the past, when a form is shown to the user
> again to correct invalid values.
> I 'fixed' it with the hack...
> $element->value( $result->params->{$_} ) if $result->valid( $_ );
> I tried changing Widget.pm so that valid values are passed on to all
> elements in result(), but as expected, this caused a lot of failed
> tests.
> I suspect that all the failed tests were cases where the HTML is
> compared, rather than using methods to test for expected values - so
> it's impossible to say whether someone's relying on the current
> behaviour.
> (Which is why testing the HTML output sucks)
> I agree that the current behaviour is b0rken, though.
> Anyone else have any thoughts on this?

Ok, I'm going to assume that no-one is relying on (or cares about) the
current behaviour, so I'll consider it a bug and fix it.

I'm going to start going through the test files, and as much as
possible, change them to test param(), has_errors(), etc, rather than
testing against the HTML output.
04basic.t and 05strict.t will still test the html output though.

This means that when we come across a bug such as this, changing the
behaviour doesn't cause all the test files to fail, which is only
happening because the test files were written against HW's buggy


More information about the Html-widget mailing list