2022-05-09 10:21:21 +00:00
|
|
|
import { expect, it } from 'vitest'
|
2022-11-29 10:18:58 +00:00
|
|
|
import { screen } from '@testing-library/vue'
|
2022-05-09 10:21:21 +00:00
|
|
|
import isMobile from 'ismobilejs'
|
2024-09-03 14:51:23 +00:00
|
|
|
import { commonStore } from '@/stores'
|
2022-05-13 17:58:38 +00:00
|
|
|
import UnitTestCase from '@/__tests__/UnitTestCase'
|
2022-05-09 10:21:21 +00:00
|
|
|
import PreferencesForm from './PreferencesForm.vue'
|
|
|
|
|
2022-05-13 17:58:38 +00:00
|
|
|
new class extends UnitTestCase {
|
2022-05-09 10:21:21 +00:00
|
|
|
protected test () {
|
|
|
|
it('has "Transcode on mobile" option for mobile users', () => {
|
|
|
|
isMobile.phone = true
|
2022-11-29 10:18:58 +00:00
|
|
|
this.render(PreferencesForm)
|
2024-09-03 14:51:23 +00:00
|
|
|
screen.getByTestId('transcode_on_mobile')
|
2022-05-09 10:21:21 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
it('does not have "Transcode on mobile" option for non-mobile users', async () => {
|
|
|
|
isMobile.phone = false
|
2022-11-29 10:18:58 +00:00
|
|
|
this.render(PreferencesForm)
|
2024-09-03 14:51:23 +00:00
|
|
|
expect(screen.queryByTestId('transcode_on_mobile')).toBeNull()
|
|
|
|
})
|
|
|
|
|
|
|
|
it('does not have "Transcode on mobile" option if transcoding is not supported', async () => {
|
|
|
|
isMobile.phone = true
|
|
|
|
commonStore.state.supports_transcoding = false
|
|
|
|
expect(screen.queryByTestId('transcode_on_mobile')).toBeNull()
|
2022-05-09 10:21:21 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|