-
Notifications
You must be signed in to change notification settings - Fork 860
[EuiInlineEdit] Test Cases for EuiInlineEdit
#6722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
fa32dfd
283f8a0
1ab4495
c405805
9208180
34a11ef
f08cd5b
598cd09
6005e53
c591a33
55878e4
b113e67
b9624a8
3465510
41f0daa
7f4f604
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,9 @@ const inlineEditTitleSource = require('!!raw-loader!./inline_edit_title'); | |
| import InlineEditModeProps from './inline_edit_mode_props'; | ||
| const inlineEditModePropsSource = require('!!raw-loader!./inline_edit_mode_props'); | ||
|
|
||
| import InlineEditSave from './inline_edit_save'; | ||
| const inlineEditSaveSource = require('!!raw-loader!././inline_edit_save'); | ||
|
|
||
| import InlineEditConfirm from './inline_edit_confirm'; | ||
| const inlineEditConfirmSource = require('!!raw-loader!././inline_edit_confirm'); | ||
|
|
||
|
|
@@ -38,6 +41,7 @@ export const InlineEditExample = { | |
| </EuiText> | ||
| </> | ||
| ), | ||
| isNew: true, | ||
| sections: [ | ||
| { | ||
| title: 'Display and edit basic text', | ||
|
|
@@ -80,6 +84,26 @@ export const InlineEditExample = { | |
| demo: <InlineEditTitle />, | ||
| props: { EuiInlineEditTitle }, | ||
| }, | ||
| { | ||
| title: 'Saving edited text', | ||
| text: ( | ||
| <> | ||
| <p> | ||
| Use the <EuiCode>onSave</EuiCode> property to retrieve the value of | ||
| the edited text when the save button is pressed, and the{' '} | ||
| <EuiCode>onConfirm</EuiCode> callback (if passed) returns{' '} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Not a blocking comment - revisiting this in follow-up PR is definitely an option] Looking at the docs, I'm tempted to either move the We may also need to show consumers how to use In particular I'm worried about |
||
| <EuiCode>true</EuiCode> .{' '} | ||
| </p> | ||
| </> | ||
| ), | ||
| source: [ | ||
| { | ||
| type: GuideSectionTypes.TSX, | ||
| code: inlineEditSaveSource, | ||
| }, | ||
| ], | ||
| demo: <InlineEditSave />, | ||
| }, | ||
| { | ||
| title: 'Loading and invalid states', | ||
| text: ( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import React from 'react'; | ||
|
|
||
| import { EuiButton, EuiInlineEditText, EuiSpacer } from '../../../../src'; | ||
|
|
||
| export default () => { | ||
| const saveToLocalStorage = (newInlineEditValue: string) => { | ||
| localStorage.setItem('inlineEditValue', newInlineEditValue); | ||
| }; | ||
|
|
||
| const removeFromLocalStorage = () => { | ||
| localStorage.removeItem('inlineEditValue'); | ||
| }; | ||
|
|
||
| const defaultInlineEditValue = | ||
| localStorage.getItem('inlineEditValue') || | ||
| 'This value will persist when you refresh the page!'; | ||
|
|
||
| return ( | ||
| <> | ||
| <EuiInlineEditText | ||
| inputAriaLabel="Edit text inline" | ||
| defaultValue={defaultInlineEditValue} | ||
| size="m" | ||
| onSave={(onSaveVal) => saveToLocalStorage(onSaveVal)} | ||
| /> | ||
|
|
||
| <EuiSpacer /> | ||
|
|
||
| <EuiButton onClick={removeFromLocalStorage}> | ||
| Remove saved value from local storage | ||
| </EuiButton> | ||
| </> | ||
| ); | ||
| }; |
Uh oh!
There was an error while loading. Please reload this page.