コード例 #1
0
ファイル: HtmlTest.php プロジェクト: sevikerr/form
 public function testAttributes()
 {
     $tag = new Html();
     $tag->setTag('input');
     $tag->setAttributes(['value' => 123]);
     $tag->addClass('test');
     $tag->addClass('other');
     $this->assertEquals(['value' => 123, 'class' => 'test other'], $tag->getAttributes());
 }
コード例 #2
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'));
 }