From dc5bb480b792b35345ebf248a5e930a6709c6bf9 Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Fri, 20 Mar 2015 09:26:14 +0000 Subject: [PATCH] Tweak documentation on `.deep` flag. --- lib/chai/core/assertions.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/chai/core/assertions.js b/lib/chai/core/assertions.js index 9055355..ac83883 100644 --- a/lib/chai/core/assertions.js +++ b/lib/chai/core/assertions.js @@ -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');