Reviewers: ihab.awad,

Description:
1. domita has methods for focus() and blur(), but doesn't
make blur() callable.  This change makes blur() callable.

2. DomitaTest didn't clean up after a test failure.
A test failure would make subsequent tests fail to start.
This change adds cleanup.

Please review this at http://codereview.appspot.com/92041

Affected files:
  M     src/com/google/caja/plugin/domita.js
  M     tests/com/google/caja/plugin/DomitaTest.java
  M     tests/com/google/caja/plugin/domita_test_untrusted.html


Index: tests/com/google/caja/plugin/domita_test_untrusted.html
===================================================================
--- tests/com/google/caja/plugin/domita_test_untrusted.html     (revision 3549)
+++ tests/com/google/caja/plugin/domita_test_untrusted.html     (working copy)
@@ -291,6 +291,10 @@
   Test anchor computed styles don't leak history
 </p>

+<p class="testcontainer" id="test-focus-blur"
+ ><input id="test-focus-blur-1">
+</p>
+
 <p class="testcontainer" id="test-document-body-appendChild"
>I should be the last element until something is appended to document.body</p>

@@ -2275,6 +2279,14 @@
   pass('test-document-body-appendChild');
 });

+jsunitRegister('testFocusBlur',
+               function testFocusBlur() {
+  var input = document.getElementById('test-focus-blur-1');
+  input.focus();
+  input.blur();
+  pass('test-focus-blur');
+});
+
 // Before onload events fire
 jsunitRun();
 </script>
Index: tests/com/google/caja/plugin/DomitaTest.java
===================================================================
--- tests/com/google/caja/plugin/DomitaTest.java        (revision 3554)
+++ tests/com/google/caja/plugin/DomitaTest.java        (working copy)
@@ -83,7 +83,14 @@
    */
   public void runPage(String pageName) {
     StartLocalServer();
+    try {
+      runPage_1(pageName);
+    } finally {
+      StopLocalServer();
+    }
+  }

+  void runPage_1(String pageName) {
     //System.setProperty("webdriver.firefox.bin", "/usr/bin/firefox");
     WebDriver driver = new FirefoxDriver();

@@ -114,8 +121,5 @@
     String title = driver.getTitle();
assertTrue("The title shows " + title.substring(title.lastIndexOf("-") + 1),
         title.endsWith("all tests passed"));
-
-    //driver.quit();
-    StopLocalServer();
   }
 }
Index: src/com/google/caja/plugin/domita.js
===================================================================
--- src/com/google/caja/plugin/domita.js        (revision 3549)
+++ src/com/google/caja/plugin/domita.js        (working copy)
@@ -2527,7 +2527,8 @@
     };
     ___.ctor(TameInputElement, TameElement, 'TameInputElement');
     ___.all2(___.grantTypedGeneric, TameInputElement.prototype,
- ['getValue', 'setValue', 'focus', 'getForm', 'getType', 'select']);
+             ['getValue', 'setValue', 'focus', 'blur',
+              'getForm', 'getType', 'select']);


     function TameImageElement(node, editable) {


Reply via email to