You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

34 lines
857 B

import { nextTick } from 'core/util/env'
describe('nextTick', () => {
it('accepts a callback', done => {
nextTick(done)
})
it('returns undefined when passed a callback', () => {
expect(nextTick(() => {})).toBeUndefined()
})
if (typeof Promise !== 'undefined') {
it('returns a Promise when provided no callback', done => {
nextTick().then(done)
})
it('returns a Promise with a context argument when provided a falsy callback and an object', done => {
const obj = {}
nextTick(undefined, obj).then(ctx => {
expect(ctx).toBe(obj)
done()
})
})
it('returned Promise should resolve correctly vs callback', done => {
const spy = jasmine.createSpy()
nextTick(spy)
nextTick().then(() => {
expect(spy).toHaveBeenCalled()
done()
})
})
}
})