playbook_ui 12.14.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown456 → 12.14.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown457

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d134719af99c9b743c91b79eaf9df31ec4f190b0ee63eef43ca0371f45285bae
4
- data.tar.gz: 9548d090839568767077f07961bc410807d7f658c0b9c26bc732192f39f98740
3
+ metadata.gz: 7f8208a14e5c15e8c393a68f57267ab77dfcb112e76ab6624b323520ee24110f
4
+ data.tar.gz: 644200e7aba10dfa8636622d05203dd2fa26b74bcee471fd05d848edb53ad428
5
5
  SHA512:
6
- metadata.gz: fe57e92aa08c99eba690fe145d67f01f7bdc07bea84a3697445a8231c80a3d1ce10196f4dc9239d147eefa54064334d3f065772b62414218e28d8c0b9befcc76
7
- data.tar.gz: b61b2412844e71772d46587d98803aa254e43e100466345873958cbfe093faa37a7242be2a8b5cd0202a5e1716bd88cb63d8647f63d302d99aafe05f12bdf878
6
+ metadata.gz: 9ae9ad4954a065d536856caf8f8cfbecb68885dec8674e06dd8f80c7c7abe3e2346cca288aee7792e49165658720d23da9402867d74702157f9024716ae82e08
7
+ data.tar.gz: 3f88105477044a5db447ac93a924aa43e84112df2bb17a347bb0b372e78bedcaf1723069921aeb4bf359e3552806a48f8fe6cee7c66c895e6016a39c817f31e3
@@ -103,65 +103,6 @@ module Playbook
103
103
  class_string += error_class
104
104
  class_string
105
105
  end
106
-
107
- def format_date(date)
108
- date.strftime("%m/%d/%Y")
109
- end
110
-
111
- def date_ranges
112
- [
113
- {
114
- label: "Today",
115
- start_date: format_date(::Date.current),
116
- end_date: format_date(::Date.current),
117
- },
118
- {
119
- label: "Yesterday",
120
- start_date: format_date(::Date.current.yesterday),
121
- end_date: format_date(::Date.current.yesterday),
122
- },
123
- {
124
- label: "This Week",
125
- start_date: format_date(::Date.current.beginning_of_week),
126
- end_date: format_date(::Date.current.end_of_week),
127
- },
128
- {
129
- label: "This Month",
130
- start_date: format_date(::Date.current.beginning_of_month),
131
- end_date: format_date(::Date.current),
132
- },
133
- {
134
- label: "This Quarter",
135
- start_date: format_date(::Date.current.beginning_of_quarter),
136
- end_date: format_date(::Date.current),
137
- },
138
- {
139
- label: "This Year",
140
- start_date: format_date(::Date.current.beginning_of_year),
141
- end_date: format_date(::Date.current),
142
- },
143
- {
144
- label: "Last Week",
145
- start_date: format_date(::Date.current.last_week.beginning_of_week),
146
- end_date: format_date(::Date.current.last_week.end_of_week),
147
- },
148
- {
149
- label: "Last Month",
150
- start_date: format_date(::Date.current.last_month.beginning_of_month),
151
- end_date: format_date(::Date.current.last_month.end_of_month),
152
- },
153
- {
154
- label: "Last Quarter",
155
- start_date: format_date(::Date.current.last_quarter.beginning_of_quarter),
156
- end_date: format_date(::Date.current.last_quarter.end_of_quarter),
157
- },
158
- {
159
- label: "Last Year",
160
- start_date: format_date(::Date.current.last_year.beginning_of_year),
161
- end_date: format_date(::Date.current.last_year.end_of_year),
162
- },
163
- ]
164
- end
165
106
  end
166
107
  end
167
108
  end
@@ -158,4 +158,47 @@ describe('DatePicker Kit', () => {
158
158
  expect(input).toHaveValue('01/01/2020 at 12:00 PM')
159
159
  })
160
160
  })
161
+ test('shows DatePicker QuickPick dropdown', async () => {
162
+ const testId = 'datepicker-quick-pick'
163
+ render(
164
+ <DatePicker
165
+ allowInput
166
+ data={{ testid: testId }}
167
+ mode="range"
168
+ pickerId="date-picker-quick-pick"
169
+ placeholder="mm/dd/yyyy → mm/dd/yyyy"
170
+ selectionType="quickpick"
171
+ />
172
+ )
173
+
174
+ const kit = screen.getByTestId(testId)
175
+ const input = within(kit).getByPlaceholderText('mm/dd/yyyy → mm/dd/yyyy')
176
+
177
+ fireEvent(
178
+ input,
179
+ new MouseEvent('click', {
180
+ bubbles: true,
181
+ cancelable: true,
182
+ }),
183
+ )
184
+ const today = within(kit).getByText('Today')
185
+ const thisYear = within(kit).getByText('This year')
186
+ await waitFor(() => {
187
+ expect(today).toBeInTheDocument()
188
+ expect(thisYear).toBeInTheDocument()
189
+ })
190
+
191
+ fireEvent(
192
+ thisYear,
193
+ new MouseEvent('click', {
194
+ bubbles: true,
195
+ cancelable: true,
196
+ }),
197
+ )
198
+
199
+ await waitFor(() => {
200
+ expect(input).toHaveValue('01/01/2023 → 12/31/2023')
201
+ })
202
+
203
+ })
161
204
  })
@@ -5,7 +5,6 @@ import DatePicker from '../_date_picker'
5
5
  const DatePickerRange = (props) => (
6
6
  <div>
7
7
  <DatePicker
8
- allowInput
9
8
  defaultDate={[new Date(), new Date().fp_incr(7)]}
10
9
  mode="range"
11
10
  pickerId="date-picker-range"
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Playbook
4
4
  PREVIOUS_VERSION = "12.14.0"
5
- VERSION = "12.14.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown456"
5
+ VERSION = "12.14.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown457"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playbook_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.14.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown456
4
+ version: 12.14.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown457
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX