Skip to content

Commit 76410e4

Browse files
committed
Adds helper with titles snapshots and wraps with classed container
1 parent 553570a commit 76410e4

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

spec/Ui/DateRangePickerSpec.elm

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import Ui.DateRangePicker
1212
import Ui.DatePicker
1313
import Ui.Calendar exposing (..)
1414
import Html exposing (..)
15+
import Html.Attributes exposing (class)
1516
import Ui.Helpers.Dropdown as Dropdown exposing (Dropdown)
1617

1718

@@ -108,13 +109,21 @@ update msg_ model =
108109
( { model | readOnly = updatedModel }, Cmd.none )
109110

110111

112+
uiSnapshot : String -> String -> Html Msg -> Html Msg
113+
uiSnapshot title key ui =
114+
div [ class key ]
115+
[ text title
116+
, ui
117+
]
118+
119+
111120
view : Model -> Html.Html Msg
112121
view model =
113122
div []
114-
[ Html.map Simple (Ui.DateRangePicker.view "en_us" model.simple)
115-
, Html.map OneDisabled (Ui.DateRangePicker.view "en_us" model.oneDisabled)
116-
, Html.map WithPreselectedDates (Ui.DateRangePicker.view "en_us" model.withPreselectedDates)
117-
, Html.map ReadOnly (Ui.DateRangePicker.view "en_us" model.readOnly)
123+
[ uiSnapshot "Without Presets" "without-presets" (Html.map Simple (Ui.DateRangePicker.view "en_us" model.simple))
124+
, uiSnapshot "With One Disabled Date Picker" "one-disabled" (Html.map OneDisabled (Ui.DateRangePicker.view "en_us" model.oneDisabled))
125+
, uiSnapshot "With Preselected Dates" "preselected" (Html.map WithPreselectedDates (Ui.DateRangePicker.view "en_us" model.withPreselectedDates))
126+
, uiSnapshot "With A Readonly Date Picker" "readonly" (Html.map ReadOnly (Ui.DateRangePicker.view "en_us" model.readOnly))
118127
]
119128

120129

0 commit comments

Comments
 (0)