fix(test): FooterExtraControls tests

This commit is contained in:
Phan An 2022-07-10 16:21:00 +02:00
parent cbd8b4e67a
commit e6b2d98290
No known key found for this signature in database
GPG key ID: A81E4477F0BB6FDC
2 changed files with 7 additions and 18 deletions

View file

@ -1,11 +1,6 @@
import { expect, it } from 'vitest'
import factory from '@/__tests__/factory'
import { preferenceStore } from '@/stores'
import SoundBar from '@/components/ui/SoundBar.vue'
import Volume from '@/components/ui/Volume.vue'
import LikeButton from '@/components/song/SongLikeButton.vue'
import RepeatModeSwitch from '@/components/ui/RepeatModeSwitch.vue'
import Equalizer from '@/components/ui/Equalizer.vue'
import UnitTestCase from '@/__tests__/UnitTestCase'
import FooterExtraControls from './FooterExtraControls.vue'
@ -18,18 +13,12 @@ new class extends UnitTestCase {
props: {
song: factory<Song>('song', {
playback_state: 'Playing',
// Set these values for Like button's rendered HTML to be consistent
title: 'Fahrstuhl to Heaven'
title: 'Fahrstuhl to Heaven',
artist_name: 'Led Zeppelin',
artist_id: 3,
album_name: 'Led Zeppelin IV',
album_id: 4
})
},
global: {
stubs: {
SoundBar,
Volume,
LikeButton,
RepeatModeSwitch,
Equalizer
}
}
}).html()).toMatchSnapshot()
})

View file

@ -4,8 +4,8 @@ exports[`renders 1`] = `
<div class="other-controls" data-testid="other-controls" data-v-add48cbe="">
<div class="wrapper" data-v-add48cbe="">
<!--v-if--><button data-testid="toggle-visualizer-btn" title="Click for a marvelous visualizer!" type="button" data-v-add48cbe="">
<div class="bars" data-testid="soundbars" data-v-d983e410="" data-v-add48cbe=""><img alt="Sound bars" height="13" src="/resources/assets/img/bars.gif" data-v-d983e410=""></div>
</button><button title="Unlike Fahrstuhl to Heaven by Led Zeppelin" class="text-secondary like" data-testid="like-btn" data-v-5d366bb1="" data-v-add48cbe=""><i class="fa fa-heart text-maroon" data-testid="btn-like-liked" data-v-5d366bb1=""></i></button><button class="active control text-uppercase" data-testid="toggle-extra-panel-btn" title="View song information" type="button" data-v-add48cbe=""> Info </button><a class="queue control" href="#!/queue" data-v-add48cbe=""><i class="fa fa-list-ol" data-v-add48cbe=""></i></a><button class="NO_REPEAT control" title="Change repeat mode (current mode: No Repeat)" data-testid="repeat-mode-switch" type="button" data-v-651f1926="" data-v-add48cbe=""><i class="fa fa-repeat" data-v-651f1926=""></i></button><span id="volume" class="volume control" data-v-add48cbe=""><i class="fa fa-volume-up" role="button" tabindex="0" title="Mute"></i><input id="volumeInput" class="plyr__volume" max="10" role="slider" step="0.1" title="Volume" type="range"></span>
<div class="bars" data-testid="soundbars" data-v-d983e410="" data-v-add48cbe=""><img alt="Sound bars" height="13" src="undefined/resources/assets/img/bars.gif" data-v-d983e410=""></div>
</button><button title="Like Fahrstuhl to Heaven by Led Zeppelin" class="text-secondary like" data-testid="like-btn" data-v-5d366bb1="" data-v-add48cbe=""><i class="fa fa-heart-o" data-testid="btn-like-unliked" data-v-5d366bb1=""></i></button><button class="active control text-uppercase" data-testid="toggle-extra-panel-btn" title="View song information" type="button" data-v-add48cbe=""> Info </button><a class="queue control" href="#!/queue" data-v-add48cbe=""><i class="fa fa-list-ol" data-v-add48cbe=""></i></a><button class="NO_REPEAT control" title="Change repeat mode (current mode: No Repeat)" data-testid="repeat-mode-switch" type="button" data-v-651f1926="" data-v-add48cbe=""><i class="fa fa-repeat" data-v-651f1926=""></i></button><span id="volume" class="volume control" data-v-add48cbe=""><i class="fa fa-volume-up" role="button" tabindex="0" title="Mute"></i><input id="volumeInput" class="plyr__volume" max="10" role="slider" step="0.1" title="Volume" type="range"></span>
</div>
</div>
`;