0

I have to refactor an existing GWT web project, with no existing test cases. Before I start I want to create test cases for common action. I am trying to write a test case with zombie.js. But my problem is more of a general javascript challenge. Take a look at the example below. I need a test case that simulates a click on UI element which contains the text "Click me!". But the click handler is assign to some element before, e.g. c11 or c1. Any idea how this can be implemented?

<div id="c1">
    <div id="c11">
        <div id="c12"></div>
        <div id="c13"></div>
        <div id="c14"><nobr>Click me!</nobr></div>
    </div>
</div>
appbootup
  • 9,537
  • 3
  • 33
  • 65
chris.tian
  • 770
  • 5
  • 13
  • Any updates? It would be nice to know whether zombie.js is useful in this sense. Do share relevant links if any for gwt apps. – appbootup Dec 17 '12 at 05:57

2 Answers2

0

The click event should bubble up automatically and thus trigger your handlers. For information on how to manually trigger the click event, see this answer: https://stackoverflow.com/a/2490876/315482

Community
  • 1
  • 1
shellster
  • 1,091
  • 1
  • 10
  • 21
0

Not sure zombie.js is the approach for unit testing or integration testing in GWT application. The reason to avoid js level stuff is if GWT Widget use changes in the app DOM layer can be indeterminate and the js based unit tests stuff gets flaky.

GWT Unit testing approach is documented here - https://developers.google.com/web-toolkit/doc/latest/tutorial/JUnit

Testing methodology for GWT apps - https://developers.google.com/web-toolkit/articles/testing_methodologies_using_gwt

Some Additional Resources - http://code.google.com/p/gwt-test-utils/wiki/SimpleUnitTest

appbootup
  • 9,537
  • 3
  • 33
  • 65