mirror of
https://github.com/chaijs/chai
synced 2024-11-15 00:07:11 +00:00
Merge pull request #405 from chaijs/deep-escape-doc-tweaks
Tweak documentation on `.deep` flag.
This commit is contained in:
commit
1abc3845e3
1 changed files with 6 additions and 4 deletions
|
@ -75,9 +75,11 @@ module.exports = function (chai, _) {
|
|||
* expect({ foo: { bar: { baz: 'quux' } } })
|
||||
* .to.have.deep.property('foo.bar.baz', 'quux');
|
||||
*
|
||||
* In the `property` assertion, setting `deep` flag may require
|
||||
* to escape dot and brackets, while that is a rare case.
|
||||
* See also the documentation of `.deep.property`.
|
||||
* `.deep.property` special characters can be escaped
|
||||
* by adding two slashes before the `.` or `[]`.
|
||||
*
|
||||
* var deepCss = { '.link': { '[target]': 42 }};
|
||||
* expect(deepCss).to.have.deep.property('\\.link.\\[target\\]', 42);
|
||||
*
|
||||
* @name deep
|
||||
* @api public
|
||||
|
@ -765,7 +767,7 @@ module.exports = function (chai, _) {
|
|||
* green: { tea: 'matcha' }
|
||||
* , teas: [ 'chai', 'matcha', { tea: 'konacha' } ]
|
||||
* };
|
||||
|
||||
*
|
||||
* expect(deepObj).to.have.deep.property('green.tea', 'matcha');
|
||||
* expect(deepObj).to.have.deep.property('teas[1]', 'matcha');
|
||||
* expect(deepObj).to.have.deep.property('teas[2].tea', 'konacha');
|
||||
|
|
Loading…
Reference in a new issue