forked from bitovi/jquerypp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselection_test.js
More file actions
39 lines (32 loc) · 875 Bytes
/
selection_test.js
File metadata and controls
39 lines (32 loc) · 875 Bytes
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
steal("funcunit/qunit", "jquerypp/dom/selection").then(function(){
module("jquerypp/dom/selection");
test("getCharElement", function(){
$("#qunit-test-area")
.html("<textarea>012\n456</textarea>"+
"<input text='text' value='01234567' id='inp'/>"+
"<p id='1'>0123456789</p>"+
"<div id='2'>012<div>3<span>4</span>5</div></div>");
stop();
setTimeout(function(){
var types = ['textarea','#inp','#1','#2'];
for(var i =0; i< types.length; i++){
console.log(types[i])
$(types[i]).selection(1,5);
}
/*
$('textarea').selection(1,5);
$('input').selection(1,5);
$('#1').selection(1,5);
$('#2').selection(1,5);
*/
var res = [];
for(var i =0; i< types.length; i++){
res.push( $(types[i]).selection() );
}
for(var i =0; i< res.length; i++){
same(res[i],{start: 1, end: 5},types[i])
}
start();
},1000)
});
});