lint
This commit is contained in:
parent
a8166dff96
commit
2297cf8ab0
2 changed files with 43 additions and 53 deletions
|
|
@ -107,7 +107,9 @@ const Timeline = {
|
||||||
const statusesPerSide = Math.ceil(Math.max(3, window.innerHeight / 80))
|
const statusesPerSide = Math.ceil(Math.max(3, window.innerHeight / 80))
|
||||||
const min = Math.max(0, this.virtualScrollIndex - statusesPerSide)
|
const min = Math.max(0, this.virtualScrollIndex - statusesPerSide)
|
||||||
const max = Math.min(amount, this.virtualScrollIndex + statusesPerSide)
|
const max = Math.min(amount, this.virtualScrollIndex + statusesPerSide)
|
||||||
return new Set(this.filteredVisibleStatuses.slice(min, max).map(({id}) => id))
|
return new Set(
|
||||||
|
this.filteredVisibleStatuses.slice(min, max).map(({ id }) => id),
|
||||||
|
)
|
||||||
},
|
},
|
||||||
virtualScrollingEnabled() {
|
virtualScrollingEnabled() {
|
||||||
return useMergedConfigStore().mergedConfig.virtualScrolling
|
return useMergedConfigStore().mergedConfig.virtualScrolling
|
||||||
|
|
|
||||||
|
|
@ -290,35 +290,26 @@ describe('Timelines store', () => {
|
||||||
})
|
})
|
||||||
expect(store.list.order).to.eql(statuses1)
|
expect(store.list.order).to.eql(statuses1)
|
||||||
expect(store.list.statusIds).to.eql(new Set(statuses1))
|
expect(store.list.statusIds).to.eql(new Set(statuses1))
|
||||||
expect(store.list.visibleStatusIds).to.eql(new Set([
|
expect(store.list.visibleStatusIds).to.eql(
|
||||||
's5',
|
new Set(['s5', 's4s0', 's3', 's2']),
|
||||||
's4s0',
|
)
|
||||||
's3',
|
|
||||||
's2',
|
|
||||||
]))
|
|
||||||
expect(store.list).to.have.property('maxId', 's7s3')
|
expect(store.list).to.have.property('maxId', 's7s3')
|
||||||
expect(store.list).to.have.property('minId', 's2')
|
expect(store.list).to.have.property('minId', 's2')
|
||||||
|
|
||||||
store.addStatusesToTimeline('list', '1', {
|
store.addStatusesToTimeline('list', '1', {
|
||||||
statuses: statuses2,
|
statuses: statuses2,
|
||||||
repeats: [
|
repeats: [['s1s0', 's0']],
|
||||||
['s1s0', 's0'],
|
|
||||||
],
|
|
||||||
pagination: { minId: 's1', maxId: 's0' },
|
pagination: { minId: 's1', maxId: 's0' },
|
||||||
showImmediately: true,
|
showImmediately: true,
|
||||||
older: true
|
older: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
const newOrder = [...statuses1, ...statuses2]
|
const newOrder = [...statuses1, ...statuses2]
|
||||||
expect(store.list.order).to.eql(newOrder)
|
expect(store.list.order).to.eql(newOrder)
|
||||||
expect(store.list.statusIds).to.eql(new Set(newOrder))
|
expect(store.list.statusIds).to.eql(new Set(newOrder))
|
||||||
expect(store.list.visibleStatusIds).to.eql(new Set([
|
expect(store.list.visibleStatusIds).to.eql(
|
||||||
's5',
|
new Set(['s5', 's4s0', 's3', 's2', 's0']),
|
||||||
's4s0',
|
)
|
||||||
's3',
|
|
||||||
's2',
|
|
||||||
's0',
|
|
||||||
]))
|
|
||||||
expect(store.list).to.have.property('maxId', 's7s3')
|
expect(store.list).to.have.property('maxId', 's7s3')
|
||||||
expect(store.list).to.have.property('minId', 's0')
|
expect(store.list).to.have.property('minId', 's0')
|
||||||
})
|
})
|
||||||
|
|
@ -341,12 +332,9 @@ describe('Timelines store', () => {
|
||||||
})
|
})
|
||||||
expect(store.list.order).to.eql(statuses1)
|
expect(store.list.order).to.eql(statuses1)
|
||||||
expect(store.list.statusIds).to.eql(new Set(statuses1))
|
expect(store.list.statusIds).to.eql(new Set(statuses1))
|
||||||
expect(store.list.visibleStatusIds).to.eql(new Set([
|
expect(store.list.visibleStatusIds).to.eql(
|
||||||
's4',
|
new Set(['s4', 's3s0', 's2', 's1']),
|
||||||
's3s0',
|
)
|
||||||
's2',
|
|
||||||
's1',
|
|
||||||
]))
|
|
||||||
expect(store.list).to.have.property('maxId', 's6s2')
|
expect(store.list).to.have.property('maxId', 's6s2')
|
||||||
expect(store.list).to.have.property('minId', 's1')
|
expect(store.list).to.have.property('minId', 's1')
|
||||||
|
|
||||||
|
|
@ -364,14 +352,16 @@ describe('Timelines store', () => {
|
||||||
const newOrder = [...statuses2, ...statuses1]
|
const newOrder = [...statuses2, ...statuses1]
|
||||||
expect(store.list.order).to.eql(newOrder)
|
expect(store.list.order).to.eql(newOrder)
|
||||||
expect(store.list.statusIds).to.eql(new Set(newOrder))
|
expect(store.list.statusIds).to.eql(new Set(newOrder))
|
||||||
expect(store.list.visibleStatusIds).to.eql(new Set([
|
expect(store.list.visibleStatusIds).to.eql(
|
||||||
's4',
|
new Set([
|
||||||
's3s0',
|
's4',
|
||||||
's2',
|
's3s0',
|
||||||
's1',
|
's2',
|
||||||
// Newer
|
's1',
|
||||||
's8',
|
// Newer
|
||||||
]))
|
's8',
|
||||||
|
]),
|
||||||
|
)
|
||||||
expect(store.list).to.have.property('maxId', 'sAs0')
|
expect(store.list).to.have.property('maxId', 'sAs0')
|
||||||
expect(store.list).to.have.property('minId', 's1')
|
expect(store.list).to.have.property('minId', 's1')
|
||||||
})
|
})
|
||||||
|
|
@ -394,12 +384,9 @@ describe('Timelines store', () => {
|
||||||
})
|
})
|
||||||
expect(store.list.order).to.eql(statuses1)
|
expect(store.list.order).to.eql(statuses1)
|
||||||
expect(store.list.statusIds).to.eql(new Set(statuses1))
|
expect(store.list.statusIds).to.eql(new Set(statuses1))
|
||||||
expect(store.list.visibleStatusIds).to.eql(new Set([
|
expect(store.list.visibleStatusIds).to.eql(
|
||||||
's4',
|
new Set(['s4', 's3s0', 's2', 's1']),
|
||||||
's3s0',
|
)
|
||||||
's2',
|
|
||||||
's1',
|
|
||||||
]))
|
|
||||||
expect(store.list).to.have.property('maxId', 's6s2')
|
expect(store.list).to.have.property('maxId', 's6s2')
|
||||||
expect(store.list).to.have.property('minId', 's1')
|
expect(store.list).to.have.property('minId', 's1')
|
||||||
|
|
||||||
|
|
@ -417,22 +404,21 @@ describe('Timelines store', () => {
|
||||||
expect(store.list.order).to.eql(newOrder)
|
expect(store.list.order).to.eql(newOrder)
|
||||||
expect(store.list.statusIds).to.eql(new Set(newOrder))
|
expect(store.list.statusIds).to.eql(new Set(newOrder))
|
||||||
expect(store.list.newStatusCount).to.eql(1)
|
expect(store.list.newStatusCount).to.eql(1)
|
||||||
expect(store.list.visibleStatusIds).to.eql(new Set([
|
expect(store.list.visibleStatusIds).to.eql(
|
||||||
's4',
|
new Set(['s4', 's3s0', 's2', 's1']),
|
||||||
's3s0',
|
)
|
||||||
's2',
|
|
||||||
's1',
|
|
||||||
]))
|
|
||||||
|
|
||||||
store.showNewStatuses('list')
|
store.showNewStatuses('list')
|
||||||
expect(store.list.visibleStatusIds).to.eql(new Set([
|
expect(store.list.visibleStatusIds).to.eql(
|
||||||
's4',
|
new Set([
|
||||||
's3s0',
|
's4',
|
||||||
's2',
|
's3s0',
|
||||||
's1',
|
's2',
|
||||||
// Newer
|
's1',
|
||||||
's8',
|
// Newer
|
||||||
]))
|
's8',
|
||||||
|
]),
|
||||||
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
@ -472,7 +458,9 @@ describe('Timelines store', () => {
|
||||||
expect(store.public.visibleStatusIds).to.eql(new Set())
|
expect(store.public.visibleStatusIds).to.eql(new Set())
|
||||||
expect(store.public.newStatusCount).to.equal(100)
|
expect(store.public.newStatusCount).to.equal(100)
|
||||||
store.showNewStatuses('public')
|
store.showNewStatuses('public')
|
||||||
expect(store.public.visibleStatusIds).to.eql(new Set(statuses.slice(0, 50)))
|
expect(store.public.visibleStatusIds).to.eql(
|
||||||
|
new Set(statuses.slice(0, 50)),
|
||||||
|
)
|
||||||
expect(store.public.newStatusCount).to.equal(0)
|
expect(store.public.newStatusCount).to.equal(0)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue