mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-05-18 17:31:31 +00:00
fix: keep bookmark timestamps in wall-clock time
This commit is contained in:
parent
97c5d6341e
commit
bc0e4d59c0
2 changed files with 45 additions and 1 deletions
|
|
@ -0,0 +1,44 @@
|
|||
import BookmarkItem from '@/components/modals/bookmarks/BookmarkItem.vue'
|
||||
|
||||
describe('BookmarkItem', () => {
|
||||
const propsData = {
|
||||
bookmark: {
|
||||
libraryItemId: 'library-item-1',
|
||||
time: 3661,
|
||||
title: 'Chapter note'
|
||||
},
|
||||
highlight: false,
|
||||
playbackRate: 2
|
||||
}
|
||||
|
||||
const stubs = {
|
||||
'ui-text-input': true,
|
||||
'ui-btn': true
|
||||
}
|
||||
|
||||
it('renders bookmark timestamps from stored wall-clock time', () => {
|
||||
const mocks = {
|
||||
$secondsToTimestamp: (seconds) => {
|
||||
const totalSeconds = Math.floor(seconds)
|
||||
const hours = Math.floor(totalSeconds / 3600)
|
||||
const minutes = Math.floor((totalSeconds % 3600) / 60)
|
||||
const secs = totalSeconds % 60
|
||||
return [hours, minutes, secs].map((value) => String(value).padStart(2, '0')).join(':')
|
||||
},
|
||||
$axios: {
|
||||
$patch: cy.stub().resolves({})
|
||||
},
|
||||
$toast: {
|
||||
error: cy.stub()
|
||||
},
|
||||
$strings: {
|
||||
ToastFailedToUpdate: 'Failed to update'
|
||||
}
|
||||
}
|
||||
|
||||
cy.mount(BookmarkItem, { propsData, mocks, stubs })
|
||||
|
||||
cy.contains('01:01:01').should('be.visible')
|
||||
cy.contains('00:30:30').should('not.exist')
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue