Skip to content

Commit

Permalink
Merge pull request #243 from unexpectedjs/ssimonsen/fix-use-of-deprec…
Browse files Browse the repository at this point in the history
…ated-to-satisfy-function

Fixed use of deprecated to satisfy function
  • Loading branch information
sunesimonsen authored Dec 26, 2018
2 parents 93789a0 + c47022e commit 8873052
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -707,15 +707,15 @@ module.exports = {
'<DOMElement> to only have (class|classes) <array|string>',
(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);
}
return bubbleError(() =>
expect(actualClasses.sort(), 'to equal', value.sort())
);
}
})
})
);

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 8873052

Please sign in to comment.