From 228b2499ae060213963226ef6419b8069e644018 Mon Sep 17 00:00:00 2001 From: stephaneDiot Date: Thu, 16 Feb 2017 10:53:08 +0100 Subject: [PATCH] Fix EZP-26997: Finder gradual loading fix --- ...iversaldiscoveryfinderexplorerlevelview.js | 8 ++----- ...ldiscoveryfinderexplorerlevelview-tests.js | 24 ++++++++----------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/Resources/public/js/views/universaldiscovery/ez-universaldiscoveryfinderexplorerlevelview.js b/Resources/public/js/views/universaldiscovery/ez-universaldiscoveryfinderexplorerlevelview.js index af89a17bc..45c5e51c1 100644 --- a/Resources/public/js/views/universaldiscovery/ez-universaldiscoveryfinderexplorerlevelview.js +++ b/Resources/public/js/views/universaldiscovery/ez-universaldiscoveryfinderexplorerlevelview.js @@ -50,12 +50,8 @@ YUI.add('ez-universaldiscoveryfinderexplorerlevelview', function (Y) { } }); this.on('itemsChange', function () { - if (this.get('items')) { - this.get('container').addClass(IS_LOADING); - } else { - this._watchingScroll = true; - container.removeClass(IS_LOADING); - } + this._watchingScroll = true; + container.removeClass(IS_LOADING); }); this.after('offsetChange', function () { this._watchingScroll = false; diff --git a/Tests/js/views/universaldiscovery/assets/ez-universaldiscoveryfinderexplorerlevelview-tests.js b/Tests/js/views/universaldiscovery/assets/ez-universaldiscoveryfinderexplorerlevelview-tests.js index bf61f3620..5016955da 100644 --- a/Tests/js/views/universaldiscovery/assets/ez-universaldiscoveryfinderexplorerlevelview-tests.js +++ b/Tests/js/views/universaldiscovery/assets/ez-universaldiscoveryfinderexplorerlevelview-tests.js @@ -312,6 +312,15 @@ YUI.add('ez-universaldiscoveryfinderexplorerlevelview-tests', function (Y) { Assert.areSame(this.view.get('items')[0].contentType, this.result.contentType, 'item should have a location'); Assert.areSame(this.view.get('items')[0].contentInfo, this.result.location.get('contentInfo'), 'item should have a location'); }, + + "Should remove loading after updating items": function () { + var container = this.view.get('container'); + + container.addClass('is-loading'); + this.view.set('items', this.searchResult); + + Assert.isFalse(container.hasClass('is-loading'), 'Should have the loading icon'); + }, }); scrollTest = new Y.Test.Case({ @@ -462,24 +471,11 @@ YUI.add('ez-universaldiscoveryfinderexplorerlevelview-tests', function (Y) { delete this.view; }, - "Should set items to null and add loading class on reset": function () { - var container = this.view.get('container'); - + "Should set items to null on reset": function () { this.view.set('items', this.searchResult); this.view.reset(); - Assert.isTrue(container.hasClass('is-loading'), 'Should have the loading icon'); Assert.isNull(this.view.get('items'), 'items attribute should be resetted'); }, - - "Should add loading class when setting items to null": function () { - var container = this.view.get('container'); - - this.view.set('items', this.searchResult); - Assert.isFalse(container.hasClass('is-loading'), 'Should NOT have the loading icon'); - - this.view.set('items', null); - Assert.isTrue(container.hasClass('is-loading'), 'Should have the loading icon'); - }, }); Y.Test.Runner.setName("eZ Universal Discovery Finder Explorer Level View tests");