public function testDownload() { $link = new Link('/file.png'); $link->setDownload(); $this->assertEquals('<a href="/file.png" download></a>', $link->asHtml()); $link->setDownload('file'); $this->assertEquals('<a href="/file.png" download="file"></a>', $link->asHtml()); }
public function __construct($uri, $content = null, $selector = '#pagelet-data') { parent::__construct($uri, $content); $this->_tag = 'a'; $this->setAttribute('data-uri', $uri); if (!Strings::containsAny($selector, ['#', '.', ' '])) { $selector = '#' . $selector; } $this->setAttribute('data-target', $selector); }