From c47022e569fd32dd1ebbb131339c4562c36aa14c Mon Sep 17 00:00:00 2001 From: Sune Simonsen Date: Wed, 26 Dec 2018 23:30:03 +0100 Subject: [PATCH] Fixed use of deprecated to satisfy function --- src/index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 894ca2af..547187bf 100644 --- a/src/index.js +++ b/src/index.js @@ -707,7 +707,7 @@ module.exports = { ' to only have (class|classes) ', (expect, subject, value) => expect(subject, 'to have attributes', { - class: className => { + class: expect.it(className => { const actualClasses = getClassNamesFromAttributeValue(className); if (typeof value === 'string') { value = getClassNamesFromAttributeValue(value); @@ -715,7 +715,7 @@ module.exports = { return bubbleError(() => expect(actualClasses.sort(), 'to equal', value.sort()) ); - } + }) }) ); @@ -1104,6 +1104,13 @@ module.exports = { expect(attrs.style, 'to satisfy', expectedStyleObj) ); } + } else if ( + expect.findTypeOf(expectedAttributeValue).is('expect.it') + ) { + expect.context.thisObject = subject; + return bubbleError(() => + expectedAttributeValue(attributeValue, expect.context) + ); } else { return bubbleError(() => expect(attributeValue, 'to satisfy', expectedAttributeValue)