mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
CloudWatch: Make sure MatchExact flag gets the right value (#42621)
* use value prop instead of depracted checked prop * make sure props are not changed for all tests
This commit is contained in:
@@ -87,4 +87,16 @@ describe('MetricStatEditor', () => {
|
|||||||
expect(screen.queryByText('Match exact')).toBeNull();
|
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();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -109,7 +109,8 @@ export function MetricStatEditor({
|
|||||||
tooltip="Only show metrics that exactly match all defined dimension names."
|
tooltip="Only show metrics that exactly match all defined dimension names."
|
||||||
>
|
>
|
||||||
<Switch
|
<Switch
|
||||||
checked={!!query.matchExact}
|
id="cloudwatch-match-exact"
|
||||||
|
value={!!query.matchExact}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
onQueryChange({
|
onQueryChange({
|
||||||
...query,
|
...query,
|
||||||
|
|||||||
Reference in New Issue
Block a user