Add a magic pseudoclass to body, instead of appending a magic div. Selenium seems...
authorTom Clegg <tom@curoverse.com>
Fri, 9 Jan 2015 22:46:15 +0000 (17:46 -0500)
committerTom Clegg <tom@curoverse.com>
Fri, 9 Jan 2015 22:46:15 +0000 (17:46 -0500)
apps/workbench/test/integration_helper.rb

index 1a6a4f054ac68782d4a8314f215678edd2e3efa1..cb07725350c99748efc8bb86cae47fc1c98b3dcf 100644 (file)
@@ -29,15 +29,15 @@ module AssertDomEvent
   # Yield the supplied block, then wait for an event to arrive at a
   # DOM element.
   def assert_triggers_dom_event events, target='body'
-    magic = 'RXC0lObcVwEXwSvA-' + rand(2**20).to_s(36)
+    magic = 'received-dom-event-' + rand(2**30).to_s(36)
     page.evaluate_script <<eos
       $('#{target}').one('#{events}', function() {
-        $('body').append('<div id="#{magic}"></div>');
+        $('body').addClass('#{magic}');
       });
 eos
     yield
-    assert_selector "##{magic}"
-    page.evaluate_script "$('##{magic}').remove();";
+    assert_selector "body.#{magic}"
+    page.evaluate_script "$('body').removeClass('#{magic}');";
   end
 end