atom-select-list
Advanced tools
Comparing version 0.7.0 to 0.7.1
{ | ||
"name": "atom-select-list", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"description": "A general-purpose select list for use in Atom packages", | ||
@@ -5,0 +5,0 @@ "main": "./src/select-list-view.js", |
@@ -39,10 +39,10 @@ const {Disposable, CompositeDisposable, TextEditor} = require('atom') | ||
this.visibilityObserver = new IntersectionObserver(changes => { | ||
// Since we observe fake items only, whenever it changes, just render to real item. | ||
// No need to check change.intersectionRatio. | ||
for (const change of changes) { | ||
const element = change.target | ||
this.visibilityObserver.unobserve(element) | ||
const index = Array.from(this.refs.items.children).indexOf(element) | ||
if (index >= 0) { | ||
this.renderItemAtIndex(index) | ||
if (change.intersectionRatio > 0) { | ||
const element = change.target | ||
this.visibilityObserver.unobserve(element) | ||
const index = Array.from(this.refs.items.children).indexOf(element) | ||
if (index >= 0) { | ||
this.renderItemAtIndex(index) | ||
} | ||
} | ||
@@ -49,0 +49,0 @@ } |
@@ -602,3 +602,3 @@ /** @babel */ | ||
it('case-1: initially renders only specified number of items and renders others as they become visible', async () => { | ||
it('[With height for 5 items]: initially renders only specified number of items and renders others as they become visible', async () => { | ||
spy = createElementForItemSpyWithHeight("30px") | ||
@@ -614,3 +614,3 @@ const selectListView = new SelectListView({ | ||
selectListView.element.style.overflowY = 'auto' | ||
selectListView.element.style.height = '150px' | ||
selectListView.element.style.height = '150px' // 5 items height | ||
@@ -621,9 +621,9 @@ containerNode.appendChild(selectListView.element) | ||
children[20].scrollIntoViewIfNeeded() | ||
await assertItemsBecomeVisible([17, 18, 19, 20, 21, 22, 23]) | ||
await assertItemsBecomeVisible([18, 19, 20, 21, 22]) | ||
children[50].scrollIntoViewIfNeeded() | ||
await assertItemsBecomeVisible([47, 48, 49, 50, 51, 52, 53]) | ||
await assertItemsBecomeVisible([48, 49, 50, 51, 52]) | ||
children[80].scrollIntoViewIfNeeded() | ||
await assertItemsBecomeVisible([77, 78, 79, 80, 81, 82, 83]) | ||
await assertItemsBecomeVisible([78, 79, 80, 81, 82]) | ||
children[90].scrollIntoViewIfNeeded() | ||
await assertItemsBecomeVisible([87, 88, 89, 90, 91, 92, 93]) | ||
await assertItemsBecomeVisible([88, 89, 90, 91, 92]) | ||
@@ -639,6 +639,6 @@ children[20].scrollIntoViewIfNeeded() | ||
assert.equal(selectListView.element.querySelectorAll('.item').length, 100) | ||
assert.equal(selectListView.element.querySelectorAll('.item.visible').length, 33) | ||
assert.equal(selectListView.element.querySelectorAll('.item.visible').length, 25) // inital(5) + visible(20) | ||
}) | ||
it('case-2: initially renders only specified number of items and renders others as they become visible', async () => { | ||
it('[With height for 1 item]: initially renders only specified number of items and renders others as they become visible', async () => { | ||
spy = createElementForItemSpyWithHeight("10px") | ||
@@ -654,3 +654,3 @@ const selectListView = new SelectListView({ | ||
selectListView.element.style.overflowY = 'auto' | ||
selectListView.element.style.height = '10px' | ||
selectListView.element.style.height = '10px' // One item height | ||
@@ -661,9 +661,9 @@ containerNode.appendChild(selectListView.element) | ||
children[20].scrollIntoViewIfNeeded() | ||
await assertItemsBecomeVisible([19, 20, 21]) | ||
await assertItemsBecomeVisible([20]) | ||
children[50].scrollIntoViewIfNeeded() | ||
await assertItemsBecomeVisible([49, 50, 51]) | ||
await assertItemsBecomeVisible([50]) | ||
children[80].scrollIntoViewIfNeeded() | ||
await assertItemsBecomeVisible([79, 80, 81]) | ||
await assertItemsBecomeVisible([80]) | ||
children[90].scrollIntoViewIfNeeded() | ||
await assertItemsBecomeVisible([89, 90, 91]) | ||
await assertItemsBecomeVisible([90]) | ||
@@ -679,3 +679,3 @@ children[20].scrollIntoViewIfNeeded() | ||
assert.equal(selectListView.element.querySelectorAll('.item').length, 100) | ||
assert.equal(selectListView.element.querySelectorAll('.item.visible').length, 17) | ||
assert.equal(selectListView.element.querySelectorAll('.item.visible').length, 9) // inital(5) + visible(4) | ||
}) | ||
@@ -682,0 +682,0 @@ }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
78392
7
1962
1