From 838e10c348a2e05d38d7e5db4880b87f7b9131cd Mon Sep 17 00:00:00 2001
From: gloas <gloas@git-test.afi-sa.fr>
Date: Mon, 2 Dec 2013 17:25:19 +0000
Subject: [PATCH] correction ajout panier ajax : script opacDialogClose shoud
 be present

---
 .../opac/views/scripts/panier/ajout-ajax-success.phtml        | 3 ++-
 .../modules/opac/controllers/PanierControllerTest.php         | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/application/modules/opac/views/scripts/panier/ajout-ajax-success.phtml b/application/modules/opac/views/scripts/panier/ajout-ajax-success.phtml
index e106b99d953..f94a9c87f7f 100644
--- a/application/modules/opac/views/scripts/panier/ajout-ajax-success.phtml
+++ b/application/modules/opac/views/scripts/panier/ajout-ajax-success.phtml
@@ -8,8 +8,9 @@ if($this->id_module){
 	$url_reload = $this->absoluteUrl(['controller' => 'modules-accueil',
 													'action' => 'render-module',
 													'id' => $this->id_module],null,true);
-	echo "<script>$('.boite.panier').reload('".$url_reload."');opacDialogClose();</script>";
+	echo "<script>$('.boite.panier').reload('".$url_reload."');</script>";
 }
+echo "<script>opacDialogClose();<script>";
 ?>
 <div class="ajout-result"><span><?php echo $this->_('La notice ').$this->notice->getTitrePrincipal().$this->_(' a bien été ajoutée au panier ').$this->panier->getLibelle(); ?></span>
   <a href="<?php echo $urlPanier;?>#panier_contenu"><?php echo $this->_('Voir le panier'); ?></a>
diff --git a/tests/application/modules/opac/controllers/PanierControllerTest.php b/tests/application/modules/opac/controllers/PanierControllerTest.php
index f168cc950df..13eb18c1a66 100644
--- a/tests/application/modules/opac/controllers/PanierControllerTest.php
+++ b/tests/application/modules/opac/controllers/PanierControllerTest.php
@@ -1218,10 +1218,10 @@ class PanierControllerAjoutAjaxSuccessTest extends PanierControllerSimpleLoggedU
 
 	
 	/** @test **/
-	public function responseShouldContainsScriptBoitePanierReload() {
+	public function responseShouldContainsScriptOpacDialogClose() {
 		$this->dispatch('/panier/ajout-ajax-success/id_notice/12/id_panier/39',true);
 		$this->_json = json_decode($this->_response->getbody());
-		$this->_xpath->assertXPath($this->_json->content,'//div[@class="ajout-result"]');
+		$this->_xpath->assertXPathContentContains($this->_json->content,'//script','opacDialogClose()');
 	}
 
 
-- 
GitLab