mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-20 19:06:06 +01:00
Auto formatting
This commit is contained in:
parent
2bd532eb9a
commit
ff27c0b58b
@ -24,7 +24,7 @@ describe('AuthorCard', () => {
|
|||||||
LabelBooks: 'Books',
|
LabelBooks: 'Books',
|
||||||
ButtonQuickMatch: 'Quick Match'
|
ButtonQuickMatch: 'Quick Match'
|
||||||
},
|
},
|
||||||
$store : {
|
$store: {
|
||||||
getters: {
|
getters: {
|
||||||
'user/getUserCanUpdate': true,
|
'user/getUserCanUpdate': true,
|
||||||
'libraries/getLibraryProvider': () => 'audible.us'
|
'libraries/getLibraryProvider': () => 'audible.us'
|
||||||
@ -36,8 +36,8 @@ describe('AuthorCard', () => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
$eventBus: {
|
$eventBus: {
|
||||||
$on: () => {},
|
$on: () => { },
|
||||||
$off: () => {},
|
$off: () => { },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,26 +66,26 @@ describe('AuthorCard', () => {
|
|||||||
|
|
||||||
it('renders the component with the author name below', () => {
|
it('renders the component with the author name below', () => {
|
||||||
const updatedPropsData = { ...propsData, nameBelow: true }
|
const updatedPropsData = { ...propsData, nameBelow: true }
|
||||||
cy.mount(AuthorCard, { ...mountOptions, propsData: updatedPropsData } )
|
cy.mount(AuthorCard, { ...mountOptions, propsData: updatedPropsData })
|
||||||
|
|
||||||
cy.get('&textInline').should('be.hidden')
|
cy.get('&textInline').should('be.hidden')
|
||||||
cy.get('&match').should('be.hidden')
|
cy.get('&match').should('be.hidden')
|
||||||
cy.get('&edit').should('be.hidden')
|
cy.get('&edit').should('be.hidden')
|
||||||
let nameBelowHeight
|
let nameBelowHeight
|
||||||
cy.get('&nameBelow')
|
cy.get('&nameBelow')
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.and('have.text', 'John Doe')
|
.and('have.text', 'John Doe')
|
||||||
.and(($el) => {
|
.and(($el) => {
|
||||||
const height = $el.height()
|
const height = $el.height()
|
||||||
const width = $el.width()
|
const width = $el.width()
|
||||||
const sizeMultiplier = propsData.sizeMultiplier
|
const sizeMultiplier = propsData.sizeMultiplier
|
||||||
const defaultFontSize = 16
|
const defaultFontSize = 16
|
||||||
const defaultLineHeight = 1.5
|
const defaultLineHeight = 1.5
|
||||||
const fontSizeMultiplier = 0.75
|
const fontSizeMultiplier = 0.75
|
||||||
const px2 = 16
|
const px2 = 16
|
||||||
expect(height).to.be.closeTo(defaultFontSize * fontSizeMultiplier * sizeMultiplier * defaultLineHeight, 0.01)
|
expect(height).to.be.closeTo(defaultFontSize * fontSizeMultiplier * sizeMultiplier * defaultLineHeight, 0.01)
|
||||||
nameBelowHeight = height
|
nameBelowHeight = height
|
||||||
expect(width).to.be.closeTo(propsData.width - px2, 0.01)
|
expect(width).to.be.closeTo(propsData.width - px2, 0.01)
|
||||||
})
|
})
|
||||||
cy.get('&card').should(($el) => {
|
cy.get('&card').should(($el) => {
|
||||||
const width = $el.width()
|
const width = $el.width()
|
||||||
@ -94,11 +94,10 @@ describe('AuthorCard', () => {
|
|||||||
expect(width).to.be.closeTo(propsData.width, 0.01)
|
expect(width).to.be.closeTo(propsData.width, 0.01)
|
||||||
expect(height).to.be.closeTo(propsData.height + nameBelowHeight + py1, 0.01)
|
expect(height).to.be.closeTo(propsData.height + nameBelowHeight + py1, 0.01)
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders quick-match and edit buttons on mouse hover', () => {
|
it('renders quick-match and edit buttons on mouse hover', () => {
|
||||||
cy.mount(AuthorCard, mountOptions )
|
cy.mount(AuthorCard, mountOptions)
|
||||||
|
|
||||||
// before mouseover
|
// before mouseover
|
||||||
cy.get('&match').should('be.hidden')
|
cy.get('&match').should('be.hidden')
|
||||||
@ -116,7 +115,7 @@ describe('AuthorCard', () => {
|
|||||||
|
|
||||||
it('renders the component with spinner while searching', () => {
|
it('renders the component with spinner while searching', () => {
|
||||||
const data = () => { return { searching: true, isHovering: false } }
|
const data = () => { return { searching: true, isHovering: false } }
|
||||||
cy.mount(AuthorCard, { ...mountOptions, data } )
|
cy.mount(AuthorCard, { ...mountOptions, data })
|
||||||
|
|
||||||
cy.get('&textInline').should('be.hidden')
|
cy.get('&textInline').should('be.hidden')
|
||||||
cy.get('&match').should('be.hidden')
|
cy.get('&match').should('be.hidden')
|
||||||
@ -124,7 +123,7 @@ describe('AuthorCard', () => {
|
|||||||
cy.get('&spinner').should('be.visible')
|
cy.get('&spinner').should('be.visible')
|
||||||
})
|
})
|
||||||
|
|
||||||
it ('toasts after quick match with no updates', () => {
|
it('toasts after quick match with no updates', () => {
|
||||||
const updatedMocks = {
|
const updatedMocks = {
|
||||||
...mocks,
|
...mocks,
|
||||||
$axios: {
|
$axios: {
|
||||||
@ -136,7 +135,7 @@ describe('AuthorCard', () => {
|
|||||||
info: cy.spy().as('info')
|
info: cy.spy().as('info')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cy.mount(AuthorCard, { ...mountOptions, mocks: updatedMocks } )
|
cy.mount(AuthorCard, { ...mountOptions, mocks: updatedMocks })
|
||||||
cy.get('&card').trigger('mouseover')
|
cy.get('&card').trigger('mouseover')
|
||||||
cy.get('&match').click()
|
cy.get('&match').click()
|
||||||
|
|
||||||
@ -146,7 +145,7 @@ describe('AuthorCard', () => {
|
|||||||
cy.get('@info').should('have.been.called')
|
cy.get('@info').should('have.been.called')
|
||||||
})
|
})
|
||||||
|
|
||||||
it ('toasts after quick match with updates and no image', () => {
|
it('toasts after quick match with updates and no image', () => {
|
||||||
const updatedMocks = {
|
const updatedMocks = {
|
||||||
...mocks,
|
...mocks,
|
||||||
$axios: {
|
$axios: {
|
||||||
@ -158,7 +157,7 @@ describe('AuthorCard', () => {
|
|||||||
info: cy.spy().as('info')
|
info: cy.spy().as('info')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cy.mount(AuthorCard, { ...mountOptions, mocks: updatedMocks } )
|
cy.mount(AuthorCard, { ...mountOptions, mocks: updatedMocks })
|
||||||
cy.get('&card').trigger('mouseover')
|
cy.get('&card').trigger('mouseover')
|
||||||
cy.get('&match').click()
|
cy.get('&match').click()
|
||||||
|
|
||||||
@ -168,7 +167,7 @@ describe('AuthorCard', () => {
|
|||||||
cy.get('@info').should('not.have.been.called')
|
cy.get('@info').should('not.have.been.called')
|
||||||
})
|
})
|
||||||
|
|
||||||
it ('toasts after quick match with updates including image', () => {
|
it('toasts after quick match with updates including image', () => {
|
||||||
const updatedMocks = {
|
const updatedMocks = {
|
||||||
...mocks,
|
...mocks,
|
||||||
$axios: {
|
$axios: {
|
||||||
@ -180,7 +179,7 @@ describe('AuthorCard', () => {
|
|||||||
info: cy.spy().as('info')
|
info: cy.spy().as('info')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cy.mount(AuthorCard, { ...mountOptions, mocks: updatedMocks } )
|
cy.mount(AuthorCard, { ...mountOptions, mocks: updatedMocks })
|
||||||
cy.get('&card').trigger('mouseover')
|
cy.get('&card').trigger('mouseover')
|
||||||
cy.get('&match').click()
|
cy.get('&match').click()
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ describe('LazySeriesCard', () => {
|
|||||||
push: cy.stub().as('routerPush')
|
push: cy.stub().as('routerPush')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cy.mount(LazySeriesCard, { propsData, stubs, mocks: updatedMocks})
|
cy.mount(LazySeriesCard, { propsData, stubs, mocks: updatedMocks })
|
||||||
cy.get('&card').click()
|
cy.get('&card').click()
|
||||||
|
|
||||||
cy.get('@routerPush').should('have.been.calledOnceWithExactly', '/library/library-123/series/1')
|
cy.get('@routerPush').should('have.been.calledOnceWithExactly', '/library/library-123/series/1')
|
||||||
@ -126,8 +126,8 @@ describe('LazySeriesCard', () => {
|
|||||||
.and('have.class', 'bg-yellow-400')
|
.and('have.class', 'bg-yellow-400')
|
||||||
.and(($el) => {
|
.and(($el) => {
|
||||||
const width = $el.width()
|
const width = $el.width()
|
||||||
expect(width).to.be.closeTo((2/3) * propsData.width, 0.01)
|
expect(width).to.be.closeTo((2 / 3) * propsData.width, 0.01)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('shows full green progress bar when all books are finished', () => {
|
it('shows full green progress bar when all books are finished', () => {
|
||||||
@ -149,7 +149,7 @@ describe('LazySeriesCard', () => {
|
|||||||
.and(($el) => {
|
.and(($el) => {
|
||||||
const width = $el.width()
|
const width = $el.width()
|
||||||
expect(width).to.equal(propsData.width)
|
expect(width).to.equal(propsData.width)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('hides the rss feed marker when there is no rss feed', () => {
|
it('hides the rss feed marker when there is no rss feed', () => {
|
||||||
|
@ -51,7 +51,6 @@ describe('<NarratorCard />', () => {
|
|||||||
cy.mount(NarratorCard, mountOptions)
|
cy.mount(NarratorCard, mountOptions)
|
||||||
|
|
||||||
cy.get('&numBooks').should('have.text', '1 Book')
|
cy.get('&numBooks').should('have.text', '1 Book')
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders the default name and num-books when narrator is not provided', () => {
|
it('renders the default name and num-books when narrator is not provided', () => {
|
||||||
@ -77,7 +76,7 @@ describe('<NarratorCard />', () => {
|
|||||||
cy.get('&card').should('have.css', 'height', '100px')
|
cy.get('&card').should('have.css', 'height', '100px')
|
||||||
})
|
})
|
||||||
|
|
||||||
it ('has the correct font sizes', () => {
|
it('has the correct font sizes', () => {
|
||||||
let mountOptions = { propsData, mocks }
|
let mountOptions = { propsData, mocks }
|
||||||
cy.mount(NarratorCard, mountOptions)
|
cy.mount(NarratorCard, mountOptions)
|
||||||
cy.get('&name').should('have.css', 'font-size', '14.4px') // 0.75 * 1.2 * 16
|
cy.get('&name').should('have.css', 'font-size', '14.4px') // 0.75 * 1.2 * 16
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
const { defineConfig } = require("cypress");
|
const { defineConfig } = require("cypress")
|
||||||
|
|
||||||
module.exports = defineConfig({
|
module.exports = defineConfig({
|
||||||
component: {
|
component: {
|
||||||
devServer: {
|
devServer: {
|
||||||
framework: "nuxt",
|
framework: "nuxt",
|
||||||
bundler: "webpack",
|
bundler: "webpack"
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user