-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from rabol/master
Implemented Pinterest
- Loading branch information
Showing
6 changed files
with
175 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
<?php | ||
|
||
namespace Jorenvh\Share\Test; | ||
|
||
use Jorenvh\Share\ShareFacade; | ||
|
||
class PinterestShareTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function it_can_generate_a_pinterest_share_link() | ||
{ | ||
$result = ShareFacade::page('https://codeswitch.be')->pinterest(); | ||
$expected = '<div id="social-links"><ul><li><a href="http://pinterest.com/pin/create/button/?url=https://codeswitch.be" class="social-button " id=""><span class="fa fa-pinterest"></span></a></li></ul></div>'; | ||
|
||
$this->assertEquals($expected, $result); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_can_generate_a_pinterest_share_link_with_fa5() | ||
{ | ||
config(['laravel-share.fontAwesomeVersion' => 5]); | ||
$result = ShareFacade::page('https://codeswitch.be')->pinterest(); | ||
$expected = '<div id="social-links"><ul><li><a href="http://pinterest.com/pin/create/button/?url=https://codeswitch.be" class="social-button " id=""><span class="fab fa-pinterest"></span></a></li></ul></div>'; | ||
|
||
$this->assertEquals($expected, $result); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_can_generate_a_pinterest_share_link_with_a_custom_class() | ||
{ | ||
$result = ShareFacade::page('https://codeswitch.be', null, ['class' => 'my-class']) | ||
->pinterest(); | ||
$expected = '<div id="social-links"><ul><li><a href="http://pinterest.com/pin/create/button/?url=https://codeswitch.be" class="social-button my-class" id=""><span class="fa fa-pinterest"></span></a></li></ul></div>'; | ||
|
||
$this->assertEquals($expected, $result); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_can_generate_a_pinterest_share_link_with_a_custom_class_with_fa5() | ||
{ | ||
config(['laravel-share.fontAwesomeVersion' => 5]); | ||
$result = ShareFacade::page('https://codeswitch.be', null, ['class' => 'my-class']) | ||
->pinterest(); | ||
$expected = '<div id="social-links"><ul><li><a href="http://pinterest.com/pin/create/button/?url=https://codeswitch.be" class="social-button my-class" id=""><span class="fab fa-pinterest"></span></a></li></ul></div>'; | ||
|
||
$this->assertEquals($expected, $result); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_can_generate_a_pinterest_share_link_with_a_custom_class_and_custom_id() | ||
{ | ||
$result = ShareFacade::page('https://codeswitch.be', null, ['class' => 'my-class', 'id' => 'my-id']) | ||
->pinterest(); | ||
$expected = '<div id="social-links"><ul><li><a href="http://pinterest.com/pin/create/button/?url=https://codeswitch.be" class="social-button my-class" id="my-id"><span class="fa fa-pinterest"></span></a></li></ul></div>'; | ||
|
||
$this->assertEquals($expected, $result); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_can_generate_a_pinterest_share_link_with_a_custom_class_and_custom_id_with_fa5() | ||
{ | ||
config(['laravel-share.fontAwesomeVersion' => 5]); | ||
$result = ShareFacade::page('https://codeswitch.be', null, ['class' => 'my-class', 'id' => 'my-id']) | ||
->pinterest(); | ||
$expected = '<div id="social-links"><ul><li><a href="http://pinterest.com/pin/create/button/?url=https://codeswitch.be" class="social-button my-class" id="my-id"><span class="fab fa-pinterest"></span></a></li></ul></div>'; | ||
|
||
$this->assertEquals($expected, $result); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_can_generate_a_pinterest_share_link_with_custom_prefix_and_suffix() | ||
{ | ||
$result = ShareFacade::page('https://codeswitch.be', null, [], '<ul>', '</ul>') | ||
->pinterest(); | ||
$expected = '<ul><li><a href="http://pinterest.com/pin/create/button/?url=https://codeswitch.be" class="social-button " id=""><span class="fa fa-pinterest"></span></a></li></ul>'; | ||
|
||
$this->assertEquals($expected, $result); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_can_generate_a_pinterest_share_link_with_custom_prefix_and_suffix_with_fa5() | ||
{ | ||
config(['laravel-share.fontAwesomeVersion' => 5]); | ||
$result = ShareFacade::page('https://codeswitch.be', null, [], '<ul>', '</ul>') | ||
->pinterest(); | ||
$expected = '<ul><li><a href="http://pinterest.com/pin/create/button/?url=https://codeswitch.be" class="social-button " id=""><span class="fab fa-pinterest"></span></a></li></ul>'; | ||
|
||
$this->assertEquals($expected, $result); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_can_generate_a_pinterest_share_link_with_all_extra_options() | ||
{ | ||
$result = ShareFacade::page('https://codeswitch.be', 'title that is not used for fb', ['class' => 'my-class my-class2', 'id' => 'fb-share'], '<ul>', '</ul>') | ||
->pinterest(); | ||
$expected = '<ul><li><a href="http://pinterest.com/pin/create/button/?url=https://codeswitch.be" class="social-button my-class my-class2" id="fb-share"><span class="fa fa-pinterest"></span></a></li></ul>'; | ||
|
||
$this->assertEquals($expected, $result); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_can_generate_a_pinterest_share_link_with_all_extra_options_fa5() | ||
{ | ||
config(['laravel-share.fontAwesomeVersion' => 5]); | ||
$result = ShareFacade::page('https://codeswitch.be', 'title that is not used for fb', ['class' => 'my-class my-class2', 'id' => 'fb-share'], '<ul>', '</ul>') | ||
->pinterest(); | ||
$expected = '<ul><li><a href="http://pinterest.com/pin/create/button/?url=https://codeswitch.be" class="social-button my-class my-class2" id="fb-share"><span class="fab fa-pinterest"></span></a></li></ul>'; | ||
|
||
$this->assertEquals($expected, $result); | ||
} | ||
} |