-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(Field.Date): wrap in FieldBlock (#3189)
- Loading branch information
1 parent
f3ce934
commit 4fdbf56
Showing
10 changed files
with
199 additions
and
77 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
100 changes: 79 additions & 21 deletions
100
packages/dnb-eufemia/src/extensions/forms/Field/Date/Date.tsx
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
27 changes: 27 additions & 0 deletions
27
packages/dnb-eufemia/src/extensions/forms/Field/Date/__tests__/Date.screenshot.test.ts
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,27 @@ | ||
import { | ||
makeScreenshot, | ||
setupPageScreenshot, | ||
} from '../../../../../core/jest/jestSetupScreenshots' | ||
|
||
const url = '/uilib/extensions/forms/feature-fields/Date/demos' | ||
|
||
describe.each(['ui'])('Date for %s', (themeName) => { | ||
setupPageScreenshot({ | ||
themeName, | ||
url, | ||
}) | ||
|
||
it('have to match with a label', async () => { | ||
const screenshot = await makeScreenshot({ | ||
selector: '[data-visual-test="date-label"]', | ||
}) | ||
expect(screenshot).toMatchImageSnapshot() | ||
}) | ||
|
||
it('have to match with an error', async () => { | ||
const screenshot = await makeScreenshot({ | ||
selector: '[data-visual-test="date-error"]', | ||
}) | ||
expect(screenshot).toMatchImageSnapshot() | ||
}) | ||
}) |
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
Binary file added
BIN
+4.37 KB
...e/__tests__/__image_snapshots__/date-for-ui-have-to-match-with-a-label.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.48 KB
.../__tests__/__image_snapshots__/date-for-ui-have-to-match-with-an-error.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions
27
packages/dnb-eufemia/src/extensions/forms/Field/Date/stories/Date.stories.tsx
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,27 @@ | ||
import React from 'react' | ||
import { Field } from '../../..' | ||
|
||
export default { | ||
title: 'Eufemia/Extensions/Forms/Date', | ||
} | ||
|
||
export function Date() { | ||
const [state, update] = React.useState('2023-01-16') | ||
React.useEffect(() => { | ||
update('2023-01-18') | ||
}, []) | ||
|
||
return ( | ||
<Field.Date | ||
required | ||
// validateInitially | ||
value={state} | ||
onBlur={console.log} | ||
onFocus={console.log} | ||
onChange={(value) => { | ||
console.log('onChange', value) | ||
update(value) | ||
}} | ||
/> | ||
) | ||
} |
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
Oops, something went wrong.