2525import com .google .gwt .event .dom .client .FocusHandler ;
2626import com .google .gwt .event .logical .shared .InitializeEvent ;
2727import com .google .gwt .event .logical .shared .InitializeHandler ;
28- import com .google .gwt .junit .DoNotRunWith ;
29- import com .google .gwt .junit .Platform ;
3028import com .google .gwt .junit .client .GWTTestCase ;
3129import com .google .gwt .safehtml .shared .SafeHtmlUtils ;
3230import com .google .gwt .user .client .Event ;
@@ -49,12 +47,16 @@ public String getModuleName() {
4947 return "com.google.gwt.user.User" ;
5048 }
5149
50+ @ Override
51+ protected void gwtTearDown () throws Exception {
52+ RootPanel .get ().clear ();
53+ }
54+
5255 /**
5356 * Test that removing and re-adding an RTA doesn't destroy its contents (Only
5457 * IE actually preserves dynamically-created iframe contents across DOM
5558 * removal/re-adding).
5659 */
57- @ DoNotRunWith (Platform .HtmlUnitUnknown )
5860 public void testAddEditRemoveAdd () {
5961 final RichTextArea area = new RichTextArea ();
6062 delayTestFinish (RICH_TEXT_ASYNC_DELAY );
@@ -126,6 +128,23 @@ public void testAddRemoveBeforeInit() {
126128 final RichTextArea richTextArea = new RichTextArea ();
127129 RootPanel .get ().add (richTextArea );
128130 RootPanel .get ().remove (richTextArea );
131+
132+ // Delay 100ms and confirm that initialization has not fired
133+ boolean [] initFired = {false };
134+ richTextArea .addInitializeHandler (new InitializeHandler () {
135+ @ Override
136+ public void onInitialize (InitializeEvent event ) {
137+ initFired [0 ] = true ;
138+ }
139+ });
140+ new Timer () {
141+ @ Override
142+ public void run () {
143+ assertFalse (initFired [0 ]);
144+ finishTest ();
145+ }
146+ }.schedule (100 );
147+ delayTestFinish (RICH_TEXT_ASYNC_DELAY );
129148 }
130149
131150 public void testFormatAfterAttach () {
@@ -148,7 +167,6 @@ public void testFormatAfterAttach() {
148167 }
149168 }
150169
151- @ DoNotRunWith (Platform .HtmlUnitUnknown )
152170 public void testFormatAfterInitialize () {
153171 final RichTextArea area = new RichTextArea ();
154172
@@ -186,7 +204,6 @@ public void testFormatBeforeAttach() {
186204 }
187205 }
188206
189- @ DoNotRunWith (Platform .HtmlUnitUnknown )
190207 public void testFormatWhenHidden () {
191208 final RichTextArea area = new RichTextArea ();
192209 delayTestFinish (RICH_TEXT_ASYNC_DELAY );
@@ -209,7 +226,6 @@ public void onInitialize(InitializeEvent event) {
209226 /**
210227 * See that the custom InitializeEvent fires.
211228 */
212- @ DoNotRunWith ({Platform .HtmlUnitUnknown })
213229 public void testRichTextInitializeEvent () {
214230 delayTestFinish (RICH_TEXT_ASYNC_DELAY );
215231 final RichTextArea richTextArea = new RichTextArea ();
@@ -225,7 +241,6 @@ public void onInitialize(InitializeEvent event) {
225241 /**
226242 * Test that a delayed call to setEnable is reflected.
227243 */
228- @ DoNotRunWith (Platform .HtmlUnitUnknown )
229244 public void testSetEnabledAfterInit () {
230245 final RichTextArea richTextArea = new RichTextArea ();
231246 delayTestFinish (RICH_TEXT_ASYNC_DELAY );
@@ -246,7 +261,6 @@ public void onInitialize(InitializeEvent event) {
246261 * Test that a call to setEnable is reflected immediately, and after the area
247262 * loads.
248263 */
249- @ DoNotRunWith (Platform .HtmlUnitUnknown )
250264 public void testSetEnabledBeforeInit () {
251265 final RichTextArea richTextArea = new RichTextArea ();
252266 richTextArea .setEnabled (false );
@@ -266,7 +280,6 @@ public void onInitialize(InitializeEvent event) {
266280 /**
267281 * Test that events are dispatched correctly to handlers.
268282 */
269- @ DoNotRunWith (Platform .HtmlUnitUnknown )
270283 public void testEventDispatch () {
271284 final RichTextArea rta = new RichTextArea ();
272285 RootPanel .get ().add (rta );
@@ -300,9 +313,8 @@ public void run() {
300313 * Test that a delayed set of HTML is reflected. Some platforms have timing
301314 * subtleties that need to be tested.
302315 */
303- @ DoNotRunWith (Platform .HtmlUnitUnknown )
304316 public void testSetHTMLAfterInit () {
305- final RichTextArea richTextArea = new RichTextArea ();
317+ final RichTextArea richTextArea = new RichTextArea ();
306318 delayTestFinish (RICH_TEXT_ASYNC_DELAY );
307319 richTextArea .addInitializeHandler (new InitializeHandler () {
308320 @ Override
@@ -319,7 +331,6 @@ public void onInitialize(InitializeEvent event) {
319331 * Test that an immediate set of HTML is reflected immediately and after the
320332 * area loads. Some platforms have timing subtleties that need to be tested.
321333 */
322- @ DoNotRunWith (Platform .HtmlUnitUnknown )
323334 public void testSetHTMLBeforeInit () {
324335 final RichTextArea richTextArea = new RichTextArea ();
325336 delayTestFinish (RICH_TEXT_ASYNC_DELAY );
@@ -344,7 +355,6 @@ public void run() {
344355 * Test that a delayed set of safe html is reflected. Some platforms have
345356 * timing subtleties that need to be tested.
346357 */
347- @ DoNotRunWith (Platform .HtmlUnitUnknown )
348358 public void testSetSafeHtmlAfterInit () {
349359 final RichTextArea richTextArea = new RichTextArea ();
350360 delayTestFinish (RICH_TEXT_ASYNC_DELAY );
@@ -364,7 +374,6 @@ public void onInitialize(InitializeEvent event) {
364374 * the area loads. Some platforms have timing subtleties that need to be
365375 * tested.
366376 */
367- @ DoNotRunWith (Platform .HtmlUnitUnknown )
368377 public void testSetSafeHtmlBeforeInit () {
369378 final RichTextArea richTextArea = new RichTextArea ();
370379 delayTestFinish (RICH_TEXT_ASYNC_DELAY );
@@ -389,7 +398,6 @@ public void run() {
389398 * Test that delayed set of text is reflected. Some platforms have timing
390399 * subtleties that need to be tested.
391400 */
392- @ DoNotRunWith (Platform .HtmlUnitUnknown )
393401 public void testSetTextAfterInit () {
394402 final RichTextArea richTextArea = new RichTextArea ();
395403 delayTestFinish (RICH_TEXT_ASYNC_DELAY );
@@ -408,7 +416,6 @@ public void onInitialize(InitializeEvent event) {
408416 * Test that an immediate set of text is reflected immediately and after the
409417 * area loads. Some platforms have timing subtleties that need to be tested.
410418 */
411- @ DoNotRunWith (Platform .HtmlUnitUnknown )
412419 public void testSetTextBeforeInit () {
413420 final RichTextArea richTextArea = new RichTextArea ();
414421 richTextArea .setText ("foo" );
0 commit comments