forked from glenjamin/skin-deep
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chai plugin buried for now
- Loading branch information
Showing
3 changed files
with
40 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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); | ||
}; | ||
}; |
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