Dashboard widgets: Update disable checkbox copy (#45144)

- Make them more explicit
This commit is contained in:
Noah Talerman
2026-05-19 09:28:33 -04:00
committed by GitHub
parent d11401f6a7
commit e4e706bba1
4 changed files with 54 additions and 18 deletions
@@ -27,9 +27,13 @@ describe("HistoricalDataTeamControls", () => {
it("renders the section heading and both checkboxes", () => {
renderControls();
expect(screen.getByText("Activity & data retention")).toBeInTheDocument();
expect(screen.getByLabelText(/Disable hosts online/i)).toBeInTheDocument();
expect(
screen.getByLabelText(/Disable vulnerabilities/i)
screen.getByLabelText(/Disable hosts online historical reporting/i)
).toBeInTheDocument();
expect(
screen.getByLabelText(
/Disable vulnerability exposure historical reporting/i
)
).toBeInTheDocument();
});
@@ -38,23 +42,39 @@ describe("HistoricalDataTeamControls", () => {
disableHostsActive: true,
disableVulnerabilities: false,
});
expect(screen.getByLabelText(/Disable hosts online/i)).toBeChecked();
expect(screen.getByLabelText(/Disable vulnerabilities/i)).not.toBeChecked();
expect(
screen.getByLabelText(/Disable hosts online historical reporting/i)
).toBeChecked();
expect(
screen.getByLabelText(
/Disable vulnerability exposure historical reporting/i
)
).not.toBeChecked();
});
it("locks the hosts-active checkbox when global is disabled", () => {
renderControls({ globalHostsActiveDisabled: true });
expect(screen.getByLabelText(/Disable hosts online/i)).toBeDisabled();
expect(
screen.getByLabelText(/Disable hosts online historical reporting/i)
).toBeDisabled();
// The vulnerabilities checkbox stays interactive
expect(
screen.getByLabelText(/Disable vulnerabilities/i)
screen.getByLabelText(
/Disable vulnerability exposure historical reporting/i
)
).not.toBeDisabled();
});
it("locks the vulnerabilities checkbox when global is disabled", () => {
renderControls({ globalVulnerabilitiesDisabled: true });
expect(screen.getByLabelText(/Disable vulnerabilities/i)).toBeDisabled();
expect(screen.getByLabelText(/Disable hosts online/i)).not.toBeDisabled();
expect(
screen.getByLabelText(
/Disable vulnerability exposure historical reporting/i
)
).toBeDisabled();
expect(
screen.getByLabelText(/Disable hosts online historical reporting/i)
).not.toBeDisabled();
});
it("preserves the team's stored value while locked", () => {
@@ -62,7 +82,9 @@ describe("HistoricalDataTeamControls", () => {
disableHostsActive: true,
globalHostsActiveDisabled: true,
});
const checkbox = screen.getByLabelText(/Disable hosts online/i);
const checkbox = screen.getByLabelText(
/Disable hosts online historical reporting/i
);
expect(checkbox).toBeChecked();
expect(checkbox).toBeDisabled();
});
@@ -46,7 +46,7 @@ const HistoricalDataTeamControls = ({
)
}
>
Disable hosts online
Disable hosts online historical reporting
</Checkbox>
)}
/>
@@ -72,7 +72,7 @@ const HistoricalDataTeamControls = ({
)
}
>
Disable vulnerabilities
Disable vulnerability exposure historical reporting
</Checkbox>
)}
/>
@@ -42,16 +42,26 @@ describe("Advanced settings — Activity & data retention", () => {
it("renders the new section heading and both checkboxes", () => {
renderAdvanced();
expect(screen.getByText("Activity & data retention")).toBeInTheDocument();
expect(screen.getByLabelText(/Disable hosts online/i)).toBeInTheDocument();
expect(
screen.getByLabelText(/Disable vulnerabilities/i)
screen.getByLabelText(/Disable hosts online historical reporting/i)
).toBeInTheDocument();
expect(
screen.getByLabelText(
/Disable vulnerability exposure historical reporting/i
)
).toBeInTheDocument();
});
it("starts with both checkboxes unchecked when collection is enabled", () => {
renderAdvanced();
expect(screen.getByLabelText(/Disable hosts online/i)).not.toBeChecked();
expect(screen.getByLabelText(/Disable vulnerabilities/i)).not.toBeChecked();
expect(
screen.getByLabelText(/Disable hosts online historical reporting/i)
).not.toBeChecked();
expect(
screen.getByLabelText(
/Disable vulnerability exposure historical reporting/i
)
).not.toBeChecked();
});
it("starts with the checkbox checked when collection is disabled in config", () => {
@@ -59,7 +69,11 @@ describe("Advanced settings — Activity & data retention", () => {
historicalData: { uptime: false, vulnerabilities: true },
});
expect(screen.getByLabelText(/Disable hosts online/i)).toBeChecked();
expect(screen.getByLabelText(/Disable vulnerabilities/i)).not.toBeChecked();
expect(
screen.getByLabelText(
/Disable vulnerability exposure historical reporting/i
)
).not.toBeChecked();
});
it("submits without confirmation when no dataset is being newly disabled", async () => {
@@ -180,7 +180,7 @@ const ActivityDataRetentionSection = ({
)
}
>
Disable hosts online
Disable hosts online historical reporting
</Checkbox>
)}
/>
@@ -207,7 +207,7 @@ const ActivityDataRetentionSection = ({
)
}
>
Disable vulnerabilities
Disable vulnerability exposure historical reporting
</Checkbox>
)}
/>