FIX: broken spec

This commit is contained in:
Joffrey JAFFEUX 2017-07-24 13:59:28 +02:00
parent 54b508dda3
commit d9696c98c3
1 changed files with 5 additions and 12 deletions

View File

@ -18,7 +18,7 @@ export function resetCache() {
keyValueStore.setObject({ key: EMOJI_SELECTED_DIVERSITY, value: 1 }); keyValueStore.setObject({ key: EMOJI_SELECTED_DIVERSITY, value: 1 });
} }
let $picker, $filter, $results, $list, scrollPosition, $visibleSections; let $picker, $filter, $results, $list, scrollPosition, $visibleSections, _checkTimeout;
export default Ember.Component.extend({ export default Ember.Component.extend({
willDestroyElement() { willDestroyElement() {
@ -119,7 +119,7 @@ export default Ember.Component.extend({
this._unbindEvents(); this._unbindEvents();
this._unbindSectionLoadingCheck(); clearTimeout(_checkTimeout);
}, },
show() { show() {
@ -137,23 +137,16 @@ export default Ember.Component.extend({
this._bindEvents(); this._bindEvents();
Ember.run.scheduleOnce("afterRender", this, function() { Ember.run.scheduleOnce("afterRender", this, function() {
this._sectionLoadingCheck();
this._loadCategoriesEmojis(); this._loadCategoriesEmojis();
this._positionPicker(); this._positionPicker();
this._scrollTo(); this._scrollTo();
this._sectionLoadingCheck();
}); });
}, },
_unbindSectionLoadingCheck() {
Ember.run.cancel(this.get("nextSectionloadingCheck"));
},
_sectionLoadingCheck() { _sectionLoadingCheck() {
const nextSectionloadingCheck = Ember.run.later(this, function() { _checkTimeout = setTimeout(() => { this._sectionLoadingCheck(); }, 500);
Ember.run.throttle(this, this._checkVisibleSection, 100); Ember.run.throttle(this, this._checkVisibleSection, 100);
this._sectionLoadingCheck();
}, 500);
this.set("nextSectionloadingCheck", nextSectionloadingCheck);
}, },
_loadCategoriesEmojis() { _loadCategoriesEmojis() {