forked from niom/zelect
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.html
68 lines (65 loc) · 2.28 KB
/
test.html
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Mocha Tests</title>
<link rel="stylesheet" href="node_modules/mocha/mocha.css" />
<style>
#sut { z-index:2; background-color:white; border: 1px dashed #ccc; padding: 10px; position: fixed; min-width: 300px; right: 100px; top: 100px; border-radius: 16px; }
</style>
<script src="node_modules/jquery/dist/jquery.js"></script>
<script src="node_modules/lodash/lodash.js"></script>
<script src="node_modules/chai/chai.js"></script>
<script src="node_modules/mocha/mocha.js"></script>
<script src="zelect.js"></script>
<script>mocha.setup('bdd')</script>
<script src="test.js"></script>
</head>
<body>
<div id="sut"></div>
<div id="mocha"></div>
<script>
var assert = chai.assert
chai.assert.eq = chai.assert.equal
window.mochaPhantomJS ? mochaPhantomJS.run() : mocha.run()
function setup(templateId) {
var select = $('#templates').find('.'+templateId).clone()
select.attr('id', 'select')
$('#sut').html(select)
}
</script>
<div id="templates" style="display:none">
<select class="empty"></select>
<select class="with-two-options">
<option>First</option>
<option>Last</option>
</select>
<select class="with-several-options">
<option>This is first</option>
<option>I'm filterished out</option>
<option>Here is second</option>
<option>I be third</option>
<option>Isn't fifth</option>
</select>
<select class="with-two-options-with-values">
<option value="first">First</option>
<option value="second">Second</option>
</select>
<select class="with-disabled-options">
<option disabled>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
</select>
<select class="xss-payload">
<option>Evil option <script>throw new Error('XSS from option label')</script></option>
<option value="<script>throw new Error('XSS from option value')</script>">Evil value</option>
</select>
<select class="option-with-empty-string">
<option value="something">Has a value</option>
<option value="something-elese">Also has a value</option>
<option value="">Has empty string as value</option>
</select>
</div>
</body>
</html>