Files
jasmine/spec/html/MatchersHtmlSpec.js
Gregg Van Hove 79206ccff5 Rename j$ to jasmineUnderTest for specs
- Clarifies what it is for when writing tests
- No longer named the same as the `jasmine` that is injected into live
  code
2015-12-03 17:23:32 -08:00

38 lines
875 B
JavaScript

describe("MatchersSpec - HTML Dependent", function () {
var env, spec;
beforeEach(function() {
env = new jasmineUnderTest.Env();
var suite = env.describe("suite", function() {
spec = env.it("spec", function() {
});
});
spyOn(spec, 'addExpectationResult');
addMatchers({
toPass: function() {
return lastResult().passed;
},
toFail: function() {
return !lastResult().passed;
}
});
});
function match(value) {
return spec.expect(value);
}
function lastResult() {
return spec.addExpectationResult.mostRecentCall.args[1];
}
xit("toEqual with DOM nodes", function() {
var nodeA = document.createElement('div');
var nodeB = document.createElement('div');
expect((match(nodeA).toEqual(nodeA))).toPass();
expect((match(nodeA).toEqual(nodeB))).toFail();
});
});