feat: add tooltip property to select widgets (#18480)

This commit is contained in:
Rishabh Kashyap 2022-12-13 16:05:08 +05:30 committed by GitHub
parent 236214f182
commit 26c01b35e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 181 additions and 18 deletions

View File

@ -0,0 +1,80 @@
{
"dsl": {
"widgetName": "MainContainer",
"backgroundColor": "none",
"rightColumn": 4896,
"snapColumns": 64,
"detachFromLayout": true,
"widgetId": "0",
"topRow": 0,
"bottomRow": 1290,
"containerStyle": "none",
"snapRows": 125,
"parentRowSpace": 1,
"type": "CANVAS_WIDGET",
"canExtend": true,
"version": 70,
"minHeight": 1292,
"dynamicTriggerPathList": [],
"parentColumnSpace": 1,
"dynamicBindingPathList": [],
"leftColumn": 0,
"children": [
{
"boxShadow": "none",
"widgetName": "DatePicker1",
"minDate": "1920-12-31T18:30:00.000Z",
"dateFormat": "YYYY-MM-DD HH:mm",
"displayName": "DatePicker",
"iconSVG": "/static/media/icon.300e5ab8e2e1c26c7a0bad06116842b7.svg",
"searchTags": [
"calendar"
],
"topRow": 17,
"bottomRow": 24,
"shortcuts": false,
"parentRowSpace": 10,
"labelWidth": 5,
"type": "DATE_PICKER_WIDGET2",
"hideCard": false,
"animateLoading": true,
"parentColumnSpace": 12.5625,
"leftColumn": 17,
"dynamicBindingPathList": [
{
"key": "accentColor"
},
{
"key": "borderRadius"
}
],
"labelPosition": "Top",
"isDisabled": false,
"key": "g3ofr85rxv",
"labelTextSize": "0.875rem",
"isRequired": false,
"defaultDate": "2022-12-07T10:48:26.097Z",
"isDeprecated": false,
"rightColumn": 37,
"dynamicHeight": "FIXED",
"widgetId": "0ssaj11vm0",
"accentColor": "{{appsmith.theme.colors.primaryColor}}",
"isVisible": true,
"datePickerType": "DATE_PICKER",
"label": "Label",
"version": 2,
"parentId": "0",
"labelAlignment": "left",
"renderMode": "CANVAS",
"isLoading": false,
"timePrecision": "minute",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
"maxDynamicHeight": 9000,
"firstDayOfWeek": 0,
"closeOnSelection": true,
"maxDate": "2121-12-31T18:29:00.000Z",
"minDynamicHeight": 4
}
]
}
}

View File

@ -0,0 +1,27 @@
const dsl = require("../../../../../fixtures/datePickerV2Updated_dsl.json");
const widgetsPage = require("../../../../../locators/Widgets.json");
import { ObjectsRegistry } from "../../../../../support/Objects/Registry";
let agHelper = ObjectsRegistry.AggregateHelper;
describe("DatePicker Widget Property pane tests with js bindings", function() {
beforeEach(() => {
agHelper.RestoreLocalStorageCache();
});
afterEach(() => {
agHelper.SaveLocalStorageCache();
});
before(() => {
cy.addDsl(dsl);
});
it("1. Datepicker tooltip renders if tooltip prop is not empty", () => {
cy.openPropertyPane("datepickerwidget2");
// enter tooltip in property pan
cy.get(widgetsPage.inputTooltipControl).type("Helpful text for tooltip !");
// tooltip help icon shows
cy.get(".datepicker-tooltip").should("be.visible");
});
});

View File

@ -16,7 +16,7 @@ describe("MultiSelect Widget Functionality", function() {
beforeEach(() => { beforeEach(() => {
cy.wait(3000); cy.wait(3000);
}); });
it("Add new multiselect widget", () => { it("1. Add new multiselect widget", () => {
cy.get(explorer.addWidget).click(); cy.get(explorer.addWidget).click();
cy.dragAndDropToCanvas("multiselectwidgetv2", { x: 300, y: 300 }); cy.dragAndDropToCanvas("multiselectwidgetv2", { x: 300, y: 300 });
cy.get(".t--widget-multiselectwidgetv2").should("exist"); cy.get(".t--widget-multiselectwidgetv2").should("exist");
@ -43,7 +43,7 @@ describe("MultiSelect Widget Functionality", function() {
); );
}); });
it("Copy and paste multiselect widget", () => { it("2. Copy and paste multiselect widget", () => {
cy.openPropertyPane("multiselectwidgetv2"); cy.openPropertyPane("multiselectwidgetv2");
const modifierKey = Cypress.platform === "darwin" ? "meta" : "ctrl"; const modifierKey = Cypress.platform === "darwin" ? "meta" : "ctrl";
//copy and paste //copy and paste
@ -74,4 +74,12 @@ describe("MultiSelect Widget Functionality", function() {
} catch (error) {} } catch (error) {}
}); });
}); });
it("3. Select tooltip renders if tooltip prop is not empty", () => {
cy.openPropertyPane("multiselectwidgetv2");
// enter tooltip in property pan
cy.get(widgetsPage.inputTooltipControl).type("Helpful text for tooltip !");
// tooltip help icon shows
cy.get(".multiselect-tooltip").should("be.visible");
});
}); });

View File

@ -3,6 +3,7 @@ const formWidgetsPage = require("../../../../../locators/FormWidgets.json");
const publish = require("../../../../../locators/publishWidgetspage.json"); const publish = require("../../../../../locators/publishWidgetspage.json");
const commonlocators = require("../../../../../locators/commonlocators.json"); const commonlocators = require("../../../../../locators/commonlocators.json");
const explorer = require("../../../../../locators/explorerlocators.json"); const explorer = require("../../../../../locators/explorerlocators.json");
const widgetsPage = require("../../../../../locators/Widgets.json");
describe("MultiSelectTree Widget Functionality", function() { describe("MultiSelectTree Widget Functionality", function() {
before(() => { before(() => {
@ -119,6 +120,16 @@ describe("MultiSelectTree Widget Functionality", function() {
"No Results Found", "No Results Found",
); );
}); });
it("8. Select tooltip renders if tooltip prop is not empty", () => {
cy.openPropertyPane("multiselecttreewidget");
// enter tooltip in property pan
cy.get(widgetsPage.inputTooltipControl).type("Helpful text for tooltip !");
// tooltip help icon shows
cy.get(".multitree-select-tooltip")
.scrollIntoView()
.should("be.visible");
});
}); });
afterEach(() => { afterEach(() => {
// put your clean up code if any // put your clean up code if any

View File

@ -2,6 +2,7 @@ const explorer = require("../../../../../locators/explorerlocators.json");
const commonlocators = require("../../../../../locators/commonlocators.json"); const commonlocators = require("../../../../../locators/commonlocators.json");
const formWidgetsPage = require("../../../../../locators/FormWidgets.json"); const formWidgetsPage = require("../../../../../locators/FormWidgets.json");
const widgetLocators = require("../../../../../locators/Widgets.json"); const widgetLocators = require("../../../../../locators/Widgets.json");
const widgetsPage = require("../../../../../locators/Widgets.json");
describe("Select widget", () => { describe("Select widget", () => {
it("1. Drag and drop Select/Text widgets", () => { it("1. Drag and drop Select/Text widgets", () => {
@ -79,4 +80,12 @@ describe("Select widget", () => {
.invoke("val") .invoke("val")
.should("not.be.empty"); .should("not.be.empty");
}); });
it("5. Select tooltip renders if tooltip prop is not empty", () => {
cy.openPropertyPane("selectwidget");
// enter tooltip in property pan
cy.get(widgetsPage.inputTooltipControl).type("Helpful text for tooltip !");
// tooltip help icon shows
cy.get(".select-tooltip").should("be.visible");
});
}); });

View File

@ -2,6 +2,7 @@ const dsl = require("../../../../../fixtures/TreeSelectDsl.json");
const formWidgetsPage = require("../../../../../locators/FormWidgets.json"); const formWidgetsPage = require("../../../../../locators/FormWidgets.json");
const publish = require("../../../../../locators/publishWidgetspage.json"); const publish = require("../../../../../locators/publishWidgetspage.json");
const commonlocators = require("../../../../../locators/commonlocators.json"); const commonlocators = require("../../../../../locators/commonlocators.json");
const widgetsPage = require("../../../../../locators/Widgets.json");
describe("Single Select Widget Functionality", function() { describe("Single Select Widget Functionality", function() {
before(() => { before(() => {
@ -133,6 +134,14 @@ describe("Single Select Widget Functionality", function() {
"select option", "select option",
); );
}); });
it("9. Select tooltip renders if tooltip prop is not empty", () => {
cy.openPropertyPane("singleselecttreewidget");
// enter tooltip in property pan
cy.get(widgetsPage.inputTooltipControl).type("Helpful text for tooltip !");
// tooltip help icon shows
cy.get(".tree-select-tooltip").should("be.visible");
});
}); });
afterEach(() => { afterEach(() => {
// put your clean up code if any // put your clean up code if any

View File

@ -178,6 +178,7 @@ class DatePickerComponent extends React.Component<
labelText, labelText,
labelTextColor, labelTextColor,
labelTextSize, labelTextSize,
labelTooltip,
labelWidth, labelWidth,
} = this.props; } = this.props;
const now = moment(); const now = moment();
@ -311,9 +312,11 @@ class DatePickerComponent extends React.Component<
className={`datepicker-label`} className={`datepicker-label`}
color={labelTextColor} color={labelTextColor}
compact={compactMode} compact={compactMode}
cyHelpTextClassName="datepicker-tooltip"
disabled={isDisabled} disabled={isDisabled}
fontSize={labelTextSize} fontSize={labelTextSize}
fontStyle={labelStyle} fontStyle={labelStyle}
helpText={labelTooltip}
isDynamicHeightEnabled={this.props.isDynamicHeightEnabled} isDynamicHeightEnabled={this.props.isDynamicHeightEnabled}
loading={isLoading} loading={isLoading}
position={labelPosition} position={labelPosition}
@ -468,6 +471,7 @@ interface DatePickerComponentProps extends ComponentProps {
borderRadius: string; borderRadius: string;
boxShadow?: string; boxShadow?: string;
accentColor: string; accentColor: string;
labelTooltip?: string;
onFocus?: () => void; onFocus?: () => void;
onBlur?: () => void; onBlur?: () => void;
} }

View File

@ -230,6 +230,16 @@ class DatePickerWidget extends BaseWidget<DatePickerWidget2Props, WidgetState> {
{ {
sectionName: "General", sectionName: "General",
children: [ children: [
{
helpText: "Show help text or details about current selection",
propertyName: "labelTooltip",
label: "Tooltip",
controlType: "INPUT_TEXT",
placeholderText: "Add tooltip text here",
isBindProperty: true,
isTriggerProperty: false,
validation: { type: ValidationTypes.TEXT },
},
{ {
propertyName: "isVisible", propertyName: "isVisible",
label: "Visible", label: "Visible",
@ -505,6 +515,7 @@ class DatePickerWidget extends BaseWidget<DatePickerWidget2Props, WidgetState> {
labelText={this.props.label} labelText={this.props.label}
labelTextColor={this.props.labelTextColor} labelTextColor={this.props.labelTextColor}
labelTextSize={this.props.labelTextSize} labelTextSize={this.props.labelTextSize}
labelTooltip={this.props.labelTooltip}
labelWidth={this.getLabelWidth()} labelWidth={this.getLabelWidth()}
maxDate={this.props.maxDate} maxDate={this.props.maxDate}
minDate={this.props.minDate} minDate={this.props.minDate}

View File

@ -250,6 +250,7 @@ function MultiTreeSelectComponent({
className={`multitree-select-label`} className={`multitree-select-label`}
color={labelTextColor} color={labelTextColor}
compact={compactMode} compact={compactMode}
cyHelpTextClassName="multitree-select-tooltip"
disabled={disabled} disabled={disabled}
fontSize={labelTextSize} fontSize={labelTextSize}
fontStyle={labelStyle} fontStyle={labelStyle}

View File

@ -237,6 +237,16 @@ class MultiSelectTreeWidget extends BaseWidget<
{ {
sectionName: "General", sectionName: "General",
children: [ children: [
{
helpText: "Show help text or details about current selection",
propertyName: "labelTooltip",
label: "Tooltip",
controlType: "INPUT_TEXT",
placeholderText: "Add tooltip text here",
isBindProperty: true,
isTriggerProperty: false,
validation: { type: ValidationTypes.TEXT },
},
{ {
helpText: "Mode to Display options", helpText: "Mode to Display options",
propertyName: "mode", propertyName: "mode",
@ -259,16 +269,6 @@ class MultiSelectTreeWidget extends BaseWidget<
isBindProperty: false, isBindProperty: false,
isTriggerProperty: false, isTriggerProperty: false,
}, },
{
helpText: "Show help text or details about current input",
propertyName: "labelTooltip",
label: "Tooltip",
controlType: "INPUT_TEXT",
placeholderText: "Value must be atleast 6 chars",
isBindProperty: true,
isTriggerProperty: false,
validation: { type: ValidationTypes.TEXT },
},
{ {
helpText: "Sets a Placeholder Text", helpText: "Sets a Placeholder Text",
propertyName: "placeholderText", propertyName: "placeholderText",

View File

@ -310,6 +310,7 @@ function MultiSelectComponent({
className={`multiselect-label`} className={`multiselect-label`}
color={labelTextColor} color={labelTextColor}
compact={compactMode} compact={compactMode}
cyHelpTextClassName="multiselect-tooltip"
disabled={disabled} disabled={disabled}
fontSize={labelTextSize} fontSize={labelTextSize}
fontStyle={labelStyle} fontStyle={labelStyle}

View File

@ -383,11 +383,11 @@ class MultiSelectWidget extends BaseWidget<
sectionName: "General", sectionName: "General",
children: [ children: [
{ {
helpText: "Show help text or details about current input", helpText: "Show help text or details about current selection",
propertyName: "labelTooltip", propertyName: "labelTooltip",
label: "Tooltip", label: "Tooltip",
controlType: "INPUT_TEXT", controlType: "INPUT_TEXT",
placeholderText: "Value must be atleast 6 chars", placeholderText: "Add tooltip text here",
isBindProperty: true, isBindProperty: true,
isTriggerProperty: false, isTriggerProperty: false,
validation: { type: ValidationTypes.TEXT }, validation: { type: ValidationTypes.TEXT },

View File

@ -339,6 +339,7 @@ class SelectComponent extends React.Component<
className={`select-label`} className={`select-label`}
color={labelTextColor} color={labelTextColor}
compact={compactMode} compact={compactMode}
cyHelpTextClassName="select-tooltip"
disabled={disabled} disabled={disabled}
fontSize={labelTextSize} fontSize={labelTextSize}
fontStyle={labelStyle} fontStyle={labelStyle}

View File

@ -319,11 +319,11 @@ class SelectWidget extends BaseWidget<SelectWidgetProps, WidgetState> {
sectionName: "General", sectionName: "General",
children: [ children: [
{ {
helpText: "Show help text or details about current input", helpText: "Show help text or details about current selection",
propertyName: "labelTooltip", propertyName: "labelTooltip",
label: "Tooltip", label: "Tooltip",
controlType: "INPUT_TEXT", controlType: "INPUT_TEXT",
placeholderText: "Value must be atleast 6 chars", placeholderText: "Add tooltip text here",
isBindProperty: true, isBindProperty: true,
isTriggerProperty: false, isTriggerProperty: false,
validation: { type: ValidationTypes.TEXT }, validation: { type: ValidationTypes.TEXT },

View File

@ -262,6 +262,7 @@ function SingleSelectTreeComponent({
className={`tree-select-label`} className={`tree-select-label`}
color={labelTextColor} color={labelTextColor}
compact={compactMode} compact={compactMode}
cyHelpTextClassName="tree-select-tooltip"
disabled={disabled} disabled={disabled}
fontSize={labelTextSize} fontSize={labelTextSize}
fontStyle={labelStyle} fontStyle={labelStyle}

View File

@ -223,11 +223,11 @@ class SingleSelectTreeWidget extends BaseWidget<
sectionName: "General", sectionName: "General",
children: [ children: [
{ {
helpText: "Show help text or details about current input", helpText: "Show help text or details about current selection",
propertyName: "labelTooltip", propertyName: "labelTooltip",
label: "Tooltip", label: "Tooltip",
controlType: "INPUT_TEXT", controlType: "INPUT_TEXT",
placeholderText: "Value must be atleast 6 chars", placeholderText: "Add tooltip text here",
isBindProperty: true, isBindProperty: true,
isTriggerProperty: false, isTriggerProperty: false,
validation: { type: ValidationTypes.TEXT }, validation: { type: ValidationTypes.TEXT },