Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Commit

Permalink
Fix EZP-26997: Finder gradual loading fix
Browse files Browse the repository at this point in the history
  • Loading branch information
stephaneDiot committed Feb 16, 2017
1 parent c5048f6 commit 228b249
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 228b249

Please # to comment.