File tree Expand file tree Collapse file tree
accessibility_monitoring_platform/apps/common Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2929 Populate date with one week from today
3030 </ span >
3131 </ p >
32+ < p class ="govuk-body-m amp-margin-top-0 amp-margin-bottom-0 ">
33+ < span class ="amp-control amp-populate-date-2-weeks " tabIndex ="0 "
34+ dayFieldId ="{{ widget.subwidgets.0.attrs.id }} "
35+ monthFieldId ="{{ widget.subwidgets.1.attrs.id }} "
36+ yearFieldId ="{{ widget.subwidgets.2.attrs.id }} ">
37+ Populate date with two weeks from today
38+ </ span >
39+ </ p >
3240 < p class ="govuk-body-m amp-margin-top-0 amp-margin-bottom-0 ">
3341 < span class ="amp-control amp-populate-date-4-weeks " tabIndex ="0 "
3442 dayFieldId ="{{ widget.subwidgets.0.attrs.id }} "
Original file line number Diff line number Diff line change @@ -138,6 +138,8 @@ def test_amp_date_widget_html_includes_populate_future_dates_controls():
138138 assert "amp-populate-date-today" not in html
139139 assert "Populate date with one week from today" in html
140140 assert "amp-populate-date-1-week" in html
141+ assert "Populate date with two weeks from today" in html
142+ assert "amp-populate-date-2-weeks" in html
141143 assert "Populate date with four weeks from today" in html
142144 assert "amp-populate-date-4-weeks" in html
143145 assert "Populate date with 12 weeks from today" in html
Original file line number Diff line number Diff line change 22Populate date field with today.
33*/
44const oneWeekInDays = 7
5+ const twoWeeksInDays = oneWeekInDays * 2
56const fourWeeksInDays = oneWeekInDays * 4
67const twelveWeeksInDays = oneWeekInDays * 12
78
@@ -46,6 +47,13 @@ Array.from(populateDateWithOneWeekElements).forEach(function (populateDateElemen
4647 addPopulateDateListeners ( populateDateElement , daysOffset )
4748} )
4849
50+ const populateDateWithTwoWeeksElements = document . getElementsByClassName ( 'amp-populate-date-2-weeks' )
51+
52+ Array . from ( populateDateWithTwoWeeksElements ) . forEach ( function ( populateDateElement ) {
53+ const daysOffset = twoWeeksInDays
54+ addPopulateDateListeners ( populateDateElement , daysOffset )
55+ } )
56+
4957const populateDateWithFourWeeksElements = document . getElementsByClassName ( 'amp-populate-date-4-weeks' )
5058
5159Array . from ( populateDateWithFourWeeksElements ) . forEach ( function ( populateDateElement ) {
You can’t perform that action at this time.
0 commit comments