/
myapp.html
132 lines (122 loc) · 3.54 KB
/
myapp.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style>
#drag, #drop {
width:20px;
height:20px;
position:relative;
}
#drag {
border:1px solid green;
background-color:green;
left:0px;
top:0px;
}
#drop {
border:1px solid yellow;
background-color:yellow;
left:40px;
top:40px;
}
</style>
</head>
<body>
<h1>Hello World</h1>
<input id="typehere"/><input type='submit' value="Copy" id='copy'/>
<p id='seewhatyoutyped'></p>
<p id='seewhatyouchanged'></p>
<iframe src='myotherapp.html' name='a'></iframe>
<div id='clickToChange'>Change Thist Text</div>
<a href="javascript:changeText()" id='changelink'>Change</a>
<div id='drag'></div>
<div id='drop'></div>
<h3>hasClass</h3>
<div id='hasClass'>Click Me</div>
<h3>Exists</h3>
<div id='exists'>Click Me</div>
<h3>Trigger Custom Event</h3>
<div id='trigger'>Trigger Me</div>
<div id='confirm'>Confirm Me
<div class='result'></div>
</div>
<div id='rightclick'>Right Click Me</div>
<div class='rightclickResult'></div>
<div class='hidden' style='display:none;'></div>
<div id="testData"></div>
<script type='text/javascript' src='../../steal/steal.js'></script>
<script type='text/javascript'>
steal('funcunit/browser/resources/jquery.js')
.then('funcunit/test/jquery.event.drag.js')
.then( 'funcunit/test/jquery.event.drop.js', function(){
$('#testData').data('idval', 1000);
$("#rightclick").bind("contextmenu", function(){
$(".rightclickResult").text("Right Clicked")
})
// on key up, write the value
$("#typehere")
.keyup(function(){
$("#seewhatyoutyped").html("typed "+this.value)
})
.change(function(){
$("#seewhatyouchanged").html("changed "+this.value)
})
//when copy is clicked, change the text
$("#copy").click(function(){
//run slowwwww
var sum = 0, date = new Date();
for(var i =0; i< 10; i++){
$("*").each(function(){
$(this).width()
$(this).height()
})
}
$("#seewhatyoutyped").html("copied "+$("#typehere").val())
})
$('#clickToChange').click(function(){
setTimeout(function(){
$('#clickToChange').html("changed")
},300)
})
//has class
$("#hasClass").click(function(){
setTimeout(function(){
$("#hasClass").addClass('someClass')
},200)
})
//exists
$("#exists").click(function(){
setTimeout(function(){
$("#exists").append("<p>I exist</p>")
},200)
})
$('#trigger').bind('myCustomEvent', function(){
$("#trigger").append("<p>I was triggered</p>")
})
//confirm
$('#confirm').bind('click', function(){
if(confirm("are you sure?")){
$("#confirm .result").html("<p>I was confirmed</p>")
} else {
$("#confirm .result").html("<p>I was not confirmed</p>")
}
})
window.changeText = function(){
$('#changelink').text('Changed')
}
$('#drag').live("draginit", function(){})
.live("dragover", function(){
$(this).css('background-color', 'black').addClass("dragover")
})
$('#drop').live("dropover", function(){
$(this).css('background-color', 'blue').addClass("dropover")
})
$('#drop').live("dropout", function(){
$(this).css('background-color', 'green').addClass("dropout")
})
})
</script>
</body>
</html>