Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

added large.html example

Tj Holowaychuk52c5a3eb15aa
diff --git a/test/browser/large.html b/test/browser/large.html
new file mode 100644
index 00000000..12c08b51
--- /dev/null
+++ b/test/browser/large.html
@@ -0,0 +1,29 @@
+<html>
+ <head>
+ <title>Mocha</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <link rel="stylesheet" href="style.css" />
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js" type="text/javascript"></script>
+ <script src="../../mocha.js"></script>
+ <script>mocha.setup('bdd')</script>
+ <script>
+ function assert(expr, msg) {
+ if (!expr) throw new Error(msg || 'failed');
+ }
+ </script>
+ <script src="large.js"></script>
+ <script>
+ onload = function(){
+ var runner = mocha.run();
+ runner.globals(['foo', 'bar', 'baz']);
+
+ runner.on('test end', function(test){
+ console.log(test.fullTitle());
+ });
+ };
+ </script>
+ </head>
+ <body>
+ <div id="mocha"></div>
+ </body>
+</html>
\ No newline at end of file
diff --git a/test/browser/large.js b/test/browser/large.js
new file mode 100644
index 00000000..2f5e4024
--- /dev/null
+++ b/test/browser/large.js
@@ -0,0 +1,22 @@
+
+var n = 30;
+while (n--) {
+ describe('Array', function(){
+ var arr;
+
+ beforeEach(function(){
+ arr = [1,2,3];
+ })
+
+ describe('#indexOf()', function(){
+ it('should return -1 when the value is not present', function(){
+ assert(-1 == arr.indexOf(5));
+ })
+
+ it('should return the correct index when the value is present', function(){
+ assert(0 == arr.indexOf(1));
+ assert(1 == arr.indexOf(2));
+ })
+ })
+ })
+}
\ No newline at end of file