-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36580 from appsmithorg/release
27/09 Daily Promotion
- Loading branch information
Showing
7 changed files
with
117 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
app/client/src/widgets/BaseInputWidget/component/index.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters