Revision: 5505
Author:   [email protected]
Date:     Wed Jul 24 16:47:46 2013
Log:      CSS parser tests for @keyframes rule
https://codereview.appspot.com/11795043

It looks like the existing CSS parser handles the keyframe syntax alright.

This change documents existing behaviour.

If we're OK with having the CSS parser call startRuleset and endRuleset to
match keyframes, then I can handle @keyframes purely with changes to
sanitizecss.js.

R=felix8a

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

Modified:
 /trunk/tests/com/google/caja/plugin/cssparser_test.js

=======================================
--- /trunk/tests/com/google/caja/plugin/cssparser_test.js Wed Jul 17 15:10:25 2013 +++ /trunk/tests/com/google/caja/plugin/cssparser_test.js Wed Jul 24 16:47:46 2013
@@ -309,3 +309,57 @@
   jsunit.pass();
 });

+jsunitRegister('testKeyframes', function testKeyframes() {
+  // Mixture of example 1 and example 2 from
+  // http://dev.w3.org/csswg/css-animations/
+  var input = [
+    'div {',
+    '  animation-name: diagonal-slide;',
+    '  animation-duration: 5s;',
+    '  animation-iteration-count: 10;',
+    '}',
+    '',
+    '@keyframes diagonal-slide {',
+    '',
+    '  from {',
+    '    left: 0;',
+    '    top: 0;',
+    '  }',
+    '',
+    '  50% {',
+    '    left: 55px;',
+    '  }',
+    '',
+    '  to {',
+    '    left: 100px;',
+    '    top: 100px;',
+    '  }',
+    '',
+    '}'].join('\n');
+  assertParsedCssStylesheet(
+    [
+      "startStylesheet",     [],
+        "startRuleset",      [["div"]],
+          "declaration",     ["animation-name", ["diagonal-slide"]],
+          "declaration",     ["animation-duration", ["5s"]],
+          "declaration",     ["animation-iteration-count", ["10"]],
+        "endRuleset",        [],
+        "startAtrule",       ["@keyframes", ["diagonal-slide"]],
+          "startBlock",      [],
+            "startRuleset",  [["from"]],  // Not really a ruleset.
+              "declaration", ["left", ["0"]],
+              "declaration", ["top", ["0"]],
+            "endRuleset",    [],
+            "startRuleset",  [["50%"]],   // Not really a ruleset.
+              "declaration", ["left", ["55px"]],
+            "endRuleset",    [],
+            "startRuleset",  [["to"]],    // Not really a ruleset.
+              "declaration", ["left", ["100px"]],
+              "declaration", ["top", ["100px"]],
+            "endRuleset",    [],
+          "endBlock",        [],
+        "endAtrule",         [],
+      "endStylesheet",       []
+    ],
+    input);
+});

--

--- You received this message because you are subscribed to the Google Groups "Google Caja Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to