Skip to content

Commit

Permalink
Switch activator comparison result (#103)
Browse files Browse the repository at this point in the history
* Switch activator comparison result

* Fix tests

* cs

* cs

* Update Changelog.md
  • Loading branch information
rvanlaak authored and Nyholm committed Jun 16, 2017
1 parent 7cda3cf commit 13f5c56
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
6 changes: 6 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release.

## 0.3.5

### Fixed

- Fix incorrect EditInPlace activation on Twig `is_safe` comparison

## 0.3.4

### Fixed
Expand Down
20 changes: 10 additions & 10 deletions Tests/Functional/EditInPlaceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,6 @@
*/
class EditInPlaceTest extends BaseTestCase
{
public function testDeactivatedTest()
{
$this->bootKernel();
$request = Request::create('/foobar');
$response = $this->kernel->handle($request);

self::assertSame(200, $response->getStatusCode());
self::assertNotContains('x-trans', $response->getContent());
}

public function testActivatedTest()
{
$this->bootKernel();
Expand Down Expand Up @@ -90,4 +80,14 @@ public function testIfUntranslatableLabelGetsDisabled()
$attributeDiv = $dom->getElementById('attribute-div');
self::assertEquals('translated.attribute', $attributeDiv->getAttribute('data-value'));
}

public function testDeactivatedTest()
{
$this->bootKernel();
$request = Request::create('/foobar');
$response = $this->kernel->handle($request);

self::assertSame(200, $response->getStatusCode());
self::assertNotContains('x-trans', $response->getContent());
}
}
2 changes: 1 addition & 1 deletion Twig/TranslationExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function getFilters()
*/
public function isSafe($node)
{
return $this->activator->checkRequest($this->requestStack->getMasterRequest()) ? [] : ['html'];
return $this->activator->checkRequest($this->requestStack->getMasterRequest()) ? ['html'] : [];
}

/**
Expand Down

0 comments on commit 13f5c56

Please sign in to comment.