Removed references to 'window'; using jasmine.getGlobal() instead in order to better support non-browser environments.

Better protection around access to console.
The global object is now pretty-printed as "<global>", not "<window>".
Tests are a little closer to passing in node.js.
This commit is contained in:
Lee Byrd & Christian Williams
2010-06-22 16:22:09 -07:00
parent e60f22a2e5
commit 01d842fdfd
10 changed files with 69 additions and 62 deletions

View File

@@ -20,7 +20,7 @@ describe("jasmine.Matchers", function() {
return spec.addMatcherResult.mostRecentCall.args[0];
}
it("toEqual with primitives, objects, dates, html nodes, etc.", function() {
it("toEqual with primitives, objects, dates, etc.", function() {
expect(match(true).toEqual(true)).toEqual(true);
expect(match({foo:'bar'}).toEqual(null)).toEqual(false);
@@ -40,11 +40,6 @@ describe("jasmine.Matchers", function() {
circularGraph.referenceToSelf = circularGraph;
expect((match(circularGraph).toEqual(circularGraph))).toEqual(true);
var nodeA = document.createElement('div');
var nodeB = document.createElement('div');
expect((match(nodeA).toEqual(nodeA))).toEqual(true);
expect((match(nodeA).toEqual(nodeB))).toEqual(false);
expect((match(new Date(2008, 1, 3, 15, 17, 19, 1234)).toEqual(new Date(2009, 1, 3, 15, 17, 19, 1234)))).toEqual(false);
expect((match(new Date(2008, 1, 3, 15, 17, 19, 1234)).toEqual(new Date(2008, 1, 3, 15, 17, 19, 1234)))).toEqual(true);
@@ -64,6 +59,13 @@ describe("jasmine.Matchers", function() {
expect((match(new Number('5')).toNotEqual(5))).toBe(false);
});
it("toEqual with DOM nodes", function() {
var nodeA = document.createElement('div');
var nodeB = document.createElement('div');
expect((match(nodeA).toEqual(nodeA))).toEqual(true);
expect((match(nodeA).toEqual(nodeB))).toEqual(false);
});
it("toEqual to build an Expectation Result", function() {
var actual = 'a';
var matcher = match(actual);