Revision: 4793
Author:   [email protected]
Date:     Tue Feb 28 15:45:33 2012
Log:      fix getComputedStyle pseudo-element test
http://codereview.appspot.com/5697074

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).

[email protected]

http://code.google.com/p/google-caja/source/detail?r=4793

Modified:
 /trunk/build.xml
 /trunk/tests/com/google/caja/plugin/es53-test-domado-special-guest.html

=======================================
--- /trunk/build.xml    Thu Feb 23 10:25:04 2012
+++ /trunk/build.xml    Tue Feb 28 15:45:33 2012
@@ -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>
=======================================
--- /trunk/tests/com/google/caja/plugin/es53-test-domado-special-guest.html Mon Feb 27 16:13:13 2012 +++ /trunk/tests/com/google/caja/plugin/es53-test-domado-special-guest.html Tue Feb 28 15:45:33 2012
@@ -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