-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix IE8 compatibility for browser tests
- Avoid `Array.prototype.map` in test - Workaround for missing `Object.create` - Use a shim for `Date.prototype.toISOString` - Use simple number math instead of array indexing for interface tests - Use `expect` instead of `should` - Avoid builtin function in stringify test (A quick check revealed that stringify does not treat toString specially anyway, and IE8 ignores the toString assigned to the object, so use a different property name) - Use `karma-expect` for automatic browser tests - Remove `karma-should`
- Loading branch information
1 parent
a03ae0e
commit c962a51
Showing
20 changed files
with
217 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,32 @@ | ||
describe('Array', function(){ | ||
describe('#indexOf()', function(){ | ||
it('should return -1 when the value is not present', function(){ | ||
[1,2,3].indexOf(5).should.equal(-1); | ||
[1,2,3].indexOf(0).should.equal(-1); | ||
describe('integer primitives', function(){ | ||
describe('arithmetic', function(){ | ||
it('should add', function(){ | ||
expect(1 + 1).to.equal(2); | ||
expect(2 + 2).to.equal(4); | ||
}) | ||
|
||
it('should return the correct index when the value is present', function(){ | ||
[1,2,3].indexOf(1).should.equal(0); | ||
[1,2,3].indexOf(2).should.equal(1); | ||
[1,2,3].indexOf(3).should.equal(2); | ||
it('should subtract', function(){ | ||
expect(1 - 1).to.equal(0); | ||
expect(2 - 1).to.equal(1); | ||
}) | ||
}) | ||
}) | ||
|
||
describe('Array', function(){ | ||
describe('#pop()', function(){ | ||
it('should remove and return the last value', function(){ | ||
var arr = [1,2,3]; | ||
arr.pop().should.equal(3); | ||
arr.should.eql([1,2]); | ||
describe('integer primitives', function(){ | ||
describe('arithmetic is not', function(){ | ||
it('should add', function(){ | ||
expect(1 + 1).not.to.equal(3); | ||
expect(2 + 2).not.to.equal(5); | ||
}) | ||
}) | ||
}) | ||
|
||
context('Array', function(){ | ||
context('test suite', function(){ | ||
beforeEach(function(){ | ||
this.arr = [1,2,3]; | ||
this.number = 5; | ||
}) | ||
|
||
specify('has a length property', function(){ | ||
this.arr.length.should.equal(3); | ||
specify('share a property', function(){ | ||
expect(this.number).to.equal(5); | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
describe('should only run .only test in this bdd suite', function() { | ||
it('should not run this test', function() { | ||
var zero = 0; | ||
zero.should.equal(1, 'this test should have been skipped'); | ||
expect(zero).to.equal(1, 'this test should have been skipped'); | ||
}); | ||
it.only('should run this test', function() { | ||
var zero = 0; | ||
zero.should.equal(0, 'this .only test should run'); | ||
expect(zero).to.equal(0, 'this .only test should run'); | ||
}); | ||
it('should run this test, not (includes the title of the .only test)', function() { | ||
var zero = 0; | ||
zero.should.equal(1, 'this test should have been skipped'); | ||
expect(zero).to.equal(1, 'this test should have been skipped'); | ||
}); | ||
}); |
Oops, something went wrong.