Prefer using arrow functions for callbacks (#1287)

This commit is contained in:
Jon Koops 2021-10-04 08:03:19 +02:00 committed by GitHub
parent 3b677c6e8e
commit 55307ec1ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 40 additions and 38 deletions

View file

@ -35,6 +35,7 @@ module.exports = {
"react/prop-types": "off",
// Prevent fragments from being added that have only a single child.
"react/jsx-no-useless-fragment": "error",
"prefer-arrow-callback": "error",
"prettier/prettier": [
"error",
{

View file

@ -15,15 +15,15 @@ const listingPage = new ListingPage();
const createClientScopePage = new CreateClientScopePage();
const modalUtils = new ModalUtils();
describe("Client Scopes test", function () {
describe("Client Scope creation", function () {
beforeEach(function () {
describe("Client Scopes test", () => {
describe("Client Scope creation", () => {
beforeEach(() => {
keycloakBefore();
loginPage.logIn();
sidebarPage.goToClientScopes();
});
it("should fail creating client scope", function () {
it("should fail creating client scope", () => {
listingPage.goToCreateItem();
createClientScopePage.save().checkClientNameRequiredMessage();

View file

@ -19,15 +19,15 @@ const listingPage = new ListingPage();
const createClientPage = new CreateClientPage();
const modalUtils = new ModalUtils();
describe("Clients test", function () {
describe("Client creation", function () {
beforeEach(function () {
describe("Clients test", () => {
describe("Client creation", () => {
beforeEach(() => {
keycloakBefore();
loginPage.logIn();
sidebarPage.goToClients();
});
it("should fail creating client", function () {
it("should fail creating client", () => {
listingPage.goToCreateItem();
createClientPage.continue().checkClientIdRequiredMessage();
@ -46,7 +46,7 @@ describe("Clients test", function () {
);
});
it("Client CRUD test", function () {
it("Client CRUD test", () => {
itemId += "_" + (Math.random() + 1).toString(36).substring(7);
// Create

View file

@ -34,7 +34,7 @@ describe("Identity provider test", () => {
describe("Identity provider creation", () => {
const identityProviderName = "github";
beforeEach(function () {
beforeEach(() => {
keycloakBefore();
loginPage.logIn();
sidebarPage.goToIdentityProviders();

View file

@ -8,18 +8,18 @@ const password = "admin";
const loginPage = new LoginPage();
const masthead = new Masthead();
describe("Logging In", function () {
beforeEach(function () {
describe("Logging In", () => {
beforeEach(() => {
keycloakBefore();
});
it("displays errors on wrong credentials", function () {
it("displays errors on wrong credentials", () => {
loginPage.logIn("wrong", "user{enter}");
loginPage.checkErrorMessage("Invalid username or password.").isLogInPage();
});
it("logs in", function () {
it("logs in", () => {
loginPage.logIn(username, password);
masthead.isAdminConsole();

View file

@ -16,15 +16,15 @@ const listingPage = new ListingPage();
const createRealmRolePage = new CreateRealmRolePage();
const associatedRolesPage = new AssociatedRolesPage();
describe("Realm roles test", function () {
describe("Realm roles creation", function () {
beforeEach(function () {
describe("Realm roles test", () => {
describe("Realm roles creation", () => {
beforeEach(() => {
keycloakBefore();
loginPage.logIn();
sidebarPage.goToRealmRoles();
});
it("should fail creating realm role", function () {
it("should fail creating realm role", () => {
listingPage.goToCreateItem();
createRealmRolePage.save().checkRealmRoleNameRequiredMessage();
@ -37,7 +37,7 @@ describe("Realm roles test", function () {
);
});
it("Realm role CRUD test", function () {
it("Realm role CRUD test", () => {
itemId += "_" + (Math.random() + 1).toString(36).substring(7);
// Create
@ -63,7 +63,7 @@ describe("Realm roles test", function () {
listingPage.itemExist(itemId, false);
});
it("Associated roles test", function () {
it("Associated roles test", () => {
itemId += "_" + (Math.random() + 1).toString(36).substring(7);
// Create

View file

@ -108,7 +108,7 @@ describe("Realm settings tests", () => {
return this;
};
it("Go to general tab", function () {
it("Go to general tab", () => {
sidebarPage.goToRealmSettings();
realmSettingsPage.toggleSwitch(realmSettingsPage.managedAccessSwitch);
realmSettingsPage.save(realmSettingsPage.generalSaveBtn);
@ -446,27 +446,27 @@ describe("Realm settings tests", () => {
cy.findByTestId("rs-profiles-clientPolicies-tab").click();
});
it("Go to client policies profiles tab", function () {
it("Go to client policies profiles tab", () => {
realmSettingsPage.shouldDisplayProfilesTab();
});
it("Check new client form is displaying", function () {
it("Check new client form is displaying", () => {
realmSettingsPage.shouldDisplayNewClientProfileForm();
});
it("Complete new client form and cancel", function () {
it("Complete new client form and cancel", () => {
realmSettingsPage.shouldCompleteAndCancelCreateNewClientProfile();
});
it("Complete new client form and submit", function () {
it("Complete new client form and submit", () => {
realmSettingsPage.shouldCompleteAndCreateNewClientProfile();
});
it("Check cancelling the client profile deletion", function () {
it("Check cancelling the client profile deletion", () => {
realmSettingsPage.shouldDisplayDeleteClientProfileDialog();
});
it("Check deleting the client profile", function () {
it("Check deleting the client profile", () => {
realmSettingsPage.shouldDeleteClientProfileDialog();
});
});

View file

@ -7,9 +7,9 @@ const loginPage = new LoginPage();
const sidebarPage = new SidebarPage();
const sessionsPage = new SessionsPage();
describe("Sessions test", function () {
describe("Session type dropdown", function () {
beforeEach(function () {
describe("Sessions test", () => {
describe("Session type dropdown", () => {
beforeEach(() => {
keycloakBefore();
loginPage.logIn();
sidebarPage.goToSessions();

View file

@ -6,10 +6,7 @@ type ConditionalNodeProps = {
selected: boolean;
};
export const ConditionalNode = memo(function TheNode({
data,
selected,
}: ConditionalNodeProps) {
const ConditionalNodeInner = ({ data, selected }: ConditionalNodeProps) => {
return (
<>
<Handle position={Position.Right} type="source" />
@ -23,4 +20,6 @@ export const ConditionalNode = memo(function TheNode({
<Handle position={Position.Left} type="target" />
</>
);
});
};
export const ConditionalNode = memo(ConditionalNodeInner);

View file

@ -10,11 +10,11 @@ type SubFlowNodeProps = NodeProps & {
prefix: string;
};
export const SubFlowNode = memo(function TheNode({
const SubFlowNodeInner = ({
data: { label },
prefix,
selected,
}: SubFlowNodeProps) {
}: SubFlowNodeProps) => {
return (
<>
<Handle position={Position.Right} type="source" />
@ -30,7 +30,9 @@ export const SubFlowNode = memo(function TheNode({
<Handle position={Position.Left} type="target" />
</>
);
});
};
export const SubFlowNode = memo(SubFlowNodeInner);
export const StartSubFlowNode = ({ ...props }: NodeProps) => (
<SubFlowNode {...props} prefix="Start" />