fix: allow updating computed values of table widget in view mode (#9817)
* fix: allow updating computed values of table widget in view mode * cypress tests
This commit is contained in:
parent
703d47f7b1
commit
8c6bae6f71
|
|
@ -3,6 +3,7 @@ const widgetsPage = require("../../../../locators/Widgets.json");
|
||||||
const commonlocators = require("../../../../locators/commonlocators.json");
|
const commonlocators = require("../../../../locators/commonlocators.json");
|
||||||
const publish = require("../../../../locators/publishWidgetspage.json");
|
const publish = require("../../../../locators/publishWidgetspage.json");
|
||||||
const dsl = require("../../../../fixtures/tableWidgetDsl.json");
|
const dsl = require("../../../../fixtures/tableWidgetDsl.json");
|
||||||
|
const explorer = require("../../../../locators/explorerlocators.json");
|
||||||
|
|
||||||
describe("Table Widget Functionality", function() {
|
describe("Table Widget Functionality", function() {
|
||||||
before(() => {
|
before(() => {
|
||||||
|
|
@ -359,6 +360,7 @@ describe("Table Widget Functionality", function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
// put your clean up code if any
|
// put your clean up code if any
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -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");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
@ -18,7 +18,11 @@ import {
|
||||||
import { getIsInitialized } from "selectors/appViewSelectors";
|
import { getIsInitialized } from "selectors/appViewSelectors";
|
||||||
import { executeTrigger } from "actions/widgetActions";
|
import { executeTrigger } from "actions/widgetActions";
|
||||||
import { ExecuteTriggerPayload } from "constants/AppsmithActionConstants/ActionConstants";
|
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 { EditorContext } from "components/editorComponents/EditorContextProvider";
|
||||||
import AppViewerPageContainer from "./AppViewerPageContainer";
|
import AppViewerPageContainer from "./AppViewerPageContainer";
|
||||||
import {
|
import {
|
||||||
|
|
@ -86,6 +90,10 @@ export type AppViewerProps = {
|
||||||
resetChildrenMetaProperty: (widgetId: string) => void;
|
resetChildrenMetaProperty: (widgetId: string) => void;
|
||||||
pages: PageListPayload;
|
pages: PageListPayload;
|
||||||
lightTheme: Theme;
|
lightTheme: Theme;
|
||||||
|
batchUpdateWidgetProperty: (
|
||||||
|
widgetId: string,
|
||||||
|
updates: BatchPropertyUpdatePayload,
|
||||||
|
) => void;
|
||||||
} & RouteComponentProps<BuilderRouteParams>;
|
} & RouteComponentProps<BuilderRouteParams>;
|
||||||
|
|
||||||
type Props = AppViewerProps & RouteComponentProps<AppViewerRouteParams>;
|
type Props = AppViewerProps & RouteComponentProps<AppViewerRouteParams>;
|
||||||
|
|
@ -150,6 +158,7 @@ class AppViewer extends Component<Props> {
|
||||||
executeAction: this.props.executeAction,
|
executeAction: this.props.executeAction,
|
||||||
updateWidgetMetaProperty: this.props.updateWidgetMetaProperty,
|
updateWidgetMetaProperty: this.props.updateWidgetMetaProperty,
|
||||||
resetChildrenMetaProperty: this.props.resetChildrenMetaProperty,
|
resetChildrenMetaProperty: this.props.resetChildrenMetaProperty,
|
||||||
|
batchUpdateWidgetProperty: this.props.batchUpdateWidgetProperty,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ContainerWithComments>
|
<ContainerWithComments>
|
||||||
|
|
@ -217,6 +226,10 @@ const mapDispatchToProps = (dispatch: any) => ({
|
||||||
payload: params,
|
payload: params,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
batchUpdateWidgetProperty: (
|
||||||
|
widgetId: string,
|
||||||
|
updates: BatchPropertyUpdatePayload,
|
||||||
|
) => dispatch(batchUpdateWidgetProperty(widgetId, updates)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default withRouter(
|
export default withRouter(
|
||||||
|
|
|
||||||
|
|
@ -582,7 +582,7 @@ class TableWidget extends BaseWidget<TableWidgetProps, WidgetState> {
|
||||||
|
|
||||||
// If the user has changed the tableData OR
|
// If the user has changed the tableData OR
|
||||||
// The binding has returned a new value
|
// The binding has returned a new value
|
||||||
if (tableDataModified && this.props.renderMode === RenderModes.CANVAS) {
|
if (tableDataModified) {
|
||||||
// Set filter to default
|
// Set filter to default
|
||||||
const defaultFilter = [
|
const defaultFilter = [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user