Form class tests and updates

Still rockin' that XHTML4 nonsense. Updates to HTML5 (sans self closing tags) and added tests.
This commit is contained in:
Joshua Sherman 2014-01-03 23:45:52 -05:00
parent 13e9507b49
commit f0b5bfa459
3 changed files with 180 additions and 15 deletions

View file

@ -79,7 +79,7 @@ class Form extends Object
$additional .= ' class="' . $classes . '"'; $additional .= ' class="' . $classes . '"';
} }
return '<input type="' . $type . '" name="' . $name . '" id="' . $name . '"' . $additional . ' />'; return '<input type="' . $type . '" name="' . $name . '" id="' . $name . '"' . $additional . '>';
} }
// }}} // }}}
@ -250,11 +250,6 @@ class Form extends Object
return $this->input($name, $value, $classes, $additional, 'checkbox', $checked); return $this->input($name, $value, $classes, $additional, 'checkbox', $checked);
} }
// }}}
// {{{ Checkboxes
// @todo
// }}} // }}}
// {{{ Radio Button // {{{ Radio Button
@ -276,12 +271,7 @@ class Form extends Object
} }
// }}} // }}}
// {{{ Radio Buttons // {{{ Textarea
// @todo
// }}}
// {{{ Text Area
/** /**
* Textarea * Textarea
@ -567,7 +557,7 @@ class Form extends Object
{ {
$options = $part . '_options'; $options = $part . '_options';
$selected = 'selected_' . $part; $selected = 'selected_' . $part;
$html .= ' ' . $this->select($name . '[' . $part . ']', $$options, $$selected, $classes, $additional); $html .= ($html == '' ? '' : ' ') . $this->select($name . '[' . $part . ']', $$options, $$selected, $classes, $additional);
} }
return $html; return $html;
@ -670,7 +660,7 @@ class Form extends Object
foreach ($parts as $part => $size) foreach ($parts as $part => $size)
{ {
$html .= ($html != '' ? ' ' : ''); $html .= ($html != '' ? ' ' : '');
$html .= '<input type="input" name="' . $name . '[' . $part . ']" id="' . $name . '[' . $part . ']" value="' . $value[$part] . '" minlength="' . $size . '" maxlength="' . $size . '"' . $additional . ' />'; $html .= '<input type="input" name="' . $name . '[' . $part . ']" id="' . $name . '[' . $part . ']" value="' . $value[$part] . '" minlength="' . $size . '" maxlength="' . $size . '"' . $additional . '>';
} }
return $html; return $html;

View file

@ -1,7 +1,6 @@
Cache Cache
Config Config
Database Database
Form
HTML HTML
Model Model
Module Module

176
tests/classes/FormTest.php Normal file

File diff suppressed because one or more lines are too long