Skip to content

Commit 6ec5762

Browse files
docs: add example/tests.html to docs-next (#5325)
* docs: add example/tests.html to docs-next * Fixed linting complaint
1 parent 0d09939 commit 6ec5762

File tree

3 files changed

+96
-1
lines changed

3 files changed

+96
-1
lines changed

docs-next/public/example/Array.js

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
"use strict";
2+
3+
describe('Array', function () {
4+
describe('.push()', function () {
5+
it('should append a value', function () {
6+
var arr = [];
7+
arr.push('foo');
8+
arr.push('bar');
9+
expect(arr[0]).to.equal('foo');
10+
expect(arr[1]).to.equal('bar');
11+
})
12+
13+
it('should return the length', function () {
14+
var arr = [];
15+
var n = arr.push('foo');
16+
expect(n).to.equal(1);
17+
n = arr.push('bar');
18+
expect(n).to.equal(2);
19+
})
20+
21+
describe('with many arguments', function () {
22+
it('should add the values', function () {
23+
var arr = [];
24+
arr.push('foo', 'bar');
25+
expect(arr[0]).to.equal('foo');
26+
expect(arr[1]).to.equal('bar');
27+
})
28+
})
29+
})
30+
31+
describe('.unshift()', function () {
32+
it('should prepend a value', function () {
33+
var arr = [1, 2, 3];
34+
arr.unshift('foo');
35+
expect(arr[0]).to.equal('foo');
36+
expect(arr[1]).to.equal(1);
37+
})
38+
39+
it('should return the length', function () {
40+
var arr = [];
41+
var n = arr.unshift('foo');
42+
expect(n).to.equal(1);
43+
n = arr.unshift('bar');
44+
expect(n).to.equal(2);
45+
})
46+
47+
describe('with many arguments', function () {
48+
it('should add the values', function () {
49+
var arr = [];
50+
arr.unshift('foo', 'bar');
51+
expect(arr[0]).to.equal('foo');
52+
expect(arr[1]).to.equal('bar');
53+
})
54+
})
55+
})
56+
57+
describe('.pop()', function () {
58+
it('should remove and return the last value', function () {
59+
var arr = [1, 2, 3];
60+
expect(arr.pop()).to.equal(3);
61+
expect(arr.pop()).to.equal(2);
62+
expect(arr).to.have.length(1);
63+
})
64+
})
65+
66+
describe('.shift()', function () {
67+
it('should remove and return the first value', function () {
68+
var arr = [1, 2, 3];
69+
expect(arr.shift()).to.equal(1);
70+
expect(arr.shift()).to.equal(2);
71+
expect(arr).to.have.length(1);
72+
})
73+
})
74+
})
75+

docs-next/public/example/tests.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Mocha</title>
6+
<link rel="stylesheet" href="https://unpkg.com/mocha/mocha.css">
7+
<link rel="shortcut icon" href="../favicon.svg">
8+
</head>
9+
<body>
10+
<div id="mocha"></div>
11+
<script src="https://unpkg.com/mocha/mocha.js"></script>
12+
<script src="https://unpkg.com/chai@4.5.0/chai.js"></script>
13+
<script>mocha.setup('bdd')</script>
14+
<script>expect = chai.expect</script>
15+
<script src="Array.js"></script>
16+
<script>
17+
mocha.run();
18+
</script>
19+
</body>
20+
</html>

docs-next/src/content/docs/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ Become a [backer](https://opencollective.com/mochajs#support) and support Mocha
5252

5353
In addition to chatting with us on [our Discord](https://discord.gg/KeDn2uXhER), for additional information such as using
5454
spies, mocking, and shared behaviours be sure to check out the [Mocha Wiki](https://github.com/mochajs/mocha/wiki) on GitHub.
55-
For a running example of Mocha, view [example/tests.html](https://mochajs.org/example/tests.html).
55+
For a running example of Mocha, view [example/tests.html](example/tests.html).
5656

5757
For the JavaScript API, view the [API documentation](/api) or the [source](https://github.com/mochajs/mocha/blob/main/lib/mocha.js).

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy