Menu

#645 Drag and Drop not working on RichFaces

closed
None
5
2012-10-21
2008-07-08
No

I've added a new test, TestDragAndDrop.java, to the htmlunit-richfaces project. To run the test:
svn co http://anonsvn.jboss.org/repos/jsfunit/htmlunit-richfaces/
cd htmlunit-richfaces
mvn -Dtest=DragAndDropTest

I'm doing the same thing Marc showed in his blog here:
http://mguillem.wordpress.com/2007/08/02/scriptaculous-drag-drop-now-works-for-htmlunit/

But nothing seems to happen when I do this with RichFaces.

Discussion

  • Daniel Gredler

    Daniel Gredler - 2008-11-11

    @Marc: I seem to remember that you were looking into this with help from the tracing debugger. Are you still looking into it? Should I assign it to you? Or is it open for others to work on?

     
  • Marc Guillemot

    Marc Guillemot - 2008-11-11

    @Daniel:
    I've already spent a few hours on this but without success (until now). I don't currently work on it, so you can take if you want.

     
  • Daniel Gredler

    Daniel Gredler - 2008-11-25

    If I throw a big fat Thread.sleep(100000) inside of testDragAndDrop(), run the test, and load the test page in Firefox, dragging the "Flexible Ajax" box to the "PHP Frameworks" container results in a 404 error, apparently due to the ";jsessionid=XXX" being appended to the URL. Could this be the source of the problem? Are you seeing this as well?

     
  • Daniel Gredler

    Daniel Gredler - 2008-11-25

    Never mind, I upgraded to the latest cargo snapshot and the 404s went away.

    However, I do have a request: Can you attach non-minified versions of framework.pack.js and ui.pack.js (3.2.2.GA). This would make it much easier for me to narrow the problem down.

    Thanks!

     
  • Stan Silvert

    Stan Silvert - 2008-11-26

    I think that the packed versions are a conglomeration of several smaller files. You can download the source bundle from here:
    http://www.jboss.org/jbossrichfaces/downloads/

     
  • Marc Guillemot

    Marc Guillemot - 2008-11-26

    @Daniel: if you want you can use Rhino to produce non-minified versions of the scripts using Context.compile(..) and then Context.decompile(..)

     
  • Marc Guillemot

    Marc Guillemot - 2010-06-23

    akquinet tech@spree GmbH has asked me to investigate and fix this issue. It was not a simple job but the result is... that there is no bug in HtmlUnit! Only two additional events should be triggered in the test code to make it green.
    (at least this is the case with HtmlUnit-2.7 or newer, no idea how it was at the time where this bug has been reported)

    As a consequence I close this issue as invalid.

    Here is the working version of the unit test:

    public void testDragAndDrop() throws Exception
    {
    WebClient webClient = new WebClient(BrowserVersion.getDefault());
    webClient.setAjaxController(new NicelyResynchronizingAjaxController());
    String url = "http://localhost:8080/htmlunit-richfaces/richfaces/dragSupport.jsf";
    HtmlPage page = (HtmlPage)webClient.getPage(url);
    page = (HtmlPage)webClient.getPage(url); // get it a second time: the server needs to know that
    // we accept cookies and it should not generate urls that it won't accept later because they contain
    // the session id (like "/htmlunit-richfaces/richfaces/dragSupport.jsf;jsessionid=16x7tguh72gi6")

      HtmlTable table = (HtmlTable)page.getElementById("form:phptable");
      assertEquals(0, table.getRowCount());
    
      // element 0 is Flexible Ajax - drag to php
      HtmlElement dragElement = (HtmlElement)page.getElementById("form:src:0:dragItem");
      HtmlElement dropElement = (HtmlElement)page.getElementById("form:phppanel_body");
    
      page = (HtmlPage)dragElement.mouseDown();
      // need to trigger a mousemove outside of dragElement to initiate Prototype's drag & drop stuff correctly
      ((HtmlBody) page.getFirstByXPath("//body")).mouseMove();
      page = (HtmlPage)dropElement.mouseOver();
      page = (HtmlPage)dropElement.mouseMove();
      page = (HtmlPage)dropElement.mouseUp();
    
      table = (HtmlTable)page.getElementById("form:phptable"); // need to get it again because it has been replaced
      assertEquals(1, table.getRowCount()); // <---- assertion now passes!
    

    }

     

Log in to post a comment.