Permalink
Browse files

Add transition benchmark test.

  • Loading branch information...
1 parent 4a51f73 commit f1a6289a6783c940ddb524ed6a87d36ff2fc9f4e @msweeney msweeney committed Apr 1, 2013
Showing with 90 additions and 0 deletions.
  1. +19 −0 src/transition/tests/perf/transition-benchmark.js
  2. +71 −0 src/transition/tests/perf/transition.html
@@ -0,0 +1,19 @@
+YUI.add('transition-benchmark', function (Y) {
+ var suite = Y.BenchmarkSuite = new Benchmark.Suite(),
+ testNode = Y.one('#demo');
+
+ suite.add('new Y.Transition()', function() {
+ new Y.Transition(demo, {
+ width: 0,
+ height: {
+ value: 0,
+ delay: 1
+ },
+ easing: 'ease-in',
+ duration: 500,
+ iterations: 10
+ })
+ });
+
+
+}, '@VERSION@', {requires: ['transition']});
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>Benchmarks</title>
+
+ <style>
+ #demo {
+ background: #ccc;
+ width: 100px;
+ height: 100px;
+ }
+ </style>
+</head>
+<body class="yui3-skin-sam">
+
+<p><button id="start">Start Benchmarks</button></p>
+
+<div id="log"></div>
+<div id="demo"></div>
+<applet code="nano" archive="https://github.com/bestiejs/benchmark.js/raw/v1.0.0/nano.jar" style="display: none;"></applet>
+<script src="http://pieisgood.org/misc/benchmark/benchmark.js"></script>
+
+<script src="../../../../build/yui/yui.js"></script>
+<script>
+var Y = YUI({
+ modules: {
+ 'transition-benchmark': {
+ fullpath: 'transition-benchmark.js',
+ requires: ['transition']
+ },
+
+ 'test-console': {
+ fullpath : '../../../common/tests/assets/test-console.js',
+ requires : ['console-filters'],
+ skinnable: true
+ },
+
+ 'skin-sam-test-console': {
+ fullpath: '../../../common/tests/assets/test-console.css',
+ type : 'css'
+ }
+ },
+
+ useBrowserConsole: false
+}).use('transition-benchmark', 'test-console', function (Y) {
+ var suite = Y.BenchmarkSuite,
+ start = Y.one('#start');
+
+ suite.on('start', function () {
+ start.set('disabled', true);
+ Y.log('Starting benchmarks.');
+ });
+
+ suite.on('cycle', function (bench) {
+ Y.log(String(bench));
+ });
+
+ suite.on('complete', function () {
+ start.set('disabled', false);
+ Y.log('Finished.');
+ });
+
+ start.on('click', function () {
+ suite.run(true);
+ });
+});
+</script>
+
+</body>
+</html>

0 comments on commit f1a6289

Please sign in to comment.