Revise tests
Link to fuzz test docs and Fuzzer docs Move part9 to be part12 Update part11 Update 12, and some other Mains Rearrange things, drop 2 modules Add a new part12 Fix READMEs Move some things up a directory Update part11 Use ! [] Update parts7-9 Fix part12g Swap part11 and part12 Fix readmes for part11 and part12 Add HtmlRunner to part8 Update part8 and part9 READMEs rm part10/test
This commit is contained in:
@@ -2,19 +2,26 @@ module SearchResult exposing (..)
|
||||
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (class, target, href, property, defaultValue)
|
||||
import Html.Events exposing (..)
|
||||
import Json.Decode exposing (Decoder)
|
||||
import Json.Decode.Pipeline exposing (..)
|
||||
|
||||
|
||||
type alias Model =
|
||||
{ id : Int
|
||||
, name : String
|
||||
, stars : Int
|
||||
, expanded : Bool
|
||||
}
|
||||
|
||||
|
||||
type alias ResultId =
|
||||
Int
|
||||
|
||||
|
||||
type alias Model =
|
||||
{ id : ResultId
|
||||
, name : String
|
||||
, stars : Int
|
||||
}
|
||||
type Msg
|
||||
= Expand
|
||||
| Collapse
|
||||
|
||||
|
||||
decoder : Decoder Model
|
||||
@@ -23,19 +30,29 @@ decoder =
|
||||
|> required "id" Json.Decode.int
|
||||
|> required "full_name" Json.Decode.string
|
||||
|> required "stargazers_count" Json.Decode.int
|
||||
|> hardcoded True
|
||||
|
||||
|
||||
view : Model -> Html a
|
||||
view result =
|
||||
li []
|
||||
[ span [ class "star-count" ] [ text (toString result.stars) ]
|
||||
, a
|
||||
[ href ("https://github.com/" ++ result.name)
|
||||
, target "_blank"
|
||||
update : Msg -> Model -> ( Model, Cmd Msg )
|
||||
update msg model =
|
||||
-- TODO implement Expand and Collapse logic
|
||||
model ! []
|
||||
|
||||
|
||||
view : Model -> Html Msg
|
||||
view model =
|
||||
if model.expanded then
|
||||
li []
|
||||
[ span [ class "star-count" ] [ text (toString model.stars) ]
|
||||
, a [ href ("https://github.com/" ++ model.name), target "_blank" ]
|
||||
[ text model.name ]
|
||||
-- TODO send a Collapse message on click
|
||||
, button [ class "hide-result" ]
|
||||
[ text "X" ]
|
||||
]
|
||||
else
|
||||
li []
|
||||
-- TODO send an Expand message on click
|
||||
[ button [ class "expand-result" ]
|
||||
[ text "Show" ]
|
||||
]
|
||||
[ text result.name ]
|
||||
, button
|
||||
-- TODO onClick, send a delete action to the address
|
||||
[ class "hide-result" ]
|
||||
[ text "X" ]
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user