diff --git a/support/browser-entry.js b/support/browser-entry.js
index 8fe9f7828f..c9736d94e3 100644
--- a/support/browser-entry.js
+++ b/support/browser-entry.js
@@ -119,6 +119,9 @@ mocha.ui = function(ui){
mocha.setup = function(opts){
if ('string' == typeof opts) opts = { ui: opts };
+ if ('delay' in opts) {
+ this.delay(opts.delay);
+ }
for (var opt in opts) this[opt](opts[opt]);
return this;
};
diff --git a/test/browser/delay.html b/test/browser/delay.html
new file mode 100644
index 0000000000..959a135d52
--- /dev/null
+++ b/test/browser/delay.html
@@ -0,0 +1,29 @@
+
+
+ Mocha
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/browser/delay.js b/test/browser/delay.js
new file mode 100644
index 0000000000..1736319c11
--- /dev/null
+++ b/test/browser/delay.js
@@ -0,0 +1,25 @@
+var delay = 500;
+var start = new Date().getTime();
+
+describe('delayed execution', function() {
+ it('should define a global run function', function() {
+ assert(typeof run === 'function', 'run function is not defined');
+ });
+ it('should have waited ' + delay + 'ms to run this suite', function() {
+ assert(new Date().getTime() - delay >= start, 'did not delay');
+ });
+});
+
+setTimeout(function() {
+ describe('delayed execution', function() {
+ it('should be able to define a suite asynchronously', function() {
+ assert(true);
+ });
+ });
+
+ if (typeof run === 'function') {
+ run();
+ } else {
+ mocha.suite.run();
+ }
+}, delay);
\ No newline at end of file