mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-23 19:01:28 +00:00
Compare commits
4 Commits
eslint/fix
...
fix_a11y_d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f108ed4fbd | ||
|
|
74095b6bc4 | ||
|
|
5a4b170857 | ||
|
|
8ebd0f9b01 |
@@ -21,12 +21,10 @@ describe("ThroughputInput Pane", () => {
|
||||
});
|
||||
|
||||
it("should switch mode properly", () => {
|
||||
wrapper.find('[aria-label="Manual mode"]').simulate("change");
|
||||
expect(wrapper.find('[aria-label="Throughput header"]').at(0).text()).toBe(
|
||||
"Container throughput (400 - unlimited RU/s)"
|
||||
);
|
||||
wrapper.find(".ms-ChoiceField-input").at(0).simulate("change");
|
||||
expect(wrapper.find("#throughPut").at(0).text()).toBe("Container throughput (autoscale)");
|
||||
|
||||
wrapper.find('[aria-label="Autoscale mode"]').simulate("change");
|
||||
expect(wrapper.find('[aria-label="Throughput header"]').at(0).text()).toBe("Container throughput (autoscale)");
|
||||
wrapper.find(".ms-ChoiceField-input").at(1).simulate("change");
|
||||
expect(wrapper.find("#throughPut").at(0).text()).toBe("Container throughput (400 - unlimited RU/s)");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,4 +1,15 @@
|
||||
import { Checkbox, DirectionalHint, Link, Stack, Text, TextField, TooltipHost } from "@fluentui/react";
|
||||
import {
|
||||
Checkbox,
|
||||
ChoiceGroup,
|
||||
DirectionalHint,
|
||||
IChoiceGroupOption,
|
||||
Label,
|
||||
Link,
|
||||
Stack,
|
||||
Text,
|
||||
TextField,
|
||||
TooltipHost,
|
||||
} from "@fluentui/react";
|
||||
import React, { FunctionComponent, useState } from "react";
|
||||
import * as Constants from "../../../Common/Constants";
|
||||
import { InfoTooltip } from "../../../Common/Tooltip/InfoTooltip";
|
||||
@@ -90,7 +101,7 @@ export const ThroughputInput: FunctionComponent<ThroughputInputProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
const handleOnChangeMode = (event: React.ChangeEvent<HTMLInputElement>, mode: string): void => {
|
||||
const handleOnChangeMode = (_: React.ChangeEvent<HTMLInputElement>, mode: string): void => {
|
||||
if (mode === "Autoscale") {
|
||||
setThroughput(AutoPilotUtils.minAutoPilotThroughput);
|
||||
setIsAutoScaleSelected(true);
|
||||
@@ -103,39 +114,46 @@ export const ThroughputInput: FunctionComponent<ThroughputInputProps> = ({
|
||||
setIsAutoscale(false);
|
||||
}
|
||||
};
|
||||
|
||||
const choiceButtonStyles = {
|
||||
flexContainer: [
|
||||
{
|
||||
selectors: {
|
||||
".ms-ChoiceField-wrapper label": {
|
||||
fontSize: 12,
|
||||
paddingTop: 0,
|
||||
},
|
||||
".ms-ChoiceField": {
|
||||
marginTop: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
const throughPutOptions: IChoiceGroupOption[] = [
|
||||
{ key: "Autoscale", text: "Autoscale" },
|
||||
{ key: "Manual", text: "Manual" },
|
||||
];
|
||||
return (
|
||||
<div className="throughputInputContainer throughputInputSpacing">
|
||||
<Stack horizontal>
|
||||
<span className="mandatoryStar">* </span>
|
||||
<Text aria-label="Throughput header" variant="small" style={{ lineHeight: "20px", fontWeight: 600 }}>
|
||||
<Label id="throughPut" aria-label={getThroughputLabelText()} style={{ lineHeight: "20px", fontWeight: 600 }}>
|
||||
{getThroughputLabelText()}
|
||||
</Text>
|
||||
</Label>
|
||||
<InfoTooltip>{PricingUtils.getRuToolTipText()}</InfoTooltip>
|
||||
</Stack>
|
||||
|
||||
<Stack horizontal verticalAlign="center">
|
||||
<input
|
||||
className="throughputInputRadioBtn"
|
||||
aria-label="Autoscale mode"
|
||||
checked={isAutoscaleSelected}
|
||||
type="radio"
|
||||
role="radio"
|
||||
tabIndex={0}
|
||||
onChange={(e) => handleOnChangeMode(e, "Autoscale")}
|
||||
<Stack verticalAlign="center">
|
||||
<ChoiceGroup
|
||||
ariaLabelledBy="throughPut"
|
||||
styles={choiceButtonStyles}
|
||||
options={throughPutOptions}
|
||||
defaultSelectedKey={throughPutOptions[0].key}
|
||||
onChange={(_: React.ChangeEvent<HTMLInputElement>, options: IChoiceGroupOption) =>
|
||||
handleOnChangeMode(_, options.key.toString())
|
||||
}
|
||||
required
|
||||
/>
|
||||
<span className="throughputInputRadioBtnLabel">Autoscale</span>
|
||||
|
||||
<input
|
||||
className="throughputInputRadioBtn"
|
||||
aria-label="Manual mode"
|
||||
checked={!isAutoscaleSelected}
|
||||
type="radio"
|
||||
role="radio"
|
||||
tabIndex={0}
|
||||
onChange={(e) => handleOnChangeMode(e, "Manual")}
|
||||
/>
|
||||
<span className="throughputInputRadioBtnLabel">Manual</span>
|
||||
</Stack>
|
||||
|
||||
{isAutoscaleSelected && (
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user