File tree Expand file tree Collapse file tree 3 files changed +24
-5
lines changed
__tests__/snapshot-tests/__snapshots__
test-utils/dom/date-input Expand file tree Collapse file tree 3 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -37350,15 +37350,14 @@ Returns the current value of the input.
37350
37350
},
37351
37351
},
37352
37352
{
37353
- "description": "Sets the value of the component and calls the \`onChange\` handler",
37354
- "inheritedFrom": {
37355
- "name": "BaseInputWrapper.setInputValue",
37356
- },
37353
+ "description": "Sets the value of the component and calls the \`onChange\` handler.
37354
+ The value needs to use the "YYYY/MM/DD" format,
37355
+ but the subsequent \`onChange\` handler will contain the value in the "YYYY-MM-DD" format.",
37357
37356
"name": "setInputValue",
37358
37357
"parameters": [
37359
37358
{
37360
37359
"description": "
37361
- The value the input is set to.
37360
+ The value the input is set to, using the "YYYY/MM/DD" format .
37362
37361
",
37363
37362
"flags": {
37364
37363
"isOptional": false,
Original file line number Diff line number Diff line change @@ -314,4 +314,10 @@ describe('Date Input component', () => {
314
314
expect ( onChangeSpy ) . toHaveBeenCalledWith ( expect . objectContaining ( { detail : { value : '2019-02-28' } } ) ) ;
315
315
} ) ;
316
316
} ) ; // end entering value in middle of input
317
+
318
+ test ( 'uses setInputValue test utils method' , ( ) => {
319
+ const { wrapper, onChangeSpy } = renderDateInput ( { value : '' } ) ;
320
+ wrapper . setInputValue ( '2019/01/31' ) ;
321
+ expect ( onChangeSpy ) . toHaveBeenCalledWith ( expect . objectContaining ( { detail : { value : '2019-01-31' } } ) ) ;
322
+ } ) ;
317
323
} ) ;
Original file line number Diff line number Diff line change 1
1
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
// SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { usesDom } from '@cloudscape-design/test-utils-core/dom' ;
5
+
3
6
import BaseInputWrapper from '../input/base-input' ;
4
7
5
8
import selectors from '../../../date-input/styles.selectors.js' ;
6
9
7
10
export default class DateInputWrapper extends BaseInputWrapper {
8
11
static rootSelector : string = selectors . root ;
12
+
13
+ /**
14
+ * Sets the value of the component and calls the `onChange` handler.
15
+ * The value needs to use the "YYYY/MM/DD" format,
16
+ * but the subsequent `onChange` handler will contain the value in the "YYYY-MM-DD" format.
17
+ *
18
+ * @param value The value the input is set to, using the "YYYY/MM/DD" format.
19
+ */
20
+ @usesDom setInputValue ( value : string ) : void {
21
+ return super . setInputValue ( value ) ;
22
+ }
9
23
}
You can’t perform that action at this time.
0 commit comments