mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
659242b457
Decaffeinate frontend GitOrigin-RevId: 1c8c53dedecfe55f9936a13408df17b852f996de
19 lines
645 B
JavaScript
19 lines
645 B
JavaScript
/* global chai */
|
|
|
|
/**
|
|
* Add chai assertion for comparing CodeMirror Pos objects.
|
|
* A deep comparison will fail because CodeMirror inserts additional properties
|
|
* that we want to ignore.
|
|
*/
|
|
chai.Assertion.addMethod('equalPos', function(expectedPos) {
|
|
const { line: actualLine, ch: actualCh } = this._obj
|
|
const { line: expectedLine, ch: expectedCh } = expectedPos
|
|
|
|
this.assert(
|
|
actualLine === expectedLine && actualCh === expectedCh,
|
|
`expected #{exp} to equal #{act}`,
|
|
`expected #{exp} to not equal #{act}`,
|
|
`Pos({ line: ${expectedLine}, ch: ${expectedCh} })`,
|
|
`Pos({ line: ${actualLine}, ch: ${actualCh} })`
|
|
)
|
|
})
|