-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
51 lines (42 loc) · 1.09 KB
/
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
47
48
49
50
51
var test = require('tst');
var place = require('./');
var ipsum = require('lorem-ipsum');
document.body.innerHTML = `${ipsum({count: 15, units: 'paragraph', format: 'html'})}`;
test('centered in window', function () {
var el = document.createElement('div');
el.style.position = 'absolute';
el.style.width = '100px';
el.style.height = '100px';
el.style.border = '1px solid gray';
el.innerHTML = 'content';
place(el, {
target: window,
side: 'center',
align: 'center'
});
});
test('restricted by window', function () {
var el = document.createElement('div');
el.style.position = 'absolute';
el.style.width = '100px';
el.style.height = '100px';
el.style.border = '1px solid gray';
el.innerHTML = 'content';
el.style.background = 'white';
place(el, {
side: 'center',
align: 'center',
within: window
});
});
test('autoside', function () {
var el = document.createElement('div');
el.style.position = 'absolute';
el.style.width = '100px';
el.style.height = '100px';
el.style.border = '1px solid gray';
el.innerHTML = 'autoside';
el.style.background = 'white';
place(el, {
});
});