Development

Changeset 5954

You must first sign up to be able to contribute.

Changeset 5954

Show
Ignore:
Timestamp:
11/10/07 16:06:04 (1 year ago)
Author:
fabien
Message:

fixed overriding rows and cols HTML attributes for sfWidgetFormTextarea

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/widget/sfWidgetFormTextarea.class.php

    r5952 r5954  
    2222   * @see sfWidgetForm 
    2323   */ 
     24  protected function configure($options = array(), $attributes = array()) 
     25  { 
     26    $this->setAttribute('rows', 4); 
     27    $this->setAttribute('cols', 30); 
     28  } 
     29 
     30  /** 
     31   * @see sfWidgetForm 
     32   */ 
    2433  public function render($name, $value = null, $attributes = array(), $errors = array()) 
    2534  { 
    26     return $this->renderContentTag('textarea', self::escapeOnce($value), array_merge(array('name' => $name, 'cols' => 30, 'rows' => 4), $attributes)); 
     35    return $this->renderContentTag('textarea', self::escapeOnce($value), array_merge(array('name' => $name), $attributes)); 
    2736  } 
    2837} 
  • trunk/test/unit/widget/sfWidgetFormTextareaTest.php

    r5937 r5954  
    1111require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 
    1212 
    13 $t = new lime_test(3, new lime_output_color()); 
     13$t = new lime_test(4, new lime_output_color()); 
    1414 
    1515$w = new sfWidgetFormTextarea(); 
     
    1717// ->render() 
    1818$t->diag('->render()'); 
    19 $t->is($w->render('foo', 'bar'), '<textarea name="foo" cols="30" rows="4" id="foo">bar</textarea>', '->render() renders the widget as HTML'); 
    20 $t->is($w->render('foo', '<bar>'), '<textarea name="foo" cols="30" rows="4" id="foo">&lt;bar&gt;</textarea>', '->render() escapes the content'); 
    21 $t->is($w->render('foo', '&lt;bar&gt;'), '<textarea name="foo" cols="30" rows="4" id="foo">&lt;bar&gt;</textarea>', '->render() does not double escape content'); 
     19$t->is($w->render('foo', 'bar'), '<textarea rows="4" cols="30" name="foo" id="foo">bar</textarea>', '->render() renders the widget as HTML'); 
     20$t->is($w->render('foo', '<bar>'), '<textarea rows="4" cols="30" name="foo" id="foo">&lt;bar&gt;</textarea>', '->render() escapes the content'); 
     21$t->is($w->render('foo', '&lt;bar&gt;'), '<textarea rows="4" cols="30" name="foo" id="foo">&lt;bar&gt;</textarea>', '->render() does not double escape content'); 
     22 
     23// change default attributes 
     24$t->diag('change default attributes'); 
     25$w->setAttribute('rows', 10); 
     26$t->is($w->render('foo', 'bar'), '<textarea rows="10" cols="30" name="foo" id="foo">bar</textarea>', '->render() renders the widget as HTML');