コード例 #1
0
ファイル: HtmlTest.php プロジェクト: sevikerr/form
 public function testAddClass()
 {
     $htmlElement = new \Fiv\Form\Element\Html();
     $currentClassName = $htmlElement->getAttribute('class');
     $this->assertEmpty($currentClassName);
     $htmlElement->addClass('test');
     $this->assertEquals('test', $htmlElement->getAttribute('class'));
     $htmlElement->setAttribute('class', '');
     $this->assertEmpty($htmlElement->getAttribute('class'));
     $htmlElement->setAttribute('class', 'custom_class');
     $this->assertEquals("custom_class", $htmlElement->getAttribute('class'));
     $htmlElement->addClass('other_class');
     $this->assertEquals('custom_class other_class', $htmlElement->getAttribute('class'));
 }