Browse Source
* add promise support to nextTick * remove test for non-existent nextTick console error * Update flow annotation for callback * Revert flow annotation for nextTick callbackdev
Chris Fritz
8 years ago
committed by
Evan You
4 changed files with 54 additions and 8 deletions
@ -0,0 +1,25 @@ |
|||
import { nextTick } from 'core/util/env' |
|||
|
|||
describe('nextTick', () => { |
|||
it('accepts a callback', done => { |
|||
nextTick(done) |
|||
}) |
|||
|
|||
it('returns undefined when passed a callback', () => { |
|||
expect(typeof nextTick(() => {})).toBe('undefined') |
|||
}) |
|||
|
|||
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() |
|||
}) |
|||
}) |
|||
} |
|||
}) |
Loading…
Reference in new issue