Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add tabview benchmark test.

  • Loading branch information...
commit 357d5e479c9ef72ae158e0813d501910940d4225 1 parent f1a6289
@msweeney msweeney authored
View
34 src/tabview/tests/perf/tabview-benchmark.js
@@ -0,0 +1,34 @@
+YUI.add('tabview-benchmark', function (Y) {
+ var suite = Y.BenchmarkSuite = new Benchmark.Suite();
+
+ suite.add('new Y.TabView()', function() {
+ var tabview = new Y.TabView({
+ children: [{
+ label: 'foo',
+ content: '<p>foo content</p>'
+ }, {
+ label: 'bar',
+ content: '<p>bar content</p>'
+ }, {
+ label: 'baz',
+ content: '<p>baz content</p>'
+ }]
+ });
+ });
+
+ suite.add('new Y.TabView().destroy', function() {
+ var tabview = new Y.TabView({
+ children: [{
+ label: 'foo',
+ content: '<p>foo content</p>'
+ }, {
+ label: 'bar',
+ content: '<p>bar content</p>'
+ }, {
+ label: 'baz',
+ content: '<p>baz content</p>'
+ }]
+ }).destroy(true);
+ });
+
+}, '@VERSION@', {requires: ['tabview']});
View
62 src/tabview/tests/perf/tabview.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>Benchmarks</title>
+</head>
+<body class="yui3-skin-sam">
+
+<p><button id="start">Start Benchmarks</button></p>
+
+<div id="log"></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: {
+ 'tabview-benchmark': {
+ fullpath: 'tabview-benchmark.js',
+ requires: ['tabview']
+ },
+
+ '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('tabview-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>
Please sign in to comment.
Something went wrong with that request. Please try again.