Changeset 6113
- Timestamp:
- 11/20/07 11:07:00 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/widget/sfWidgetFormInputPassword.class.php
r5937 r6113 20 20 { 21 21 /** 22 * Configures the current widget. 23 * 24 * Available options: 25 * 26 * * always_render_empty: true if you want the input value to be always empty when rendering (true by default) 27 * 22 28 * @see sfWidgetFormInput 23 29 */ … … 26 32 parent::configure($options, $attributes); 27 33 34 $this->addOption('always_render_empty', true); 35 28 36 $this->setOption('type', 'password'); 29 37 } 38 39 /** 40 * @see sfWidgetForm 41 */ 42 public function render($name, $value = null, $attributes = array(), $errors = array()) 43 { 44 return parent::render($name, $this->getOption('always_render_empty') ? null : $value, $attributes, $errors); 45 } 30 46 } trunk/test/unit/widget/sfWidgetFormInputPasswordTest.php
r5937 r6113 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test( 1, new lime_output_color());13 $t = new lime_test(3, new lime_output_color()); 14 14 15 15 $w = new sfWidgetFormInputPassword(); … … 18 18 $t->diag('->render()'); 19 19 $t->is($w->render('foo'), '<input type="password" name="foo" id="foo" />', '->render() renders the widget as HTML'); 20 21 $t->is($w->render('foo', 'bar'), '<input type="password" name="foo" id="foo" />', '->render() renders the widget as HTML'); 22 23 $w->setOption('always_render_empty', false); 24 $t->is($w->render('foo', 'bar'), '<input type="password" name="foo" value="bar" id="foo" />', '->render() renders the widget as HTML');