Reviewers: metaweta,

Description:
there's a getComputedStyle test looking for 'first-char', which is not
a valid pseudo-element.  this changes it to ':first-letter', and also
adds a guard to skip the test on browsers that don't implement it
correctly (chrome/safari).

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

Affected files:
  M     build.xml
  M     tests/com/google/caja/plugin/domita_test_untrusted.html
  M     tests/com/google/caja/plugin/es53-test-domado-special-guest.html


Index: build.xml
===================================================================
--- build.xml   (revision 4788)
+++ build.xml   (working copy)
@@ -222,14 +222,14 @@
       <param name="runtests.shouldCache">false</param>
     </antcall>
     <antcall target="runtests">
-      <param name="test.filter">ES53BrowserTest</param>
+      <param name="test.filter">GeneralBrowserTest</param>
       <param name="runtests.shouldCache">false</param>
     </antcall>
   </target>

   <target name="brserve" description="Run just browser test server.">
     <antcall target="runtests">
-      <param name="test.filter">ES53BrowserTest</param>
+      <param name="test.filter">GeneralBrowserTest</param>
       <param name="caja.BrowserTestCase.startAndWait">true</param>
     </antcall>
   </target>
Index: tests/com/google/caja/plugin/domita_test_untrusted.html
===================================================================
--- tests/com/google/caja/plugin/domita_test_untrusted.html     (revision 4788)
+++ tests/com/google/caja/plugin/domita_test_untrusted.html     (working copy)
@@ -2402,13 +2402,16 @@
   var NO_RESULT = {};
   var pseudoElementsSupported = false;
   try {
-    var unused = window.getComputedStyle(fakie, 'first-char').display;
-    pseudoElementsSupported = true;
+    // safari/chrome do not return meaningful info for pseudo elements
+    // unless there's an explicit css rule for the pseudo-element
+    if (window.getComputedStyle(fakie, ':first-letter').display) {
+      pseudoElementsSupported = true;
+    }
   } catch (ex) {
     // Not supported on all browsers
   }
   if (pseudoElementsSupported) {
-    assertComputedStyle(fakie, 'first-char', 'display', 'inline');
+    assertComputedStyle(fakie, ':first-letter', 'display', 'inline');
   }
   assertComputedStyle(invisible, null, 'display', 'none');
   assertComputedStyle(invisible, null, 'float', 'left');
Index: tests/com/google/caja/plugin/es53-test-domado-special-guest.html
===================================================================
--- tests/com/google/caja/plugin/es53-test-domado-special-guest.html (revision 4788) +++ tests/com/google/caja/plugin/es53-test-domado-special-guest.html (working copy)
@@ -156,13 +156,16 @@
     var NO_RESULT = {};
     var pseudoElementsSupported = false;
     try {
-      var unused = window.getComputedStyle(fakie, 'first-char').display;
-      pseudoElementsSupported = true;
+      // safari/chrome do not return meaningful info for pseudo elements
+      // unless there's an explicit css rule for the pseudo-element
+      if (window.getComputedStyle(fakie, ':first-letter').display) {
+        pseudoElementsSupported = true;
+      }
     } catch (ex) {
       // Not supported on all browsers
     }
     if (pseudoElementsSupported) {
-      assertComputedStyle(fakie, 'first-char', 'display', 'inline');
+      assertComputedStyle(fakie, ':first-letter', 'display', 'inline');
     }
     assertComputedStyle(invisible, null, 'display', 'none');
     assertComputedStyle(invisible, null, 'float', 'left');


Reply via email to