-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.js
40 lines (28 loc) · 870 Bytes
/
tests.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
var tape = require( 'tape' )
var muty = require( './script.js' )
tape( 'Provides a valid options hash at `muty.options`', function( t ){
t.equal( typeof muty.options, 'object' )
t.end()
} )
tape( 'Consumes a valid options hash, a DOM element, and a callback function', function( t ){
t.doesNotThrow( function(){
muty( muty.options, document, function(){} )
} )
t.end()
} )
tape( 'Returns a MutationObserver', function( t ){
t.ok( muty( muty.options, document, function(){} ) instanceof MutationObserver )
t.end()
} )
tape( 'Provided default options, invokes callback after any DOM mutation', function( t ){
var called = false
muty( muty.options, document, function(){
called = true
} )
t.equals( called, false )
document.body.appendChild( document.createTextNode( '' ) )
setTimeout( function(){
t.equals( called, true )
t.end()
} )
} )