Example #1
0
 /**
  * toString
  *
  * @param boolean $forcePair
  *
  * @return  string
  */
 public function toString($forcePair = false)
 {
     $this->prepareOptions();
     $attrs['id'] = $this->getAttribute('id');
     $attrs['class'] = $this->type . '-inputs ' . $this->getAttribute('class');
     return HtmlBuilder::create($this->name, $this->content, $attrs, $forcePair);
 }
 /**
  * testPrepareAttributes
  *
  * @return  void
  *
  * @covers Windwalker\Dom\Builder\HtmlBuilder::buildAttributes
  */
 public function testBuildAttributes()
 {
     $attrs = array('foo' => 'bar', 'data' => true, 'bar' => false, 'empty' => '', 'selected' => true, 'checked' => false);
     $this->assertEquals(' foo="bar" data empty="" selected="selected"', HtmlBuilder::buildAttributes($attrs));
 }
 /**
  * toString
  *
  * @param boolean $forcePair
  *
  * @return  string
  */
 public function toString($forcePair = false)
 {
     if ($this->getAttribute('disabled')) {
         $this->disabled = true;
         $this->setAttribute('disabled', null);
     }
     if ($this->getAttribute('readonly')) {
         $this->readonly = true;
         $this->setAttribute('readonly', null);
     }
     $this->prepareOptions();
     $attrs = $this->getAttributes();
     $attrs['id'] = $this->getAttribute('id');
     $attrs['class'] = $this->type . '-inputs ' . $this->getAttribute('class');
     $attrs['name'] = null;
     $attrs['onchange'] = null;
     $attrs['size'] = null;
     return HtmlBuilder::create($this->name, $this->content, $attrs, $forcePair);
 }
Example #4
0
 /**
  * Method to test create().
  *
  * @param string  $name
  * @param string  $expect
  * @param string  $tag
  * @param string  $content
  * @param array   $attribs
  * @param boolean $forcePaired
  *
  * @return void
  *
  * @covers       Windwalker\Dom\Builder\HtmlBuilder::create
  *
  * @dataProvider domTestCase
  */
 public function testCreate($name, $expect, $tag, $content, $attribs, $forcePaired)
 {
     $this->assertEquals(DomHelper::minify($expect), DomHelper::minify(HtmlBuilder::create($tag, $content, $attribs, $forcePaired)), 'Dom build case fail: ' . $name);
 }
 /**
  * toString
  *
  * @param boolean $forcePair
  *
  * @return  string
  */
 public function toString($forcePair = false)
 {
     $content = $this->content;
     $content = $content . $this->hint;
     return HtmlBuilder::create($this->name, $content, $this->attribs, $forcePair);
 }