public function testStaticWhiteWithAttributes() { $icon = Icon::white_folder_open($this->testAttributes); $matcher = $this->baseIcon; $matcher['attributes']['class'] .= ' icon-white'; $matcher['attributes']['data-foo'] = 'bar'; $this->assertTag($matcher, $icon); }
/** * Adds the given classes to attributes * * @param array $classes * @return $this * @static */ public static function addClass($classes) { //Method inherited from \Bootstrapper\RenderedObject return \Bootstrapper\Icon::addClass($classes); }
/** * Adds an icon to the next button * * @param string $icon The name of the icon to call * @param array $attributes Attributes to pass to the generated icon * @param boolean $prependIcon Whether we should prepend the icon, or append it * * @return object Button instance */ public function with_icon($icon, $attributes = array(), $prependIcon = true) { // Call Icon to create the icon $icon = Icon::make($icon, $attributes); // If there was no text, just use the icon, else put a space between $value = $this->currentButton['value']; if (empty($value)) { $value = $icon; } else { $value = $prependIcon ? $icon . ' ' . $value : $value . ' ' . $icon; } // Store modified value $this->currentButton['value'] = $value; return $this; }
/** * @param \Bootstrapper\Icon $icon */ function it_can_be_given_a_prepended_icon_and_a_value($icon) { $icon->render()->willReturn("<span class='glyphicon glyphicon-bar'></span>"); $this->withValue('foo')->prependIcon($icon)->render()->shouldBe("<button type='button' class='btn btn-default'><span class='glyphicon glyphicon-bar'></span> foo</button>"); }