Skip to content

Conversation

@joseivanlopez
Copy link
Contributor

@joseivanlopez joseivanlopez commented Jul 8, 2025

@joseivanlopez joseivanlopez force-pushed the registration-url branch 6 times, most recently from 1c455c4 to 9940bdc Compare July 10, 2025 06:30
@coveralls
Copy link

coveralls commented Jul 10, 2025

Coverage Status

coverage: 64.282% (-0.007%) from 64.289%
when pulling 3d1fc83 on joseivanlopez:registration-url
into efe2af5 on agama-project:master.

@joseivanlopez joseivanlopez force-pushed the registration-url branch 2 times, most recently from a78edca to 72cb81e Compare July 10, 2025 11:02
@dgdavid dgdavid force-pushed the registration-url branch from 3d1fc83 to 19d0add Compare July 11, 2025 17:55
<Form id={formId} onSubmit={submit}>
{/* // TRANSLATORS: input field label */}
<FormGroup label={_("Registration code")}>
<FormGroup fieldId={inputId} label={_("Registration code")}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the id value here to ensure proper association between the label and its corresponding input. This was identified while writing unit tests using getByLabelText, which relies on that association. We're using this method specifically for password fields, since they can't be queried by role because they has no implicit role. Read testing-library/dom-testing-library#567

</FormGroup>
<ActionGroup>
<Button
id={`register-button-${extension.id}-${extension.version}`}
Copy link
Contributor

@dgdavid dgdavid Jul 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency with other ids, I moved this one into a variable too. That said, I’m not sure if it’s still necessary since it seems like it was originally added for testing purposes, but I have updated the test to avoid relying on ids. I’ve kept it for now to be safe, but it might be worth revisiting and potentially removing later.

Comment on lines +448 to +475
describe("and they are registered", () => {
beforeEach(() => {
registeredAddonInfoMock = [
{
id: "sle-ha",
version: "16.0",
registrationCode: "INTERNAL-USE-ONLY-1234-ad42",
},
];
});

it("renders them with its registration code partially hidden", async () => {
const { user } = installerRender(<ProductRegistrationPage />, { withL10n: true });

// the second "Show" button, the first one belongs to the base product registration code
const visibilityCodeToggler = screen.getAllByRole("button", { name: "Show" })[1];
expect(visibilityCodeToggler).not.toBeNull();

// only the end of the code is displayed
screen.getByText(/\*+ad42/);
// not the full code
expect(screen.queryByText(registeredAddonInfoMock[0].registrationCode)).toBeNull();

// after pressing the "Show" button
await user.click(visibilityCodeToggler);
// the full code is visible
screen.getByText(registeredAddonInfoMock[0].registrationCode);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NP: While updating this, I had the feeling that such a test actually belongs to the missing RegistrationExtensions.test.tsx

Comment on lines +263 to +270
const [server, setServer] = useState<ServerOption>("default");
const [url, setUrl] = useState("");
const [key, setKey] = useState("");
const [email, setEmail] = useState("");
const [provideKey, setProvideKey] = useState(true);
const [provideEmail, setProvideEmail] = useState(false);
const [error, setError] = useState<string | null>(null);
const [requestError, setRequestError] = useState<string | null>(null);
const [errors, setErrors] = useState<string[]>([]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NP: Not a blocking comment but just a suggestion for the future: when a component or form starts managing a large number of state variables, I feel can be cleaner and more maintainable to use a reducer instead.

@joseivanlopez joseivanlopez marked this pull request as ready for review July 14, 2025 16:06
</FormGroup>

{isProvided && (
<NestedContent margin="mxMd" aria-live="polite">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here I have to say that I do not get what that margin value means and AI was surprisingly helpful with explaning what it means. So it is In essence, margin="mxMd" tells the component to apply a predefined "medium" horizontal margin to itself.

Copy link
Contributor

@dgdavid dgdavid Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You just had to look at PatternFly documentation 😉 But since it is a kind of common pattern, AI was able to tell you the right answer 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See https://www.patternfly.org/utility-classes/spacing#documentation

That said, it's true we can also improve a little bit the Nested content documentation for at least linking the above link

type NestedContentProps = React.HTMLProps<HTMLDivElement> &

@joseivanlopez joseivanlopez merged commit 856c6b3 into agama-project:master Jul 15, 2025
5 checks passed
@imobachgs imobachgs mentioned this pull request Jul 21, 2025
imobachgs added a commit that referenced this pull request Jul 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants