public function testCarouselComplex()
 {
     $carousel = Carousel::create(array(array('image' => 'foo', 'alt_text' => 'bar', 'caption' => 'caption', 'label' => 'label', 'attributes' => $this->testAttributes), array('image' => 'foo', 'alt_text' => 'bar', 'caption' => 'caption', 'label' => 'label', 'attributes' => $this->testAttributes), array('image' => 'foo', 'alt_text' => 'bar', 'caption' => 'caption', 'label' => 'label', 'attributes' => $this->testAttributes), array('image' => 'foo', 'alt_text' => 'bar', 'caption' => 'caption', 'label' => 'label', 'attributes' => $this->testAttributes)), $this->testAttributes);
     // Matcher for the slides
     $matcherSlide = $this->innerItem;
     $matcherSlide['child']['children']['only']['child']['attributes'] = array('alt' => 'bar', 'class' => 'foo', 'data-foo' => 'bar');
     // Matcher for the captions
     $matcherCaption = $this->innerItem;
     $matcherCaption['child']['children'] = array('count' => 4, 'only' => array('tag' => 'div', 'attributes' => array('class' => 'item'), 'child' => array('tag' => 'div', 'attributes' => array('class' => 'carousel-caption'), 'child' => array('tag' => 'h4', 'content' => 'label'), 'descendant' => array('tag' => 'p', 'content' => 'caption'))));
     $this->carouselMarkup($carousel);
     $this->assertTag($matcherSlide, $carousel);
     $this->assertTag($matcherCaption, $carousel);
 }
Exemple #2
0
 /**
  * Adds the given classes to attributes
  *
  * @param array $classes
  * @return $this 
  * @static 
  */
 public static function addClass($classes)
 {
     //Method inherited from \Bootstrapper\RenderedObject
     return \Bootstrapper\Carousel::addClass($classes);
 }
 /**
  * Prints out the current Carousel instance
  *
  * @return string A carousel
  */
 public function __toString()
 {
     // Render main wrapper
     $this->attributes['id'] = substr($this->hash, 1);
     $html = '<div' . HTML::attributes($this->attributes) . '>';
     // Render items
     $html .= '<div class="carousel-inner">';
     foreach ($this->items as $key => $item) {
         $html .= $this->createItem($item, $key);
     }
     $html .= '</div>';
     // Render navigation
     $html .= Carousel::navigation($this->hash, $this->prev, $this->next);
     $html .= '</div>';
     return $html;
 }