From 3592845c2bdb2b30fcfbd021e5b7cdf07b136df4 Mon Sep 17 00:00:00 2001
From: lbrun <lbrun@afi-sa.fr>
Date: Tue, 17 Nov 2015 14:51:24 +0100
Subject: [PATCH] dev#23223_sito_widget_pagination : add ajax pagination tests

---
 library/ZendAfi/View/Helper/Accueil/Sito.php           | 2 +-
 public/opac/js/reload_module.js                        | 2 +-
 tests/library/ZendAfi/View/Helper/Accueil/SitoTest.php | 6 ++++++
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/library/ZendAfi/View/Helper/Accueil/Sito.php b/library/ZendAfi/View/Helper/Accueil/Sito.php
index 8d9ff139c3a..4ce888781a3 100644
--- a/library/ZendAfi/View/Helper/Accueil/Sito.php
+++ b/library/ZendAfi/View/Helper/Accueil/Sito.php
@@ -254,7 +254,7 @@ class SelectedStrategy extends SitoDisplayStrategy {
                                                                                   'action' => 'widget-page',
                                                                                   'id_module' => $this->id_module,
                                                                                   'id_division' => $this->division],
-                                                                   'link_attribs' => [ 'data-reload-module' => 'true' ]
+                                                                   'link_attribs' => [ 'data-ajax-reload' => 'true' ]
                                                                    ]);
   }
 }
diff --git a/public/opac/js/reload_module.js b/public/opac/js/reload_module.js
index 232f25edaee..2a43d95bfc4 100644
--- a/public/opac/js/reload_module.js
+++ b/public/opac/js/reload_module.js
@@ -17,7 +17,7 @@
 
 
 function initializeReloadModule() {
-  $('a[data-reload-module="true"]').click(function(event) {
+  $('.boite a[data-ajax-reload="true"]').click(function(event) {
     event.preventDefault();
 
     $(this).closest('.boite').reload($(this).attr('href'));
diff --git a/tests/library/ZendAfi/View/Helper/Accueil/SitoTest.php b/tests/library/ZendAfi/View/Helper/Accueil/SitoTest.php
index 36d15958a16..0784b9d8280 100644
--- a/tests/library/ZendAfi/View/Helper/Accueil/SitoTest.php
+++ b/tests/library/ZendAfi/View/Helper/Accueil/SitoTest.php
@@ -177,6 +177,12 @@ class SitoViewHelperSelectItemsBySelectionOrderPaginationTest extends SitoViewHe
     public function paginatorPreviousLinkShouldBeDisabled() {
       $this->assertXPathContentContains($this->html, '//div[@class="paginationControl"]//span[@class="disabled"]', utf8_encode('Précédent'));
     }
+
+
+    /** @test */
+    public function anchorsShouldHaveDataReloadModule() {
+      $this->assertXPathCount($this->html, '//div[@class="paginationControl"]//a[@data-ajax-reload="true"]', 2);
+    }
 }
 
 
-- 
GitLab