* use value prop instead of depracted checked prop
* make sure props are not changed for all tests
(cherry picked from commit d1c7db5365)
Co-authored-by: Erik Sundell <erik.sundell@grafana.com>
This commit is contained in:
co-authored by
Erik Sundell
parent
3e7d7f55c6
commit
621e5bfdb4
+12
@@ -87,4 +87,16 @@ describe('MetricStatEditor', () => {
|
||||
expect(screen.queryByText('Match exact')).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('match exact', () => {
|
||||
it('should be checked when value is true', () => {
|
||||
render(<MetricStatEditor {...props} disableExpressions={false} />);
|
||||
expect(screen.getByLabelText('Match exact - optional')).toBeChecked();
|
||||
});
|
||||
|
||||
it('should be unchecked when value is false', () => {
|
||||
render(<MetricStatEditor {...props} query={{ ...props.query, matchExact: false }} disableExpressions={false} />);
|
||||
expect(screen.getByLabelText('Match exact - optional')).not.toBeChecked();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
+2
-1
@@ -109,7 +109,8 @@ export function MetricStatEditor({
|
||||
tooltip="Only show metrics that exactly match all defined dimension names."
|
||||
>
|
||||
<Switch
|
||||
checked={!!query.matchExact}
|
||||
id="cloudwatch-match-exact"
|
||||
value={!!query.matchExact}
|
||||
onChange={(e) => {
|
||||
onQueryChange({
|
||||
...query,
|
||||
|
||||
Reference in New Issue
Block a user