diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_spec.js index 7bfaa1b086..7e363e8ff4 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_spec.js @@ -3,6 +3,7 @@ const widgetsPage = require("../../../../locators/Widgets.json"); const commonlocators = require("../../../../locators/commonlocators.json"); const publish = require("../../../../locators/publishWidgetspage.json"); const dsl = require("../../../../fixtures/tableWidgetDsl.json"); +const explorer = require("../../../../locators/explorerlocators.json"); describe("Table Widget Functionality", function() { before(() => { @@ -359,6 +360,7 @@ describe("Table Widget Functionality", function() { }); }); */ + afterEach(() => { // put your clean up code if any }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_tabledata_schema_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_tabledata_schema_spec.js new file mode 100644 index 0000000000..818f3438cb --- /dev/null +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_tabledata_schema_spec.js @@ -0,0 +1,62 @@ +const explorer = require("../../../../locators/explorerlocators.json"); +import homePage from "../../../../locators/HomePage.json"; +const publish = require("../../../../locators/publishWidgetspage.json"); + +describe("Table Widget", function() { + it("1. Table Widget Functionality To Check with changing schema of tabledata", () => { + let jsContext = `{{Switch1.isSwitchedOn?[{name: "joe"}]:[{employee_name: "john"}];}}`; + cy.NavigateToHome(); + cy.get(homePage.createNew) + .first() + .click({ force: true }); + cy.wait("@createNewApplication").should( + "have.nested.property", + "response.body.responseMeta.status", + 201, + ); + cy.get(explorer.addWidget).click(); + cy.dragAndDropToCanvas("switchwidget", { x: 200, y: 200 }); + cy.dragAndDropToCanvas("tablewidget", { x: 200, y: 300 }); + cy.wait(1000); + cy.wait("@updateLayout"); + cy.get(".t--property-control-tabledata").then(($el) => { + cy.updateCodeInput($el, jsContext); + }); + cy.PublishtheApp(); + cy.getTableDataSelector("0", "0").then((element) => { + cy.get(element, { timeout: 10000 }).should("be.visible"); + }); + cy.readTabledataPublish("0", "0").then((value) => { + expect(value).to.be.equal("joe"); + }); + cy.get(".t--switch-widget-active") + .first() + .click(); + cy.wait(1000); + cy.getTableDataSelector("0", "0").then((element) => { + cy.get(element, { timeout: 10000 }).should("be.visible"); + }); + cy.readTabledataPublish("0", "0").then((value) => { + expect(value).to.be.equal("john"); + }); + cy.get(".t--switch-widget-inactive") + .first() + .click(); + cy.wait(1000); + cy.getTableDataSelector("0", "0").then((element) => { + cy.get(element, { timeout: 10000 }).should("be.visible"); + }); + cy.readTabledataPublish("0", "0").then((value) => { + expect(value).to.be.equal("joe"); + }); + + cy.get(publish.backToEditor) + .first() + .click() + .wait(1000); + + cy.selectEntityByName("Widgets"); + cy.deleteEntitybyName("Switch1"); + cy.deleteEntitybyName("Table1"); + }); +}); diff --git a/app/client/src/pages/AppViewer/index.tsx b/app/client/src/pages/AppViewer/index.tsx index a7a46104dc..8bbdb93e55 100644 --- a/app/client/src/pages/AppViewer/index.tsx +++ b/app/client/src/pages/AppViewer/index.tsx @@ -18,7 +18,11 @@ import { import { getIsInitialized } from "selectors/appViewSelectors"; import { executeTrigger } from "actions/widgetActions"; import { ExecuteTriggerPayload } from "constants/AppsmithActionConstants/ActionConstants"; -import { updateWidgetPropertyRequest } from "actions/controlActions"; +import { + BatchPropertyUpdatePayload, + batchUpdateWidgetProperty, + updateWidgetPropertyRequest, +} from "actions/controlActions"; import { EditorContext } from "components/editorComponents/EditorContextProvider"; import AppViewerPageContainer from "./AppViewerPageContainer"; import { @@ -86,6 +90,10 @@ export type AppViewerProps = { resetChildrenMetaProperty: (widgetId: string) => void; pages: PageListPayload; lightTheme: Theme; + batchUpdateWidgetProperty: ( + widgetId: string, + updates: BatchPropertyUpdatePayload, + ) => void; } & RouteComponentProps; type Props = AppViewerProps & RouteComponentProps; @@ -150,6 +158,7 @@ class AppViewer extends Component { executeAction: this.props.executeAction, updateWidgetMetaProperty: this.props.updateWidgetMetaProperty, resetChildrenMetaProperty: this.props.resetChildrenMetaProperty, + batchUpdateWidgetProperty: this.props.batchUpdateWidgetProperty, }} > @@ -217,6 +226,10 @@ const mapDispatchToProps = (dispatch: any) => ({ payload: params, }); }, + batchUpdateWidgetProperty: ( + widgetId: string, + updates: BatchPropertyUpdatePayload, + ) => dispatch(batchUpdateWidgetProperty(widgetId, updates)), }); export default withRouter( diff --git a/app/client/src/widgets/TableWidget/widget/index.tsx b/app/client/src/widgets/TableWidget/widget/index.tsx index e34b6720ff..09c951e494 100644 --- a/app/client/src/widgets/TableWidget/widget/index.tsx +++ b/app/client/src/widgets/TableWidget/widget/index.tsx @@ -582,7 +582,7 @@ class TableWidget extends BaseWidget { // If the user has changed the tableData OR // The binding has returned a new value - if (tableDataModified && this.props.renderMode === RenderModes.CANVAS) { + if (tableDataModified) { // Set filter to default const defaultFilter = [ {