Merge pull request #36580 from appsmithorg/release
27/09 Daily Promotion
This commit is contained in:
commit
c397bda0f8
|
|
@ -96,7 +96,7 @@ describe(
|
|||
force: true,
|
||||
})
|
||||
.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 },
|
||||
)
|
||||
.wait(3000)
|
||||
|
|
@ -106,7 +106,7 @@ describe(
|
|||
.type("{enter}", { parseSpecialCharSequences: true });
|
||||
|
||||
cy.validateEvaluatedValue(
|
||||
"https://www.facebook.com/users/Cancel?key=test&val=Cancel",
|
||||
"http://host.docker.internal:5001/Cancel?key=test&val=Cancel",
|
||||
);
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -2,13 +2,18 @@ import React from "react";
|
|||
import APIEditorForm from "./components/APIEditorForm";
|
||||
import { Flex } from "@appsmith/ads";
|
||||
import { useChangeActionCall } from "./hooks/useChangeActionCall";
|
||||
import { usePluginActionContext } from "../../PluginActionContext";
|
||||
import { UIComponentTypes } from "api/PluginApi";
|
||||
|
||||
const PluginActionForm = () => {
|
||||
useChangeActionCall();
|
||||
const { plugin } = usePluginActionContext();
|
||||
|
||||
return (
|
||||
<Flex p="spaces-2" w="100%">
|
||||
<APIEditorForm />
|
||||
{plugin.uiComponent === UIComponentTypes.ApiEditorForm ? (
|
||||
<APIEditorForm />
|
||||
) : null}
|
||||
</Flex>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ function useGetFormActionValues() {
|
|||
|
||||
// In an unlikely scenario where form is not initialised,
|
||||
// return empty values to avoid form ui issues
|
||||
if (!isAPIAction(formValues)) {
|
||||
if (!formValues || !isAPIAction(formValues)) {
|
||||
return {
|
||||
actionHeaders: [],
|
||||
actionParams: [],
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ function PluginActionResponse() {
|
|||
expandedHeight={`${ActionExecutionResizerHeight}px`}
|
||||
isCollapsed={!open}
|
||||
onSelect={updateSelectedResponseTab}
|
||||
selectedTabKey={selectedTab || tabs[0].key}
|
||||
selectedTabKey={selectedTab || tabs[0]?.key}
|
||||
tabs={tabs}
|
||||
/>
|
||||
</IDEBottomView>
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
@ -565,6 +565,7 @@ class BaseInputComponent extends React.Component<
|
|||
onKeyUp={this.onKeyUp}
|
||||
onValueChange={this.onNumberChange}
|
||||
placeholder={this.props.placeholder}
|
||||
rightElement={this.getRightIcon()}
|
||||
stepSize={this.props.stepSize}
|
||||
value={this.props.value}
|
||||
{...conditionalProps}
|
||||
|
|
|
|||
|
|
@ -128,39 +128,31 @@ export async function installLibrary(
|
|||
// Find keys add that were installed to the global scope.
|
||||
const keysAfterInstallation = Object.keys(self);
|
||||
|
||||
const differentiatingKeys = difference(
|
||||
let differentiatingKeys = difference(
|
||||
keysAfterInstallation,
|
||||
envKeysBeforeInstallation,
|
||||
);
|
||||
|
||||
if (
|
||||
differentiatingKeys.length > 0 &&
|
||||
differentiatingKeys.includes("default")
|
||||
) {
|
||||
// Changing default export to library specific name
|
||||
const uniqueName = generateUniqueAccessor(
|
||||
url,
|
||||
takenAccessors,
|
||||
takenNamesMap,
|
||||
);
|
||||
// Changing default export to library specific name, if default exported
|
||||
const uniqueName = generateUniqueAccessor(
|
||||
url,
|
||||
takenAccessors,
|
||||
takenNamesMap,
|
||||
);
|
||||
|
||||
// mapping default functionality to library name accessor
|
||||
self[uniqueName] = 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[uniqueName] key object
|
||||
differentiatingKeys.map((key) => {
|
||||
if (key !== "default") {
|
||||
self[uniqueName][key] = self[key];
|
||||
// deleting the references from the self object
|
||||
delete self[key];
|
||||
}
|
||||
});
|
||||
// pushing the uniqueName to the accessor array
|
||||
accessors.push(uniqueName);
|
||||
} else {
|
||||
accessors.push(...differentiatingKeys);
|
||||
}
|
||||
movetheDefaultExportedLibraryToAccessorKey(
|
||||
differentiatingKeys,
|
||||
uniqueName,
|
||||
);
|
||||
|
||||
// Following the same process which was happening earlier
|
||||
const keysAfterDefaultOperation = Object.keys(self);
|
||||
|
||||
differentiatingKeys = difference(
|
||||
keysAfterDefaultOperation,
|
||||
envKeysBeforeInstallation,
|
||||
);
|
||||
accessors.push(...differentiatingKeys);
|
||||
|
||||
/**
|
||||
* Check the list of installed library to see if their values have changed.
|
||||
|
|
@ -308,7 +300,18 @@ export async function loadLibraries(
|
|||
try {
|
||||
self.importScripts(url);
|
||||
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.
|
||||
|
|
@ -447,3 +450,24 @@ export function flattenModule(module: Record<string, any>) {
|
|||
|
||||
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];
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user