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'
|
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)
|
|
|
|
screen.getByRole('checkbox', { name: 'Convert and play media at 128kbps 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)
|
|
|
|
expect(screen.queryByRole('checkbox', { name: 'Convert and play media at 128kbps on mobile' })).toBeNull()
|
2022-05-09 10:21:21 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|