Skip to content

Commit

Permalink
Test for issue #6
Browse files Browse the repository at this point in the history
  • Loading branch information
sustainablepace committed Jun 9, 2013
1 parent f45e1de commit 8f59cc6
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 24 deletions.
10 changes: 4 additions & 6 deletions tests/tests.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@
<script type="text/javascript" src="tests.js"></script>
</head>
<body>
<h1 id="qunit-header">Mobi Pick - QUnit Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<input id="mobipick" type="text" />
<div id="qunit"></div>
<div id="qunit-fixture">
<input id="mobipick" type="text" />
</div>
</body>
</html>

54 changes: 36 additions & 18 deletions tests/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,28 +471,46 @@ test( "Reinitialize", function() {
var date = p.mobipick("option", "date");
deepEqual( date, null);
});
test("Issue 6", function() {
var i = 0;
var button = $("<button></button>").text("Large button").css({
width: "1000px",
height: "1000px"
}).bind("tap", function() {
i++;
alert("!");
});
$("#qunit-tests").after(button);
$(window).scrollTop(10000);

this.$mp.mobipick().trigger( "tap" );
this.selectDatepickerItems();
this.$nextDay.trigger( "tap" );

deepEqual(i, 0);
});
test( "Pull 11", function() {
var p = this.$mp.mobipick().trigger( "tap" );
this.selectDatepickerItems();
this.$cancel.trigger( "tap" );

deepEqual( "", this.$mp.val() );
});

asyncTest( "issue 6", function() {
expect( 1 );
var p = this.$mp.mobipick(),
i = $( "<input type='text' />" ).css({
position: "absolute",
top: 0,
left: 0,
width: "10000px",
height: "10000px"
}),
self = this;
$("#qunit-tests").after( i );
i.on( "tap", function() {
ok( true );
});
$(window).scrollTop(5000);
window.setTimeout( function() {
p.trigger( "tap" );
self.selectDatepickerItems();
self.$set.trigger( "tap" );
}, 2000 );
window.setTimeout( function() {
p.trigger( "tap" );
}, 4000 );
window.setTimeout( function() {
self.selectDatepickerItems();
self.$set.trigger( "tap" );
}, 6000 );
window.setTimeout( function() {
i.remove();
start();
}, 10000 );
ok ( true );
});

0 comments on commit 8f59cc6

Please sign in to comment.