Ejemplo n.º 1
0
 /**
  * test style attribute
  */
 public function testInputStyle()
 {
     $input = new TextInput('test');
     $input->setStyle(' text-align:right; ');
     $input->setWidth(300);
     $input->setHidden(true);
     $expected = array('text-align' => 'right', 'width' => '300px', 'display' => 'none');
     $this->assertEquals($expected, $input->getStyles()->all());
     $this->assertEquals(' style="text-align:right; width:300px; display:none;"', $input->renderStyle());
     // test removing style with spaces around
     $input->removeStyle(' text-align:right; ');
     $this->assertEquals(' style="width:300px; display:none;"', $input->renderStyle());
     $input->setWidth(200);
     $this->assertEquals(' style="width:200px; display:none;"', $input->renderStyle());
     $input->setHidden(false);
     $this->assertEquals(array('width' => '200px'), $input->getStyles()->all(), 'setting hidden to false should remove the display style');
 }