Example #1
0
 public function testCssClasses()
 {
     $tag = new Tag('p', 'content text');
     $tag->setAttrib('class', 'lead')->addClass('text-center bg-primary text-muted')->removeClass('text-muted');
     $this->assertFalse($tag->hasClass('text-muted'));
     $this->assertEquals(['lead', 'text-center', 'bg-primary'], $tag->getClass());
     $this->assertEquals('<p class="lead text-center bg-primary">content text</p>', $tag->render());
 }
Example #2
0
 public function header($content = '', $titleTag = 'h4', $dismissible = true)
 {
     if ($titleTag) {
         $title = new Tag($titleTag, $content, ['class' => 'modal-title']);
         if ($this->getAttrib('id')) {
             $titleLabel = $this->getAttrib('id') . 'Label';
             $title->setAttrib('id', $titleLabel);
             $this->aria('labelledby', $titleLabel);
         }
         $content = $title->render();
     }
     $this->modalHeader->setContent($content);
     if ($dismissible) {
         $closeLabel = is_string($dismissible) ? ' aria-label="' . $dismissible . '"' : '';
         $this->modalHeader->prepend('<button type="button" class="close" ' . 'data-dismiss="modal"' . $closeLabel . '>' . '<span aria-hidden="true">&times;</span></button>');
     }
     return $this;
 }