Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix(transformer/elm): handle elm error
- Loading branch information
1 parent
a9193ce
commit 7f918ba
Showing
7 changed files
with
154 additions
and
14 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
24 changes: 24 additions & 0 deletions
24
packages/core/integration-tests/test/integration/elm-error/elm.json
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,24 @@ | ||
{ | ||
"type": "application", | ||
"source-directories": [ | ||
"src" | ||
], | ||
"elm-version": "0.19.1", | ||
"dependencies": { | ||
"direct": { | ||
"elm/browser": "1.0.2", | ||
"elm/core": "1.0.5", | ||
"elm/html": "1.0.0" | ||
}, | ||
"indirect": { | ||
"elm/json": "1.1.3", | ||
"elm/time": "1.0.0", | ||
"elm/url": "1.0.0", | ||
"elm/virtual-dom": "1.0.2" | ||
} | ||
}, | ||
"test-dependencies": { | ||
"direct": {}, | ||
"indirect": {} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/core/integration-tests/test/integration/elm-error/index.js
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,5 @@ | ||
var local = require('./src/Main.elm'); | ||
|
||
module.exports = function () { | ||
return local; | ||
}; |
1 change: 1 addition & 0 deletions
1
packages/core/integration-tests/test/integration/elm-error/package.json
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 @@ | ||
{} |
49 changes: 49 additions & 0 deletions
49
packages/core/integration-tests/test/integration/elm-error/src/Main.elm
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,49 @@ | ||
module Main exposing (main) | ||
|
||
import Browser | ||
import Html exposing (Html, button, div, text) | ||
import Html.Events exposing (onClick) | ||
|
||
|
||
type alias Model = | ||
{ count : Int } | ||
|
||
|
||
initialModel : Model | ||
initialModel = | ||
{ count = 0 } | ||
|
||
|
||
type Msg | ||
= Increment | ||
| Decrement | ||
|
||
|
||
update : Msg -> Model -> Model | ||
update msg model = | ||
case msg of | ||
Increment -> | ||
Debug.log "incremented!!" | ||
{ model | count = model.count + 1 } | ||
|
||
Decrement -> | ||
Debug.log "decremented!!" | ||
{ model | count = model.count - 1 } | ||
|
||
|
||
view : Model -> Html Msg | ||
view model = | ||
div [] | ||
[ button [ onClick Increment ] [ text "+1" ] | ||
, div [] [ text <| String.fromInt model.count ] | ||
, button [ onClick Decrement ] [ text "-1" ] | ||
] | ||
|
||
|
||
main : Program () Model Msg | ||
main = | ||
Browser.sandbox | ||
{ init = initialModel | ||
, view = view | ||
, update = update | ||
} |
Empty file.
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