-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
46 lines (32 loc) · 910 Bytes
/
test.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
41
42
43
44
45
46
var tape = require('tape')
var test = require('tape-css')(tape)
var domify = require('domify')
var hidden = require('./')
test('Returns true/false when an element is hidden/not', function(t) {
var el = domify('<div>eh wut wut</div>')
t.notOk(hidden(el))
el.style.display = 'none'
t.ok(hidden(el))
t.end()
})
test('Sets an element\'s hiddenness', function(t) {
var el = domify('<div>o hai</div>')
t.notOk(hidden(el))
hidden(el, true)
t.ok(hidden(el))
hidden(el, false)
t.notOk(hidden(el))
t.end()
})
test('Get original display property after hiding/showing an element', {
dom: document.createElement('div'),
styles: 'div { display: table; }',
}, function(t) {
var el = document.querySelector('div')
hidden(el, true)
t.ok(hidden(el))
hidden(el, false)
t.equal(getComputedStyle(el).getPropertyValue('display'), 'table')
t.notOk(hidden(el))
t.end()
})