forked from glenjamin/skin-deep
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchai.js
26 lines (21 loc) · 770 Bytes
/
chai.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module.exports = function(chai, utils) {
var Assertion = chai.Assertion;
var flag = utils.flag;
function inRenderedOutput(query, msg) {
if (msg) flag(this, 'message', msg);
var renderer = flag(this, 'object');
var node = renderer.findNode(query);
this.assert(node,
'Expected to find #{exp} in #{act}',
'Expected not to find #{exp} in #{act}',
query, renderer
);
}
Assertion.addMethod('inRenderedOutput', inRenderedOutput);
chai.assert.inRenderedOutput = function(renderer, query, msg) {
new Assertion(renderer, msg).to.have.inRenderedOutput(query, msg);
};
chai.assert.notInRenderedOutput = function(renderer, query, msg) {
new Assertion(renderer, msg).to.not.have.inRenderedOutput(query, msg);
};
};