fixed javascript syntax errors in README
This commit is contained in:
parent
1b1c2b1998
commit
706b180a2c
|
@ -261,11 +261,11 @@ A suite can have a beforeEach declaration. It takes a function that is run befor
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
suiteWideFoo = 1;
|
suiteWideFoo = 1;
|
||||||
}
|
});
|
||||||
|
|
||||||
it('should equal bar', function () {
|
it('should equal bar', function () {
|
||||||
expect(suiteWideFoo).toEqual(1);
|
expect(suiteWideFoo).toEqual(1);
|
||||||
};
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
A runner can also have beforeEach declarations. Runner beforeEach functions are executed before every spec in all suites, and execute BEFORE suite beforeEach functions. For example:
|
A runner can also have beforeEach declarations. Runner beforeEach functions are executed before every spec in all suites, and execute BEFORE suite beforeEach functions. For example:
|
||||||
|
@ -280,11 +280,11 @@ A runner can also have beforeEach declarations. Runner beforeEach functions are
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
runnerWideFoo.push('suite');
|
runnerWideFoo.push('suite');
|
||||||
}
|
});
|
||||||
|
|
||||||
it('should equal bar', function () {
|
it('should equal bar', function () {
|
||||||
expect(runnerWideFoo).toEqual(['runner', 'suite']);
|
expect(runnerWideFoo).toEqual(['runner', 'suite']);
|
||||||
};
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
#### afterEach
|
#### afterEach
|
||||||
|
@ -296,11 +296,11 @@ Similarly, there is an afterEach declaration. It takes a function that is run a
|
||||||
var suiteWideFoo;
|
var suiteWideFoo;
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
suiteWideFoo = 0;
|
suiteWideFoo = 0;
|
||||||
}
|
});
|
||||||
|
|
||||||
it('should equal 1', function () {
|
it('should equal 1', function () {
|
||||||
expect(suiteWideFoo).toEqual(1);
|
expect(suiteWideFoo).toEqual(1);
|
||||||
};
|
});
|
||||||
|
|
||||||
it('should equal 0 after', function () {
|
it('should equal 0 after', function () {
|
||||||
expect(suiteWideFoo).toEqual(0);
|
expect(suiteWideFoo).toEqual(0);
|
||||||
|
@ -319,11 +319,11 @@ A runner can also have an afterEach declarations. Runner afterEach functions are
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
runnerWideFoo.push('suite');
|
runnerWideFoo.push('suite');
|
||||||
}
|
});
|
||||||
|
|
||||||
it('should be empty', function () {
|
it('should be empty', function () {
|
||||||
expect(runnerWideFoo).toEqual([]);
|
expect(runnerWideFoo).toEqual([]);
|
||||||
};
|
});
|
||||||
|
|
||||||
it('should be populated after', function () {
|
it('should be populated after', function () {
|
||||||
expect(runnerWideFoo).toEqual(['suite', 'runner']);
|
expect(runnerWideFoo).toEqual(['suite', 'runner']);
|
||||||
|
@ -350,14 +350,14 @@ Jasmine supports nested describes. An example:
|
||||||
it('nested expectation', function () {
|
it('nested expectation', function () {
|
||||||
expect(suiteWideFoo).toEqual(0);
|
expect(suiteWideFoo).toEqual(0);
|
||||||
expect(nestedSuiteBar).toEqual(1);
|
expect(nestedSuiteBar).toEqual(1);
|
||||||
};
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('top-level describe', function () {
|
it('top-level describe', function () {
|
||||||
expect(suiteWideFoo).toEqual(0);
|
expect(suiteWideFoo).toEqual(0);
|
||||||
expect(nestedSuiteBar).toEqual(undefined);
|
expect(nestedSuiteBar).toEqual(undefined);
|
||||||
};
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
### Spies
|
### Spies
|
||||||
|
@ -367,15 +367,15 @@ Jasmine integrates 'spies' that permit many spying, mocking, and faking behavior
|
||||||
Here are a few examples:
|
Here are a few examples:
|
||||||
|
|
||||||
var Klass = function () {
|
var Klass = function () {
|
||||||
}
|
};
|
||||||
|
|
||||||
var Klass.prototype.method = function (arg) {
|
var Klass.prototype.method = function (arg) {
|
||||||
return arg;
|
return arg;
|
||||||
}
|
};
|
||||||
|
|
||||||
var Klass.prototype.methodWithCallback = function (callback) {
|
var Klass.prototype.methodWithCallback = function (callback) {
|
||||||
return callback('foo');
|
return callback('foo');
|
||||||
}
|
};
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue