From 862b26615e6e915a1912d9370a010247ec5e9e54 Mon Sep 17 00:00:00 2001 From: Laurent Laffont <llaffont@afi-sa.fr> Date: Mon, 11 Sep 2017 11:45:37 +0200 Subject: [PATCH] fix add widget from template link redirection --- .../View/Helper/RenderWidgetTemplates.php | 3 ++- .../controllers/WidgetControllerTest.php | 25 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/library/ZendAfi/View/Helper/RenderWidgetTemplates.php b/library/ZendAfi/View/Helper/RenderWidgetTemplates.php index 076fa1514b6..9687f725f54 100644 --- a/library/ZendAfi/View/Helper/RenderWidgetTemplates.php +++ b/library/ZendAfi/View/Helper/RenderWidgetTemplates.php @@ -62,7 +62,8 @@ class ZendAfi_View_Helper_RenderWidgetTemplates extends ZendAfi_View_Helper_Base 'controller' => 'widget', 'action' => 'add', 'template' => $section_key, - 'template_no' => $template_index]); + 'template_no' => $template_index, + 'render' => null]); return $this->_tag('a', $this->_tag('h4', $template['title']) . diff --git a/tests/application/modules/admin/controllers/WidgetControllerTest.php b/tests/application/modules/admin/controllers/WidgetControllerTest.php index 8f102ffd0b6..90cb79a7f4d 100644 --- a/tests/application/modules/admin/controllers/WidgetControllerTest.php +++ b/tests/application/modules/admin/controllers/WidgetControllerTest.php @@ -2110,6 +2110,31 @@ class WidgetControllerAddActionEmptyPostDispatchTest extends WidgetControllerWid +class WidgetControllerWidgetAddFromTemplateInPopupTest extends WidgetControllerWidgetConfigurationTestCase { + protected $_json; + + public function setUp() { + parent::setUp(); + $this->dispatch('admin/widget/add-from-template/id_profil/2/render/popup', true); + $this->_json = json_decode($this->_response->getBody()); + } + + + /** @test */ + public function titleShouldBeAddAWidget() { + $this->assertEquals('Ajouter une boîte', $this->_json->title); + } + + + /** @test */ + public function addActionShouldNotContainsRenderPopup() { + $this->assertNotContains('/render/popup', $this->_json->content); + } +} + + + + class WidgetControllerWidgetAddFromTemplateTest extends WidgetControllerWidgetConfigurationTestCase { public function setUp() { parent::setUp(); -- GitLab