0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00
wagtail/client/tests/utils.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
817 B
JavaScript
Raw Normal View History

expect.extend({
toHaveSameBlockIdAs(received, otherChild) {
const { id: thisId } = received;
const { id: otherId } = otherChild;
if (thisId === undefined || thisId === null) {
return {
message: 'expected block id not to be null or undefined',
pass: false,
};
}
if (otherId === undefined || otherId === null) {
return {
message: 'expected other block id not to be null or undefined',
pass: false,
};
}
return thisId === otherId
? {
message: () =>
`expected block id '${thisId}' not to match other id '${otherId}'`,
pass: true,
}
: {
message: () =>
`expected block id '${thisId}' to match other id '${otherId}'`,
pass: false,
};
},
});