Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
805abdfa
Unverified
Commit
805abdfa
authored
Mar 10, 2020
by
Dominik Prokop
Committed by
GitHub
Mar 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure commit hook in FieldPropertiesEditor is invalidated when value changes (#22673)
parent
17a14a8a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
1 deletions
+36
-1
packages/grafana-ui/src/components/SingleStatShared/FieldPropertiesEditor.test.tsx
+32
-0
packages/grafana-ui/src/components/SingleStatShared/FieldPropertiesEditor.tsx
+4
-1
No files found.
packages/grafana-ui/src/components/SingleStatShared/FieldPropertiesEditor.test.tsx
0 → 100644
View file @
805abdfa
import
React
from
'react'
;
import
{
FieldPropertiesEditor
}
from
'./FieldPropertiesEditor'
;
import
{
FieldConfig
}
from
'@grafana/data'
;
import
{
mount
}
from
'enzyme'
;
describe
(
'FieldPropertiesEditor'
,
()
=>
{
describe
(
'when bluring min/max field'
,
()
=>
{
it
(
"when title was modified it should persist it's value"
,
()
=>
{
const
onChangeHandler
=
jest
.
fn
();
const
value
:
FieldConfig
=
{
title
:
'Title set'
,
};
const
container
=
mount
(<
FieldPropertiesEditor
value=
{
value
}
onChange=
{
onChangeHandler
}
showTitle
showMinMax
/>);
const
minInput
=
container
.
find
(
'input[aria-label="Field properties editor min input"]'
);
const
maxInput
=
container
.
find
(
'input[aria-label="Field properties editor max input"]'
);
// Simulating title update provided from PanelModel options
container
.
setProps
({
value
:
{
title
:
'Title updated'
}
});
minInput
.
simulate
(
'blur'
);
maxInput
.
simulate
(
'blur'
);
expect
(
onChangeHandler
).
toHaveBeenLastCalledWith
({
title
:
'Title updated'
,
min
:
undefined
,
max
:
undefined
,
decimals
:
undefined
,
});
});
});
});
//
packages/grafana-ui/src/components/SingleStatShared/FieldPropertiesEditor.tsx
View file @
805abdfa
...
...
@@ -72,7 +72,7 @@ export const FieldPropertiesEditor: React.FC<Props> = ({ value, onChange, showMi
min
:
toFloatOrUndefined
(
min
),
max
:
toFloatOrUndefined
(
max
),
});
},
[
min
,
max
,
decimals
]);
},
[
min
,
max
,
decimals
,
value
]);
const
titleTooltip
=
(
<
div
>
...
...
@@ -96,6 +96,7 @@ export const FieldPropertiesEditor: React.FC<Props> = ({ value, onChange, showMi
value=
{
title
}
tooltip=
{
titleTooltip
}
placeholder=
"Auto"
aria
-
label=
"Field properties editor title input"
/>
)
}
...
...
@@ -113,6 +114,7 @@ export const FieldPropertiesEditor: React.FC<Props> = ({ value, onChange, showMi
value=
{
min
}
placeholder=
"Auto"
type=
"number"
aria
-
label=
"Field properties editor min input"
/>
<
FormField
label=
"Max"
...
...
@@ -122,6 +124,7 @@ export const FieldPropertiesEditor: React.FC<Props> = ({ value, onChange, showMi
value=
{
max
}
type=
"number"
placeholder=
"Auto"
aria
-
label=
"Field properties editor max input"
/>
</>
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment