Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    CanvasItem impacting isElementClickable

    Hi Isomorphic,

    We are experiencing a strange behavior with isc.AutoTest.isElementClickable.

    We have created a sample standalone test case to demonstrate.

    In the sample, we have a DynamicForm containing a "toggle" SelectItem, a "color" SelectItem, and a CanvasItem, that returns a ListGrid in the createCanvas implementation.

    The CanvasItem has a showIfCondition, which depends on the value of the "toggle" SelectItem.

    When the CanvasItem is hidden due to the showIfCondition, this seems to impact the isc.AutoTest.isElementClickable function when checking the "color" SelectItem.

    For example,

    a) CanvasItem showIfCondition=true

    m1 = isc.AutoTest.getElement('scLocator=//autoID[Class=HLayout||index=0||length=4||classIndex=0||classLength=1]/member[Class=DynamicForm||index=0||length=1||classIndex=0||classLength=1]/item[name=color||title=Color||index=1||Class=SelectItem]/[icon="picker"]');

    isc.AutoTest.isElementClickable(m1); true

    b) CanvasItem showIfCondition=false

    m1 = isc.AutoTest.getElement('scLocator=//autoID[Class=HLayout||index=0||length=4||classIndex=0||classLength=1]/member[Class=DynamicForm||index=0||length=1||classIndex=0||classLength=1]/item[name=color||title=Color||index=1||Class=SelectItem]/[icon="picker"]');

    isc.AutoTest.isElementClickable(m1); false

    isc.AutoTest.getLogFailureText(m1);

    "a contained canvas of the CanvasItem identified by //autoID[Class=HLayout||index=0||length=1||classIndex=0||classLength=1]/member[Class=DynamicForm||index=0||length=1||classIndex=0||classLength=1]/item[name=nameList||title=List%20of%20Names||index=2||Class=CanvasItem] reports the ListGrid identified by //autoID[Class=HLayout||index=0||length=1||classIndex=0||classLength=1]/member[Class=DynamicForm||index=0||length=1||classIndex=0||classLength=1]/item[name=nameList||title=List%20of%20Names||index=2||Class=CanvasItem]/canvas isn't drawn"

    SmartClient Version: v12.0p_2019-02-28/Pro Deployment (built 2019-02-28)

    Thank you

    Code:
    package com.sandbox.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.types.ListGridFieldType;
    import com.smartgwt.client.widgets.Canvas;
    import com.smartgwt.client.widgets.form.DynamicForm;
    import com.smartgwt.client.widgets.form.FormItemIfFunction;
    import com.smartgwt.client.widgets.form.fields.CanvasItem;
    import com.smartgwt.client.widgets.form.fields.FormItem;
    import com.smartgwt.client.widgets.form.fields.SelectItem;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.layout.HLayout;
    
    public class Sandbox15 extends HLayout implements EntryPoint {
    
        @Override
        public void onModuleLoad() {
            setLayoutMargin(10);
            setMembersMargin(10);
    
            DynamicForm localForm = getForm();
            addMember(localForm);
    
            draw();
        }
    
        private static DynamicForm getForm() {
            DynamicForm form = new DynamicForm();
            form.setWidth(300);
            form.setHeight(50);
    
            SelectItem toggleItem = new SelectItem("toggle", "Show/Hide");
            toggleItem.setRedrawOnChange(Boolean.TRUE);
            toggleItem.setEndRow(Boolean.TRUE);
            toggleItem.setValueMap("Show List of Names", "Hide List of Names");
            toggleItem.setDefaultValue("Show List of Names");
    
            SelectItem colorItem = new SelectItem("color", "Color");
            colorItem.setEndRow(Boolean.TRUE);
            colorItem.setValueMap("Red", "Blue", "Green");
    
            CanvasItem canvasItem = new CanvasItem("nameList", "List of Names") {
                @Override
                protected Canvas createCanvas() {
                    ListGrid grid = new ListGrid();
                    grid.setShowHeaderContextMenu(Boolean.FALSE);
                    ListGridField nameField = new ListGridField("name", "Name");
                    nameField.setType(ListGridFieldType.TEXT);
                    grid.setDefaultFields(nameField);
                    return grid;
                }
            };
            canvasItem.setAutoDestroy(Boolean.TRUE);
            canvasItem.setShowIfCondition(new FormItemIfFunction() {
    
                @Override
                public boolean execute(FormItem item, Object value, DynamicForm form) {
                    SelectItem toggleItem = (SelectItem) form.getItem("toggle");
                    if (toggleItem == null) return false;
                    String toggleItemValue = toggleItem.getValueAsString();
                    return "Show List of Names".equals(toggleItemValue);
                }
            });
    
            form.setItems(toggleItem, colorItem, canvasItem);
            return form;
        }
    }

    #2
    Is this cross-browser consistent for you?

    Does it still happen for you with the latest patched build?

    What if you just manually hide the CanvasItem rather than using the showIf condition, same problem?

    What if you apply hideUsingDisplayNone to the ListGrid that's contained by the CanvasItem?

    Comment


      #3
      Is this cross-browser consistent for you?

      Same behavior on Chrome, Firefox, and Edge.

      Does it still happen for you with the latest patched build?

      Downloaded and verified with SmartClient Version: v12.0p_2019-08-18/Pro Deployment (built 2019-08-18).
      Same behavior.

      What if you just manually hide the CanvasItem rather than using the showIf condition, same problem?

      Same behavior.

      What if you apply hideUsingDisplayNone to the ListGrid that's contained by the CanvasItem?

      Same behavior.

      Comment


        #4
        This should be fixed back to at least SGWT 5.1p/SC 10.1p in the nightly builds dated 2019-08-22 and beyond. We've also added some additional safety checks to isElementClickable() in SGWT 6.1p/SC 11.1p and newer to handle cases where the argument can't be resolved to a DOM element.

        Comment

        Working...
        X