This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
subtitlesTrackChanged
event (#27)
* Add `subtitlesTrackChanged` event * Make label field optional * Allow subtitle track field to be null
- Loading branch information
Showing
7 changed files
with
109 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
module Jawa.Event.SubtitlesTrackChanged exposing (SubtitlesTrackChanged, decoder, encode, tag) | ||
|
||
{-| | ||
@docs SubtitlesTrackChanged, decoder, encode, tag | ||
-} | ||
|
||
import Jawa.SubtitleTrack | ||
import Json.Decode | ||
import Json.Encode | ||
|
||
|
||
{-| This event is not documented. | ||
-} | ||
type alias SubtitlesTrackChanged = | ||
{ currentTrack : Int | ||
, tracks : List Jawa.SubtitleTrack.SubtitleTrack | ||
} | ||
|
||
|
||
{-| A JSON decoder. | ||
-} | ||
decoder : Json.Decode.Decoder SubtitlesTrackChanged | ||
decoder = | ||
Json.Decode.map2 SubtitlesTrackChanged | ||
(Json.Decode.field "currentTrack" Json.Decode.int) | ||
(Json.Decode.field "tracks" (Json.Decode.list Jawa.SubtitleTrack.decoder)) | ||
|
||
|
||
{-| A JSON encoder. | ||
-} | ||
encode : SubtitlesTrackChanged -> Json.Encode.Value | ||
encode x = | ||
Json.Encode.object | ||
[ ( "currentTrack", Json.Encode.int x.currentTrack ) | ||
, ( "tracks", Json.Encode.list Jawa.SubtitleTrack.encode x.tracks ) | ||
] | ||
|
||
|
||
{-| The tag that describes this type. | ||
-} | ||
tag : String | ||
tag = | ||
"subtitlesTrackChanged" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module Jawa.Event.SubtitlesTrackChangedTest exposing | ||
( fuzzer | ||
, test | ||
) | ||
|
||
import Fuzz | ||
import Jawa.Event.SubtitlesTrackChanged | ||
import Jawa.Extra.Test | ||
import Jawa.SubtitleTrackTest | ||
import Test | ||
|
||
|
||
test : Test.Test | ||
test = | ||
Test.describe "Jawa.Event.SubtitlesTrackChanged" | ||
[ Jawa.Extra.Test.fuzzCodec "round trips" Jawa.Event.SubtitlesTrackChanged.decoder Jawa.Event.SubtitlesTrackChanged.encode fuzzer | ||
, Jawa.Extra.Test.testCodec "works" | ||
Jawa.Event.SubtitlesTrackChanged.decoder | ||
Jawa.Event.SubtitlesTrackChanged.encode | ||
""" { | ||
"currentTrack": 0, | ||
"tracks": [] | ||
} """ | ||
{ currentTrack = 0 | ||
, tracks = [] | ||
} | ||
] | ||
|
||
|
||
fuzzer : Fuzz.Fuzzer Jawa.Event.SubtitlesTrackChanged.SubtitlesTrackChanged | ||
fuzzer = | ||
Fuzz.map2 Jawa.Event.SubtitlesTrackChanged.SubtitlesTrackChanged | ||
Fuzz.int | ||
(Fuzz.listOfLengthBetween 0 2 Jawa.SubtitleTrackTest.fuzzer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters