From 081c5e8ab8047a157bd29203f678eb37766f5790 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?ANDRE=20s=C3=A9bastien?= <sandre@afi-sa.fr>
Date: Wed, 23 Sep 2020 15:59:18 +0200
Subject: [PATCH] dev #118036 : Fix spinner

---
 VERSIONS_WIP/118036                           |  1 +
 .../templates/Intonation/View/Jumbotron.php   |  3 +-
 .../Templates/TemplatesAbonneTest.php         | 42 +++++++++++++++++++
 tests/scenarios/Templates/TemplatesTest.php   | 11 -----
 4 files changed, 44 insertions(+), 13 deletions(-)
 create mode 100644 VERSIONS_WIP/118036
 create mode 100644 tests/scenarios/Templates/TemplatesAbonneTest.php

diff --git a/VERSIONS_WIP/118036 b/VERSIONS_WIP/118036
new file mode 100644
index 00000000000..70cd8e489ee
--- /dev/null
+++ b/VERSIONS_WIP/118036
@@ -0,0 +1 @@
+ - ticket #118036 : Magasin de thèmes : Correction de l'interface de chargement dans les onglets
\ No newline at end of file
diff --git a/library/templates/Intonation/View/Jumbotron.php b/library/templates/Intonation/View/Jumbotron.php
index 2ffb254249b..2b17459c642 100644
--- a/library/templates/Intonation/View/Jumbotron.php
+++ b/library/templates/Intonation/View/Jumbotron.php
@@ -216,8 +216,7 @@ class Intonation_View_Jumbotron extends ZendAfi_View_Helper_BaseHelper {
                                        ['class' => 'jumbotron_section_title'])
                            . $this->view->div(['class' => 'jumbotron_section_content'],
                                               $element->getContent()));
-
-    return ($element->isAjax())
+    return ($element->isAjax() && $element->isvisible())
       ? ($this->_renderLoadingIcon() . $content)
       : $content;
   }
diff --git a/tests/scenarios/Templates/TemplatesAbonneTest.php b/tests/scenarios/Templates/TemplatesAbonneTest.php
new file mode 100644
index 00000000000..e1027b80993
--- /dev/null
+++ b/tests/scenarios/Templates/TemplatesAbonneTest.php
@@ -0,0 +1,42 @@
+<?php
+/**
+ * Copyright (c) 2012-2020, Agence Française Informatique (AFI). All rights reserved.
+ *
+ * BOKEH is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
+ * the Free Software Foundation.
+ *
+ * There are special exceptions to the terms and conditions of the AGPL as it
+ * is applied to this software (see README file).
+ *
+ * BOKEH is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * along with BOKEH; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+require_once 'TemplatesTest.php';
+
+class TemplatesAbonneInformationsTest extends TemplatesIntonationAccountTestCase {
+
+  public function setUp() {
+    parent::setUp();
+    $this->dispatch('/opac/abonne/informations/id_profil/72');
+  }
+
+
+  /** @test */
+  public function shouldDisplayPaulInDD() {
+    $this->assertXpathContentContains('//div//dd', 'Paul');
+  }
+
+
+  /** @test */
+  public function shouldNotContainsLoadingIcon() {
+    $this->assertNotXPath('//div[contains(@class, "loading_icon")]');
+  }
+}
\ No newline at end of file
diff --git a/tests/scenarios/Templates/TemplatesTest.php b/tests/scenarios/Templates/TemplatesTest.php
index f73f4aeaf02..9ebb996985e 100644
--- a/tests/scenarios/Templates/TemplatesTest.php
+++ b/tests/scenarios/Templates/TemplatesTest.php
@@ -2094,17 +2094,6 @@ class TemplatesDispatchIntonationChangeIconAccountWithWrongFilePathTest extends
 
 
 
-class TemplatesDispatchAbonneInformationsTest extends TemplatesIntonationAccountTestCase {
-  /** @test */
-  public function shouldDisplayPaulInDD() {
-    $this->dispatch('/opac/abonne/informations/id_profil/72');
-    $this->assertXpathContentContains('//div//dd', 'Paul');
-  }
-}
-
-
-
-
 class TemplatesDispatchAbonneLoansTest extends TemplatesIntonationAccountTestCase {
   public function setUp() {
     parent::setUp();
-- 
GitLab