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
module Tests exposing (..) | |
import Test exposing (..) | |
import Expect exposing (..) | |
import Fuzz exposing (list, int, tuple, string) | |
import String | |
import ElmTestBDDStyle exposing (..) | |
all : Test |
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
module Example where | |
import ElmTestBDDStyle exposing (..) | |
import Check.Producer exposing (..) | |
tests : Test | |
tests = | |
describe "A Test Suite" | |
[ it "adds two numbers" <| | |
expect (3 + 7) toBe 10 |
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
type alias Model = | |
{ tasks : List Task | |
, field : String | |
, uid : Int | |
, visibility : String | |
} | |
type alias Task = | |
{ description : String | |
, completed : Bool |
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
update : Msg -> Model -> ( Model, Cmd Msg ) | |
update msg model = | |
case msg of | |
NoOp -> | |
model ! [] | |
Add -> | |
{ model | |
| uid = model.uid + 1 | |
, field = "" |
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
type alias Task = | |
{ description : String | |
, completed : Bool | |
, editing : Bool | |
, id : Int | |
} | |
type alias TaskList = | |
List Task |
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
type Msg | |
= NoOp | |
| UpdateField String | |
| EditingTask Int Bool | |
| UpdateTask Int String | |
| Add | |
| Delete Int | |
| DeleteComplete | |
| Check Int Bool | |
| CheckAll Bool |
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
type TaskMsg | |
= Check Bool | |
| Editing Bool | |
| Update String | |
type TaskListMsg | |
= Add Int String | |
| Delete Int | |
| DeleteComplete | |
| CheckAll Bool |
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
update : Action -> Control -> Control | |
update actionFor control = | |
case actionFor of | |
ActionForControl action -> updateControl action control | |
_ -> control | |
updateControl : ControlAction -> Control -> Control | |
updateControl action model = | |
case action of | |
ChangeVisibility visibility -> |
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
update : Msg -> Model -> Model | |
update msgFor taskList = | |
case msgFor of | |
MsgForTaskList msg -> | |
updateTaskList msg taskList | |
MsgForTask id msg -> | |
updateTask id msg taskList | |
_ -> |
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
update : Msg -> Model -> Model | |
update msg model = | |
{ model | |
| taskEntry = Task.update msg model.taskEntry | |
, taskList = TaskList.update msg model.taskList | |
, control = Control.update msg model.control | |
} |