Skip to content

Commit

Permalink
[web] Several improvements from review
Browse files Browse the repository at this point in the history
  • Loading branch information
joseivanlopez committed Nov 14, 2023
1 parent eb0c977 commit 7f89c7c
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 29 deletions.
18 changes: 9 additions & 9 deletions web/src/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ const MANAGER_SERVICE = "org.opensuse.Agama.Manager1";

/**
* @typedef {object} InstallerClient
* @property {LanguageClient} language - language client
* @property {ManagerClient} manager - manager client
* @property {Monitor} monitor - service monitor
* @property {NetworkClient} network - network client
* @property {SoftwareClient} software - software client
* @property {StorageClient} storage - storage client
* @property {UsersClient} users - users client
* @property {QuestionsClient} questions - questions client
* @property {() => Promise<Issues>} issues - issues from all contexts
* @property {LanguageClient} language - language client.
* @property {ManagerClient} manager - manager client.
* @property {Monitor} monitor - service monitor.
* @property {NetworkClient} network - network client.
* @property {SoftwareClient} software - software client.
* @property {StorageClient} storage - storage client.
* @property {UsersClient} users - users client.
* @property {QuestionsClient} questions - questions client.
* @property {() => Promise<Issues>} issues - issues from all contexts.
* @property {(handler: IssuesHandler) => (() => void)} onIssuesChange - registers a handler to run
* when issues from any context change. It returns a function to deregister the handler.
* @property {() => Promise<boolean>} isConnected - determines whether the client is connected
Expand Down
2 changes: 1 addition & 1 deletion web/src/client/software.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const REGISTRATION_IFACE = "org.opensuse.Agama1.Registration";

/**
* @typedef {object} Registration
* @property {string} requirement - Registration requirement (i.e., "not-required, "optional",
* @property {string} requirement - Registration requirement (i.e., "not-required", "optional",
* "mandatory").
* @property {string|null} code - Registration code, if any.
* @property {string|null} email - Registration email, if any.
Expand Down
4 changes: 2 additions & 2 deletions web/src/client/software.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ describe("#product", () => {
});

describe("#getRegistration", () => {
describe("if there the product is not registered yet", () => {
describe("if the product is not registered yet", () => {
beforeEach(() => {
registrationProxy.RegCode = "";
registrationProxy.Email = "";
registrationProxy.Requirement = 1;
});

it("returns the expected registration", async () => {
it("returns the expected registration result", async () => {
const client = new SoftwareClient();
const registration = await client.product.getRegistration();
expect(registration).toStrictEqual({
Expand Down
8 changes: 4 additions & 4 deletions web/src/components/core/EmailInput.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe("EmailInput component", () => {
/>
);

const inputField = screen.getByLabelText("User email");
const inputField = screen.getByRole('textbox', { name: "User email" });
expect(inputField).toHaveAttribute("type", "email");
});

Expand All @@ -63,7 +63,7 @@ describe("EmailInput component", () => {

it("triggers onChange callback", async () => {
const { user } = plainRender(<EmailInputTest id="test-email" aria-label="Test email" />);
const emailInput = screen.getByLabelText("Test email");
const emailInput = screen.getByRole('textbox', { name: "Test email" });

expect(screen.queryByText("Email value updated!")).toBeNull();

Expand All @@ -73,7 +73,7 @@ describe("EmailInput component", () => {

it("triggers onValidate callback", async () => {
const { user } = plainRender(<EmailInputTest id="test-email" aria-label="Test email" />);
const emailInput = screen.getByLabelText("Test email");
const emailInput = screen.getByRole('textbox', { name: "Test email" });

expect(screen.queryByText("Email is not valid!")).toBeNull();

Expand All @@ -83,7 +83,7 @@ describe("EmailInput component", () => {

it("marks the input as invalid if the value is not a valid email", async () => {
const { user } = plainRender(<EmailInputTest id="test-email" aria-label="Test email" />);
const emailInput = screen.getByLabelText("Test email");
const emailInput = screen.getByRole('textbox', { name: "Test email" });

await user.type(emailInput, "foo");

Expand Down
22 changes: 11 additions & 11 deletions web/src/components/core/SectionSkeleton.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2022] SUSE LLC
* Copyright (c) [2022-2023] SUSE LLC
*
* All Rights Reserved.
*
Expand All @@ -23,17 +23,17 @@ import React from "react";
import { Skeleton } from "@patternfly/react-core";
import { _ } from "~/i18n";

const SectionSkeleton = ({ numRows = 2 }) => {
const WaitingSkeleton = ({ width }) => {
return (
<Skeleton
screenreaderText={_("Waiting")}
fontSize="sm"
width={width}
/>
);
};
const WaitingSkeleton = ({ width }) => {
return (
<Skeleton
screenreaderText={_("Waiting")}
fontSize="sm"
width={width}
/>
);
};

const SectionSkeleton = ({ numRows = 2 }) => {
return (
<>
{
Expand Down
4 changes: 2 additions & 2 deletions web/src/components/product/ProductPage.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/

import React from "react";
import { act, screen, within } from "@testing-library/react";
import { screen, within } from "@testing-library/react";

import { BUSY } from "~/client/status";
import { installerRender } from "~/test-utils";
Expand Down Expand Up @@ -177,7 +177,7 @@ describe("when the services are busy", () => {
});

it("shows disabled buttons", async () => {
await act(async () => installerRender(<ProductPage />));
installerRender(<ProductPage />);

const selectButton = await screen.findByRole("button", { name: "Change product" });
const registerButton = screen.getByRole("button", { name: "Register" });
Expand Down

0 comments on commit 7f89c7c

Please sign in to comment.