1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

continue jquery removal

This commit is contained in:
Luke Pulverenti 2016-06-02 13:08:25 -04:00
parent 1fba8135db
commit 3128b05f14
15 changed files with 115 additions and 103 deletions

View file

@ -7,7 +7,7 @@
"list",
"virtual-list"
],
"version": "1.3.1",
"version": "1.3.2",
"homepage": "https://github.com/PolymerElements/iron-list",
"authors": [
"The Polymer Authors"
@ -45,14 +45,13 @@
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.2",
"web-component-tester": "^4.0.0"
},
"_release": "1.3.1",
"_release": "1.3.2",
"_resolution": {
"type": "version",
"tag": "v1.3.1",
"commit": "094724304d9df8c1c9cc5a8e62b9b607d4a0b86c"
"tag": "v1.3.2",
"commit": "5e6f1991f0b8f427b8432ce9538f3b100402545c"
},
"_source": "git://github.com/PolymerElements/iron-list.git",
"_target": "^1.3.1",
"_originalSource": "PolymerElements/iron-list",
"_direct": true
"_originalSource": "PolymerElements/iron-list"
}

View file

@ -1,4 +1,3 @@
<!--
This file is autogenerated based on
https://github.com/PolymerElements/ContributionGuide/blob/master/CONTRIBUTING.md
@ -11,6 +10,7 @@ specific element:
jsbin=https://jsbin.com/cagaye/edit?html,output
-->
# Polymer Elements
## Guide for Contributors

View file

@ -7,7 +7,7 @@
"list",
"virtual-list"
],
"version": "1.3.1",
"version": "1.3.2",
"homepage": "https://github.com/PolymerElements/iron-list",
"authors": [
"The Polymer Authors"

View file

@ -620,7 +620,6 @@ will only render 20.
if (physicalOffset > this._scrollPosition) {
return this.grid ? vidx - (vidx % this._itemsPerRow) : vidx;
}
// Handle a partially rendered final row in grid mode
if (this.grid && this._virtualCount - 1 === vidx) {
return vidx - (vidx % this._itemsPerRow);
@ -639,21 +638,17 @@ will only render 20.
if (this._lastVisibleIndexVal === null) {
if (this.grid) {
var lastIndex = this.firstVisibleIndex + this._estRowsInView * this._itemsPerRow - 1;
this._lastVisibleIndexVal = lastIndex > this._virtualCount ? this._virtualCount : lastIndex;
this._lastVisibleIndexVal = Math.min(this._virtualCount, lastIndex);
} else {
var physicalOffset = this._physicalTop;
this._iterateItems(function(pidx, vidx) {
physicalOffset += this._getPhysicalSizeIncrement(pidx);
if(physicalOffset <= this._scrollBottom) {
if (this.grid) {
var lastIndex = vidx - vidx % this._itemsPerRow + this._itemsPerRow - 1;
this._lastVisibleIndexVal = lastIndex > this._virtualCount ? this._virtualCount : lastIndex;
} else {
this._lastVisibleIndexVal = vidx;
}
if (physicalOffset < this._scrollBottom) {
this._lastVisibleIndexVal = vidx;
} else {
// Break _iterateItems
return true;
}
physicalOffset += this._getPhysicalSizeIncrement(pidx);
});
}
}
@ -1067,10 +1062,11 @@ will only render 20.
this._virtualCount = this.items ? this.items.length : 0;
this._collection = this.items ? Polymer.Collection.get(this.items) : null;
this._physicalIndexForKey = {};
this._firstVisibleIndexVal = null;
this._lastVisibleIndexVal = null;
this._resetScrollPosition(0);
this._removeFocusedItem();
// create the initial physical items
if (!this._physicalItems) {
this._physicalCount = Math.max(1, Math.min(DEFAULT_PHYSICAL_COUNT, this._virtualCount));
@ -1081,6 +1077,7 @@ will only render 20.
this._physicalStart = 0;
} else if (change.path === 'items.splices') {
this._adjustVirtualIndex(change.value.indexSplices);
this._virtualCount = this.items ? this.items.length : 0;
@ -1313,7 +1310,7 @@ will only render 20.
if (deltaHeight) {
this._physicalTop = this._physicalTop - deltaHeight;
// juking scroll position during interial scrolling on iOS is no bueno
if (!IOS_TOUCH_SCROLLING) {
if (!IOS_TOUCH_SCROLLING && this._physicalTop !== 0) {
this._resetScrollPosition(this._scrollTop - deltaHeight);
}
}

View file

@ -81,55 +81,44 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
});
});
test('first visible index', function(done) {
test('first visible index', function() {
container.data = buildDataSet(100);
Polymer.dom.flush();
assert.equal(list.firstVisibleIndex, 0);
list.scroll(0, container.itemHeight * 10);
list.fire('scroll');
assert.equal(list.firstVisibleIndex, 10);
list.scroll(0, container.itemHeight * 50);
list.fire('scroll');
assert.equal(list.firstVisibleIndex, 50);
list.scrollToIndex(60);
Polymer.dom.flush();
assert.equal(list.firstVisibleIndex, 60);
list.scrollToIndex(0);
Polymer.dom.flush();
assert.equal(list.firstVisibleIndex, 0);
});
flush(function() {
var setSize = list.items.length;
var rowHeight = container.itemHeight;
var viewportHeight = list.offsetHeight;
var scrollToItem;
function checkFirstVisible() {
assert.equal(list.firstVisibleIndex, scrollToItem);
assert.equal(getFirstItemFromList(list).textContent, scrollToItem);
}
function checkLastVisible() {
var visibleItemsCount = Math.floor(viewportHeight / rowHeight);
assert.equal(list.lastVisibleIndex, scrollToItem + visibleItemsCount - 1);
assert.equal(getLastItemFromList(list).textContent, scrollToItem + visibleItemsCount - 1);
}
function doneScrollDown() {
checkFirstVisible();
checkLastVisible();
scrollToItem = 1;
flush(function() {
simulateScroll({
list: list,
contribution: rowHeight,
target: scrollToItem*rowHeight,
onScrollEnd: doneScrollUp
});
});
}
function doneScrollUp() {
checkFirstVisible();
checkLastVisible();
done();
}
scrollToItem = 50;
simulateScroll({
list: list,
contribution: 50,
target: scrollToItem*rowHeight,
onScrollEnd: doneScrollDown
});
});
test('last visible index', function() {
container.data = buildDataSet(1);
container.itemHeight = 1000;
Polymer.dom.flush();
assert.equal(list.lastVisibleIndex, 0);
container.data = buildDataSet(2);
container.itemHeight = 50;
Polymer.dom.flush();
assert.equal(list.lastVisibleIndex, 1);
container.data = buildDataSet(10);
Polymer.dom.flush();
list.scrollToIndex(8);
Polymer.dom.flush();
assert.equal(list.lastVisibleIndex, 9);
container.itemHeight = 50;
container.data = buildDataSet(100);
Polymer.dom.flush();
list.scroll(0, 100);
list.fire('scroll');
assert.equal(list.lastVisibleIndex, ((list._scrollTop + container.listHeight) / container.itemHeight) - 1);
});
test('scroll to index', function(done) {
@ -161,6 +150,30 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}, 100);
});
test('scroll to top', function(done) {
list.items = buildDataSet(100);
Polymer.dom.flush();
list.scrollToIndex(99);
Polymer.dom.flush();
list.scroll(0, 0);
setTimeout(function() {
assert.equal(list._scrollTop, 0, 'scrollTop = 0');
done();
}, 100);
});
test('scroll to a given scrollTop', function(done) {
list.items = buildDataSet(100);
Polymer.dom.flush();
list.scrollToIndex(99);
Polymer.dom.flush();
list.scroll(0, 500);
setTimeout(function() {
assert.equal(list._scrollTop, 500, 'scrollTop = 500');
done();
}, 100);
});
test('reset items', function(done) {
list.items = buildDataSet(100);