/** * Returns a \r8\HTML\Tag object that represents this instance * * @return \r8\HTML\Tag */ public function getTag() { $tag = new \r8\HTML\Tag('input', null, array("type" => 'checkbox', "value" => 'on', "name" => $this->getName())); if ($this->getValue()) { $tag->setAttr("checked", "checked"); } return $tag; }
public function testRender() { $tag = new \r8\HTML\Tag("input"); $this->assertSame("<input />", $tag->render()); $tag->setTag("option"); $this->assertSame("<option></option>", $tag->render()); $tag->setAttr("value", "WA"); $this->assertSame('<option value="WA"></option>', $tag->render()); $tag->setAttr("selected"); $this->assertSame('<option value="WA" selected></option>', $tag->render()); $tag->setContent("Washington"); $this->assertSame('<option value="WA" selected>Washington</option>', $tag->render()); }