-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
234 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
open Jest; | ||
open Expect; | ||
|
||
let _ = | ||
|
||
describe "GreenButton" (fun _ => { | ||
test "renders" (fun _ => { | ||
let action = Action.Add; | ||
let dispatch = fun _ => (); | ||
let tree = GreenButton.createElement ::action ::dispatch children::[] () |> Renderer.render; | ||
|
||
expect tree |> toMatchSnapshot; | ||
}); | ||
|
||
test "renders a class name" (fun _ => { | ||
let action = Action.Add; | ||
let className = Styles.make color::"rebeccapurple" () |> Styles.className; | ||
let dispatch = fun _ => (); | ||
let tree = GreenButton.createElement ::action ::className ::dispatch children::[] () | ||
|> Renderer.render; | ||
|
||
expect tree |> toMatchSnapshot; | ||
}); | ||
}); |
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 |
---|---|---|
|
@@ -35,7 +35,7 @@ exports[`Features renders 1`] = ` | |
<Feature | ||
reasonProps={ | ||
Array [ | ||
1, | ||
0, | ||
"Positive/Negative", | ||
] | ||
} | ||
|
25 changes: 25 additions & 0 deletions
25
__tests__/components/__snapshots__/greenButton_test.js.snap
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,25 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`GreenButton renders 1`] = ` | ||
<OperationButton | ||
reasonProps={ | ||
Array [ | ||
0, | ||
"css-h4v74b css-1eo5al3", | ||
[Function], | ||
] | ||
} | ||
/> | ||
`; | ||
|
||
exports[`GreenButton renders a class name 1`] = ` | ||
<OperationButton | ||
reasonProps={ | ||
Array [ | ||
0, | ||
"css-h4v74b css-1eo5al3 css-aori8y", | ||
[Function], | ||
] | ||
} | ||
/> | ||
`; |
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
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,25 @@ | ||
module GreenButton = { | ||
include ReactRe.Component; | ||
let name = "GreenButton"; | ||
|
||
type props = { | ||
action: Store.action, | ||
className: string, | ||
dispatch: Store.action => unit, | ||
}; | ||
|
||
let getClassName className => | ||
Styles.merge [ | ||
Styles.make background::"#3bf3a9" () |> Styles.className, | ||
Styles.make color::"#3bf3a9" () |> Styles.hover, | ||
Util.strEmpty className ? Styles.empty : className, | ||
]; | ||
|
||
let render { props: { action, className, dispatch } } => | ||
<OperationButton className=(getClassName className) dispatch action />; | ||
}; | ||
|
||
include ReactRe.CreateComponent GreenButton; | ||
|
||
let createElement ::action ::className="" ::dispatch => | ||
wrapProps { action, className, dispatch }; |
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