-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue that popup methods are rendered twice (See #4).
- Loading branch information
Showing
2 changed files
with
25 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Netzmacht\LeafletPHP\Test\Encoder; | ||
|
||
use Netzmacht\JavascriptBuilder\Type\AnonymousFunction; | ||
use Netzmacht\LeafletPHP\Definition\UI\Popup; | ||
use Netzmacht\LeafletPHP\Test\TestCase; | ||
|
||
class UIEncoderTest extends TestCase | ||
{ | ||
public function testPopupMethodsAreRendered() | ||
{ | ||
$leaflet = $this->getBuilder(); | ||
|
||
$popup = new Popup('popup'); | ||
$popup->on('add', (new AnonymousFunction())->addLine('console.log("add");')); | ||
|
||
$this->assertSame( | ||
'layers.popup = L.popup([]);' | ||
. "\n" | ||
. 'layers.popup.on("add", function() { console.log("add"); });', | ||
$leaflet->encode($popup) | ||
); | ||
} | ||
} |