export const pasteEventMock = (html) => ({
    type: 'paste',
    originalEvent: {
        clipboardData: {
            getData: () => html,
        },
    },
    preventDefault: () => {},
    stopPropagation: () => {},
})

export const waitUntil = (condition) => (done) => _waitUntil(condition, done)

function _waitUntil(condition, done) {
    if (condition()) done()
    else setTimeout(() => _waitUntil(condition, done), 200)
}

export function delay(done) {
    setTimeout(done, 0)
}

export function delayFor(ms) {
    return (done) => setTimeout(done, ms)
}

export function isOutsideViewPort($elem) {
    return $elem.length > 0 && $elem.position().top < 0
}

export const pasteEventMock = (html) => ({
    type: 'paste',
    originalEvent: {
        clipboardData: {
            getData: () => html,
        },
    },
    preventDefault: () => {},
    stopPropagation: () => {},
})

export const waitUntil = (condition) => (done) => _waitUntil(condition, done)

function _waitUntil(condition, done) {
    if (condition()) done()
    else setTimeout(() => _waitUntil(condition, done), 200)
}

export function delay(done) {
    setTimeout(done, 16)
}

export function delayFor(ms) {
    return (done) => setTimeout(done, ms)
}

export function isOutsideViewPort($elem) {
    return $elem.length > 0 && $elem.position().top < 0
}

Increase the cargo-cult test timeout to 16 milliseconds
Increase the cargo-cult test timeout to 16 milliseconds

This seems to work better, at least on my machine. We'll have to figure
out a real solution at some point, though.
