Merge pull request #36580 from appsmithorg/release

27/09 Daily Promotion
This commit is contained in:
Aparna Ramachandran 2024-09-27 12:13:21 +05:30 committed by GitHub
commit c397bda0f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 117 additions and 34 deletions

View File

@ -96,7 +96,7 @@ describe(
force: true, force: true,
}) })
.type( .type(
"https://www.facebook.com/users/{{Button2.text}}?key=test&val={{Button2.text}}", "http://host.docker.internal:5001/{{Button2.text}}?key=test&val={{Button2.text}}",
{ force: true, parseSpecialCharSequences: false }, { force: true, parseSpecialCharSequences: false },
) )
.wait(3000) .wait(3000)
@ -106,7 +106,7 @@ describe(
.type("{enter}", { parseSpecialCharSequences: true }); .type("{enter}", { parseSpecialCharSequences: true });
cy.validateEvaluatedValue( cy.validateEvaluatedValue(
"https://www.facebook.com/users/Cancel?key=test&val=Cancel", "http://host.docker.internal:5001/Cancel?key=test&val=Cancel",
); );
}); });
}, },

View File

@ -2,13 +2,18 @@ import React from "react";
import APIEditorForm from "./components/APIEditorForm"; import APIEditorForm from "./components/APIEditorForm";
import { Flex } from "@appsmith/ads"; import { Flex } from "@appsmith/ads";
import { useChangeActionCall } from "./hooks/useChangeActionCall"; import { useChangeActionCall } from "./hooks/useChangeActionCall";
import { usePluginActionContext } from "../../PluginActionContext";
import { UIComponentTypes } from "api/PluginApi";
const PluginActionForm = () => { const PluginActionForm = () => {
useChangeActionCall(); useChangeActionCall();
const { plugin } = usePluginActionContext();
return ( return (
<Flex p="spaces-2" w="100%"> <Flex p="spaces-2" w="100%">
<APIEditorForm /> {plugin.uiComponent === UIComponentTypes.ApiEditorForm ? (
<APIEditorForm />
) : null}
</Flex> </Flex>
); );
}; };

View File

@ -18,7 +18,7 @@ function useGetFormActionValues() {
// In an unlikely scenario where form is not initialised, // In an unlikely scenario where form is not initialised,
// return empty values to avoid form ui issues // return empty values to avoid form ui issues
if (!isAPIAction(formValues)) { if (!formValues || !isAPIAction(formValues)) {
return { return {
actionHeaders: [], actionHeaders: [],
actionParams: [], actionParams: [],

View File

@ -57,7 +57,7 @@ function PluginActionResponse() {
expandedHeight={`${ActionExecutionResizerHeight}px`} expandedHeight={`${ActionExecutionResizerHeight}px`}
isCollapsed={!open} isCollapsed={!open}
onSelect={updateSelectedResponseTab} onSelect={updateSelectedResponseTab}
selectedTabKey={selectedTab || tabs[0].key} selectedTabKey={selectedTab || tabs[0]?.key}
tabs={tabs} tabs={tabs}
/> />
</IDEBottomView> </IDEBottomView>

View File

@ -0,0 +1,53 @@
import React from "react";
import { render } from "@testing-library/react";
import "@testing-library/jest-dom/extend-expect";
import BaseInputComponent, { type BaseInputComponentProps } from "./index";
import { ThemeProvider } from "styled-components";
import { lightTheme } from "selectors/themeSelectors";
const renderBaseInputComponent = (
props: Partial<BaseInputComponentProps> = {},
) => {
const defaultProps: BaseInputComponentProps = {
value: "",
inputType: "TEXT",
inputHTMLType: "TEXT",
disabled: false,
isLoading: false,
compactMode: false,
isInvalid: false,
label: "Salary",
showError: false,
onValueChange: jest.fn(),
onFocusChange: jest.fn(),
widgetId: "test-widget",
rtl: true,
};
return render(
<ThemeProvider theme={lightTheme}>
<BaseInputComponent {...defaultProps} {...props} />
</ThemeProvider>,
);
};
describe("BaseInputComponent TestCases", () => {
test("1. Icon should be visible and aligned to the right when the input type is a number", () => {
const { container } = renderBaseInputComponent({
inputType: "NUMBER",
inputHTMLType: "NUMBER",
value: "123",
onStep: jest.fn(),
rtl: false,
shouldUseLocale: true,
iconName: "add",
iconAlign: "right",
});
const numericInputIcon = container.getElementsByClassName(
"bp3-icon bp3-icon-add",
)[0];
expect(numericInputIcon).toBeInTheDocument();
});
});

View File

@ -565,6 +565,7 @@ class BaseInputComponent extends React.Component<
onKeyUp={this.onKeyUp} onKeyUp={this.onKeyUp}
onValueChange={this.onNumberChange} onValueChange={this.onNumberChange}
placeholder={this.props.placeholder} placeholder={this.props.placeholder}
rightElement={this.getRightIcon()}
stepSize={this.props.stepSize} stepSize={this.props.stepSize}
value={this.props.value} value={this.props.value}
{...conditionalProps} {...conditionalProps}

View File

@ -128,39 +128,31 @@ export async function installLibrary(
// Find keys add that were installed to the global scope. // Find keys add that were installed to the global scope.
const keysAfterInstallation = Object.keys(self); const keysAfterInstallation = Object.keys(self);
const differentiatingKeys = difference( let differentiatingKeys = difference(
keysAfterInstallation, keysAfterInstallation,
envKeysBeforeInstallation, envKeysBeforeInstallation,
); );
if ( // Changing default export to library specific name, if default exported
differentiatingKeys.length > 0 && const uniqueName = generateUniqueAccessor(
differentiatingKeys.includes("default") url,
) { takenAccessors,
// Changing default export to library specific name takenNamesMap,
const uniqueName = generateUniqueAccessor( );
url,
takenAccessors,
takenNamesMap,
);
// mapping default functionality to library name accessor movetheDefaultExportedLibraryToAccessorKey(
self[uniqueName] = self["default"]; differentiatingKeys,
// deleting the reference of default key from the self object uniqueName,
delete self["default"]; );
// mapping all the references of differentiating keys from the self object to the self[uniqueName] key object
differentiatingKeys.map((key) => { // Following the same process which was happening earlier
if (key !== "default") { const keysAfterDefaultOperation = Object.keys(self);
self[uniqueName][key] = self[key];
// deleting the references from the self object differentiatingKeys = difference(
delete self[key]; keysAfterDefaultOperation,
} envKeysBeforeInstallation,
}); );
// pushing the uniqueName to the accessor array accessors.push(...differentiatingKeys);
accessors.push(uniqueName);
} else {
accessors.push(...differentiatingKeys);
}
/** /**
* Check the list of installed library to see if their values have changed. * Check the list of installed library to see if their values have changed.
@ -308,7 +300,18 @@ export async function loadLibraries(
try { try {
self.importScripts(url); self.importScripts(url);
const keysAfter = Object.keys(self); const keysAfter = Object.keys(self);
const defaultAccessors = difference(keysAfter, keysBefore); let defaultAccessors = difference(keysAfter, keysBefore);
// Changing default export to library accessors name which was saved when it was installed, if default export present
movetheDefaultExportedLibraryToAccessorKey(
defaultAccessors,
accessors[0],
);
// Following the same process which was happening earlier
const keysAfterDefaultOperation = Object.keys(self);
defaultAccessors = difference(keysAfterDefaultOperation, keysBefore);
/** /**
* Installing 2 different version of lodash tries to add the same accessor on the self object. Let take version a & b for example. * Installing 2 different version of lodash tries to add the same accessor on the self object. Let take version a & b for example.
@ -447,3 +450,24 @@ export function flattenModule(module: Record<string, any>) {
return libModule; return libModule;
} }
// This function will update the self keys only when the diffAccessors has default included in it.
function movetheDefaultExportedLibraryToAccessorKey(
diffAccessors: string[],
uniqAccessor: string,
) {
if (diffAccessors.length > 0 && diffAccessors.includes("default")) {
// mapping default functionality to library name accessor
self[uniqAccessor] = self["default"];
// deleting the reference of default key from the self object
delete self["default"];
// mapping all the references of differentiating keys from the self object to the self[uniqAccessor] key object
diffAccessors.map((key) => {
if (key !== "default") {
self[uniqAccessor][key] = self[key];
// deleting the references from the self object
delete self[key];
}
});
}
}