Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/mocha-3.1.2/test/browser/array.spec.js')
-rw-r--r--tests/lib/mocha-3.1.2/test/browser/array.spec.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/lib/mocha-3.1.2/test/browser/array.spec.js b/tests/lib/mocha-3.1.2/test/browser/array.spec.js
new file mode 100644
index 0000000000..edf66ac458
--- /dev/null
+++ b/tests/lib/mocha-3.1.2/test/browser/array.spec.js
@@ -0,0 +1,39 @@
+'use strict';
+
+describe('Array', function () {
+ describe('#push()', function () {
+ it('should append a value', function () {
+ var arr = [];
+ arr.push('foo');
+ arr.push('bar');
+ arr.push('baz');
+ assert(arr[0] === 'foo'); // to test indentation
+ assert(arr[1] === 'bar');
+ assert(arr[2] === 'baz');
+ });
+
+ it('should return the length', function () {
+ var arr = [];
+ assert(arr.push('foo') === 1);
+ assert(arr.push('bar') === 2);
+ assert(arr.push('baz') === 3);
+ });
+ });
+});
+
+describe('Array', function () {
+ describe('#pop()', function () {
+ it('should remove and return the last value', function () {
+ var arr = [1, 2, 3];
+ assert(arr.pop() === 3);
+ assert(arr.pop() === 2);
+ assert(arr.pop() === -1);
+ });
+
+ it('should adjust .length', function () {
+ var arr = [1, 2, 3];
+ arr.pop();
+ assert(arr.length === 2);
+ });
+ });
+});