public function testRenderWithSingleContainerUnordered()
 {
     $list = ListElement::createUnordered()->addItem(ListItem::create()->appendText(Paragraph::create()->appendText('Item 1')))->addItem(ListItem::create()->appendText(Div::create()->appendText('Item 2')))->addItem(ListItem::create()->appendText(Span::create()->appendText('Item 3')));
     $expected = '<ul>' . '<li><p>Item 1</p></li>' . '<li><div>Item 2</div></li>' . '<li><span>Item 3</span></li>' . '</ul>';
     $rendered = $list->render();
     $this->assertEquals($expected, $rendered);
 }
 public function __construct(array $attributes = array())
 {
     parent::__construct($attributes);
     $this->addClass('pagination');
     if ($this->hasAttribute('SIZE')) {
         $size = $this->getAttribute('SIZE');
         $this->ignoreAttribute('SIZE');
         switch ($size) {
             case 'large':
             case 'lg':
                 $this->addClass('pagination-lg');
                 break;
             case 'small':
             case 'sm':
                 $this->addClass('pagination-sm');
                 break;
         }
     }
 }
Example #3
0
 protected static function consumeListElements(&$text, $markup)
 {
     $listElements = array();
     $first = true;
     $textLength = strlen($text);
     do {
         $level = 1;
         for ($i = 0; $i < $textLength; $i++) {
             switch ($text[$i]) {
                 case $markup:
                     if ($first) {
                         if ($markup == $text[$i + 1]) {
                             return $listElements;
                         } else {
                             $first = false;
                         }
                     }
                     $i++;
                     while ($markup == $text[$i++]) {
                         $level++;
                     }
                     break 2;
                 case ' ':
                 case "\t":
                     break;
                 default:
                     return $listElements;
             }
         }
         $text = substr($text, $i);
         if (is_null($listElement = ListElement::consume($text, $markup))) {
             print $i . ' ' . $textLength . "\n";
             $listElement = new Blank();
         }
         if ("\n" == $text[0]) {
             $text = substr($text, 1);
         }
         $listElement->level = $level;
         $listElements[] = $listElement;
         $textLength = strlen($text);
     } while ($textLength);
     return $listElements;
 }
Example #4
0
 /**
  * Constructor
  */
 public function __construct($field)
 {
     parent::__construct($field);
     $this->attributes['multiple'] = 'multiple';
 }
Example #5
0
 /**
  * Constructor
  * Make $value and array
  */
 public function __construct(\Foundation\Form\Field $field)
 {
     parent::__construct($field);
     $this->value = array();
 }
Example #6
0
 public function __construct(array $attributes = array())
 {
     parent::__construct($attributes);
     $this->addClass('pager');
 }
 public function __construct(array $attributes = array())
 {
     parent::__construct($attributes);
     $this->setTagName('OL');
     $this->addClass('breadcrumb');
 }