Skip to content
Snippets Groups Projects
Commit 6f32cd35 authored by llaffont's avatar llaffont
Browse files

Reseaux sociaux: ajout lien mail

parent 448a29ed
Branches
Tags
No related merge requests found
......@@ -32,10 +32,16 @@ class ZendAfi_View_Helper_SocialShare extends Zend_View_Helper_HtmlElement {
public function htmlForNetwork($profil, $network) {
return sprintf('<img class="%s" src="%s" onclick="socialShare(\'%s\')" alt="%s"/>',
$onclick_attr = array('facebook' => 'socialShare(\'facebook\')',
'twitter' => 'socialShare(\'twitter\')',
'mail' => sprintf('window.location=\'%s\'',
$this->view->url(array('controller' => 'index',
'action' => 'formulairecontact'))));
return sprintf('<img class="%s" src="%s" onclick="%s; return false" alt="%s"/>',
$network,
URL_IMG.'/site/'.$network.'.png',
$network,
$onclick_attr[$network],
'partager sur '.$network);
}
......
......@@ -64,11 +64,12 @@ class ZendAfi_View_Helper_SocialShareTwitterTest extends ZendAfi_View_Helper_Soc
class ZendAfi_View_Helper_SocialShareFacebookAndTwitterTest extends ZendAfi_View_Helper_SocialShareTestCase {
class ZendAfi_View_Helper_SocialShareFacebookTwitterAndMailTest extends ZendAfi_View_Helper_SocialShareTestCase {
public function setUp() {
parent::setUp();
$profil = Class_Profil::getLoader()->newInstanceWithId(26)->setLibelle('Section adultes');
$this->html = $this->_helper->socialShare($profil, array('facebook', 'twitter'));
$this->html = $this->_helper->socialShare($profil, array('facebook', 'twitter', 'mail'));
}
......@@ -82,6 +83,12 @@ class ZendAfi_View_Helper_SocialShareFacebookAndTwitterTest extends ZendAfi_View
public function imgFacebookShouldBeVisible() {
$this->assertXPath($this->html, '//div[@class="share"]//img[@class="facebook"][contains(@onclick, "socialShare(\'facebook\')")][contains(@src, "facebook")]');
}
/** @test */
public function imgMailShouldLinkToFormulaireContact() {
$this->assertXPath($this->html, '//div[@class="share"]//img[@class="mail"][contains(@onclick, "index/formulairecontact")][contains(@src, "mail")]');
}
}
?>
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment