Skip to content

Commit

Permalink
Fixed use of deprecated to satisfy function
Browse files Browse the repository at this point in the history
  • Loading branch information
sunesimonsen committed Dec 26, 2018
1 parent 93789a0 commit c47022e
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 c47022e

Please sign in to comment.