Menu

#131 TinyMCE Support

closed
None
5
2012-10-21
2008-08-19
Mike Dirolf
No

The current version of TinyMCE (http://tinymce.moxiecode.com/) uses createTextRange in IE and createTreeWalker (http://www.w3.org/TR/DOM-Level-2-Traversal-Range/traversal.html) in Gecko browsers. Neither of these functions work in HtmlUnit. It seems that none of the optional DOM Level 2 Traversal feature is supported in HtmlUnit right now, and I'm not sure what the status of IE support is (besides the fact that createTextRange doesn't work). It would be nice if these features could be implemented so that HtmlUnit could be used to test sites with TinyMCE.

I might be able to look at implementing one or both of these in the future, but was wondering what the current status is or if anybody else is working on supporting TinyMCE.

Discussion

  • Mike Dirolf

    Mike Dirolf - 2008-09-03

    Patch adding createTreeWalker support to htmlunit.

     
  • Mike Dirolf

    Mike Dirolf - 2008-09-03

    Logged In: YES
    user_id=2182041
    Originator: YES

    File Added: treewalkersupport.patch

     
  • Mike Dirolf

    Mike Dirolf - 2008-09-03

    Logged In: YES
    user_id=2182041
    Originator: YES

    i have added a patch which implements TreeWalker support for htmlunit. there are some unit tests written (of course more tests is always better). please critique this implementation - the one detail which I am a bit concerned about is the addition of the private staticGetPrototype method in HTMLDocument, which is used by jsxFunction_createTreeWalker. was not sure how else to handle this. the tests i've written all pass, and tinymce no longer complains (at least when htmlunit is simulating firefox).

     
  • Marc Guillemot

    Marc Guillemot - 2008-09-09

    Impressive patch with many tests what's really good... but the results you expect from HtmlUnit are not the ones I get in my Firefox (no matter if 2 or 3) for 7 of the 17 tests. Can you check that?

    Btw: do you belong to TinyMCE team?

     
  • Mike Dirolf

    Mike Dirolf - 2008-09-09

    thanks for the feedback! is there an easy way to run the tests against FF instead of htmlunit? i tried to check them as i wrote them by manually typing them into the firebug console but apparently i missed something with that method.

    no i don't belong to the TinyMCE team - i work for 10gen, an open-source cloud computing company. we are trying to test some sites running on our platform that use TinyMCE.

     
  • Marc Guillemot

    Marc Guillemot - 2008-09-09

    Currently the best way is to use following VM argument:
    -Dcom.gargoylesoftware.htmlunit.WebTestCase.GenerateTestpages=true

    then createTestPageForRealBrowserIfNeeded will create html files that can be opened directly in FF and that will tell you if the expectation are correct. If you activate the info log level this will look like:
    INFO 14:18:23,525 WebTestCase: Test file written: /tmp/TEST_57790.html

     
  • Mike Dirolf

    Mike Dirolf - 2008-09-09

    so it looks like those tests are failing because of the additional html that is injected into the generated FF tests. TreeWalker is walking around the DOM, but the DOM is different for the generated testpages than for the test pages that are being run in the htmlunit tests. this accounts for 5 of the 7 mismatches. i think the other 2 are for the two test cases that expect exceptions. for both of these tests FF does throw an exception (at least FF 3 where i'm testing this). not sure why this isn't being reported as matching the expectation.

     
  • Marc Guillemot

    Marc Guillemot - 2008-09-09

    hmm, you're right, the instrumentation is problematic for these tests.
    Nevertheless I could see there are at least problems with the constant values. For instance in testGetter2, my FF doesn't give -1 as third alert but 4294967295. Additionally testEmpty throws a JS error in my FF.

     
  • Mike Dirolf

    Mike Dirolf - 2008-09-09

    Fix one of the tests so the expected results work in FF.

     
  • Mike Dirolf

    Mike Dirolf - 2008-09-09

    you're right - i have attached another revision of the patch fixing the -1 vs 4294967295 problem in FF. testEmptyFilter is one of the tests i was talking about - it is supposed to throw an exception. that's why i gave it a @Test(expected = ScriptException.class). is there something else i need to do to get it to expect the exception for the FF tests?
    File Added: treewalkersupport2.patch

     
  • Marc Guillemot

    Marc Guillemot - 2008-10-27

    Patch applied. Thanks.

     
  • Ahmed Ashour

    Ahmed Ashour - 2008-10-28

    Impressive patch, is createNodeIterator() in the queue? ;)

     
  • Mike Dirolf

    Mike Dirolf - 2008-10-29

    thanks! heh - sure I can add it to the queue. the queue is rather long right now though, so it could be a while before this gets anywhere.

     

Log in to post a comment.