mirror of
https://github.com/heyarne/airsonic-ui.git
synced 2026-05-07 02:33:39 +02:00
Improvements to currently playing queue (#48)
* First sloppy import of code from heyarne/reagent-movable * Consistently use "current queue" to avoid confusion * Update shadow-cljs, re-frame and debux * Solve styling problem when sorting table rows * Make sortable component more reusable * Refactor playlist to use a sorted-map * Make sure current queue is displayed again * Fix sorting when converting a shuffled into a linear playlist * Implement set-current-track * Implement song-move in playlist * Add autoprefixer * Implement drag and drop reordering in current queue * Fix broken dev sass build * Bump some dependencies * Move airsonic-ui.views.icon to bulma.icon * Implement reusable dropdown in bulma.dropdown * Immediately render reordered tracks, reimplement actions in album view * Use new song-table on search result page * Make song-table more reusable * Remove current song * Implement go to source in current queue * Remove unused song view
This commit is contained in:
parent
f0324a236d
commit
8bf222a6e8
29 changed files with 1773 additions and 869 deletions
|
|
@ -1,10 +1,39 @@
|
|||
(ns airsonic-ui.components.audio-player.events-test
|
||||
(:require [cljs.test :refer-macros [deftest testing is]]
|
||||
[airsonic-ui.test-helpers :refer [dispatches?]]
|
||||
[airsonic-ui.audio.core :as audio]
|
||||
[airsonic-ui.audio.playlist :as playlist]
|
||||
[airsonic-ui.fixtures :as fixtures]
|
||||
[airsonic-ui.test-helpers :refer [dispatches? song-queue]]
|
||||
[airsonic-ui.components.audio-player.events :as events]))
|
||||
|
||||
|
||||
(deftest song-has-ended
|
||||
(testing "Should play the next song when current song has ended"
|
||||
(is (not (dispatches? (events/audio-update {} [:audio/update {:ended? false}]) :audio-player/next-song)))
|
||||
(is (dispatches? (events/audio-update {} [:audio/update {:ended? true}]) :audio-player/next-song))))
|
||||
|
||||
(deftest changing-current-song
|
||||
(testing "Should correctly set the current song index"
|
||||
(doseq [playback-mode [:linear :shuffled]
|
||||
repeat-mode [:repeat-none :repeat-single :repeat-all]]
|
||||
(let [n-songs 100
|
||||
next-idx (rand-int n-songs)
|
||||
fixture {:db {:credentials fixtures/credentials
|
||||
:audio {:current-playlist (playlist/->playlist (song-queue n-songs) :playback-mode playback-mode :repeat-mode repeat-mode)}}}
|
||||
effects (events/set-current-song fixture [:audio/set-current-song next-idx])]
|
||||
(is (= next-idx
|
||||
(-> (:db effects)
|
||||
(audio/summary [:audio/summary])
|
||||
(audio/current-playlist [:audio/current-playlist])
|
||||
(:current-idx)))
|
||||
(str "for playback-mode " playback-mode " and repeat-mode " repeat-mode))
|
||||
(is (contains? effects :audio/play))))))
|
||||
|
||||
(deftest removing-currently-playing-song
|
||||
(testing "Should stop all audio when removing the currently playing song"
|
||||
(doseq [playback-mode [:linear :shuffled]
|
||||
repeat-mode [:repeat-none :repeat-single :repeat-all]]
|
||||
(let [n-songs 100
|
||||
fixture {:db {:credentials fixtures/credentials
|
||||
:audio {:current-playlist (playlist/->playlist (song-queue n-songs) :playback-mode playback-mode :repeat-mode repeat-mode)}}}]
|
||||
(is (contains? (events/remove-song fixture [:audio/remove-song 0]) :audio/stop))
|
||||
(is (not (contains? (events/remove-song fixture [:audio/remove-song 99]) :audio/stop)))))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue