This repository has been archived by the owner on Jul 26, 2023. It is now read-only.
forked from jquery-archive/jquery-mobile
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First pass at (working) fetchlink unit tests.
- Loading branch information
Showing
6 changed files
with
192 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>jQuery Mobile Event Test Suite</title> | ||
</head> | ||
<body> | ||
|
||
<blockquote class="bq"> | ||
<p>“You will not apply my precept,” he said, shaking his head. “How often have I said to you that when you have eliminated the impossible, whatever remains, however improbable, must be the truth?”</p> | ||
<address>Arthur Conan Doyle</address> | ||
<cite>Sherlock Holmes: The Sign of the Four</cite> | ||
</blockquote> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>jQuery Mobile Event Test Suite</title> | ||
</head> | ||
<body> | ||
|
||
<blockquote class="bq"> | ||
<p>“What the deuce is it to me?” he interrupted impatiently; “you say that we go ’round the sun. If we went ’round the moon it would not make a pennyworth of difference to me or to my work.”</p> | ||
<address>Arthur Conan Doyle</address> | ||
<cite>Sherlock Holmes: A Study in Scarlet</cite> | ||
</blockquote> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>jQuery Mobile Event Test Suite</title> | ||
|
||
<script src="../../../js/jquery.js"></script> | ||
<script src="../jquery.setNameSpace.js"></script> | ||
<script src="../../../js/"></script> | ||
<script src="../../jquery.testHelper.js"></script> | ||
<link rel="stylesheet" href="../../../css/themes/default/" /> | ||
<link rel="stylesheet" href="../../../external/qunit.css"/> | ||
<script src="../../../external/qunit.js"></script> | ||
|
||
</head> | ||
<body> | ||
|
||
<div data-nstest-role="page" id="fetchlink-remote-page"> | ||
<div data-nstest-role="header"> | ||
<h1>Header</h1> | ||
</div> | ||
<div data-nstest-role="content"> | ||
|
||
<a href="ext-4.html" class="foo" data-nstest-role="button">Quote 1</a> | ||
|
||
<label for="slider2">Flip switch:</label> | ||
<select name="slider2" id="slider2" data-nstest-role="slider"> | ||
<option value="off">Off</option> | ||
<option value="on">On</option> | ||
</select> | ||
|
||
<label for="test-slider">Slider:</label> | ||
<input type="range" name="test-slider" id="test-slider" value="0" min="0" max="100" /> | ||
|
||
</div> | ||
<div data-nstest-role="footer"> | ||
<h1>Footer</h1> | ||
</div> | ||
</div> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Fetchlink unit tests | ||
*/ | ||
|
||
(function($){ | ||
|
||
module( "Fetchlinks", { | ||
setup: function(){ | ||
// | ||
} | ||
}); | ||
|
||
asyncTest( "Clicking a fetchlink loads remote content.", function(){ | ||
var targetContents = $( '.loadinto' ).html(); | ||
|
||
$.testHelper.pageSequence([ | ||
function(){ | ||
$('.foo').trigger('click'); | ||
}, | ||
function(){ | ||
ok( targetContents !== $( '.loadinto' ).html() ); | ||
start(); | ||
} | ||
]); | ||
}); | ||
|
||
asyncTest( "Clicking a fetchlink replaces previously loaded content with remote content.", function(){ | ||
var targetContents = $( '.loadinto' ).html(); | ||
|
||
$.testHelper.pageSequence([ | ||
function(){ | ||
$('.bar').trigger('click'); | ||
}, | ||
function(){ | ||
ok( targetContents !== $( '.loadinto' ).html() ); | ||
start(); | ||
} | ||
]); | ||
}); | ||
|
||
asyncTest( "Elements are properly enhanced after being fetched.", function(){ | ||
$.testHelper.pageSequence([ | ||
function(){ | ||
$('.baz').trigger('click'); | ||
}, | ||
function(){ | ||
ok( $('[data-nstest-role="header"]').hasClass( 'ui-header' ), "Page header is enhanced." ); | ||
ok( $('[data-nstest-role="content"]').hasClass( 'ui-content' ), "Page content is enhanced." ); | ||
ok( $('[data-nstest-role="footer"]').hasClass( 'ui-footer' ), "Page footer is enhanced." ); | ||
ok( $('[data-nstest-role="button"]').hasClass( 'ui-btn' ), "A link with a role of “button” is enhanced." ); | ||
ok( $('[data-nstest-role="slider"]').hasClass( 'ui-slider-switch' ), "Toggles are enhanced." ); | ||
ok( $('#test-slider').hasClass( 'ui-slider-input' ), "Slider widgets are enhanced." ); | ||
|
||
start(); | ||
} | ||
]); | ||
}); | ||
|
||
|
||
|
||
})(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>jQuery Mobile Event Test Suite</title> | ||
|
||
<script src="../../../js/jquery.js"></script> | ||
<script src="../jquery.setNameSpace.js"></script> | ||
<script src="../../../js/"></script> | ||
<script src="../../jquery.testHelper.js"></script> | ||
<link rel="stylesheet" href="../../../css/themes/default/" /> | ||
<link rel="stylesheet" href="../../../external/qunit.css"/> | ||
<script src="../../../external/qunit.js"></script> | ||
|
||
<script src="fetchlink_core.js"></script> | ||
|
||
<script src="../swarminject.js"></script> | ||
|
||
</head> | ||
<body> | ||
|
||
<h1 id="qunit-header">jQuery Mobile Event Test Suite</h1> | ||
<h2 id="qunit-banner"></h2> | ||
<h2 id="qunit-userAgent"></h2> | ||
<ol id="qunit-tests"> | ||
</ol> | ||
|
||
<div id="qunit-fixture"></div> | ||
|
||
<div data-nstest-role="page" id="fetchlink-test1"> | ||
|
||
<div data-nstest-role="content"> | ||
<ul data-nstest-target=".loadinto" data-nstest-fragment=".bq"> | ||
<li><a href="ext-1.html" class="foo">Quote 1</a></li> | ||
<li><a href="ext-2.html" class="bar">Quote 2</a></li> | ||
</ul> | ||
|
||
<a href="ext-3.html" class="baz" data-nstest-target=".loadinto">External Page</a> | ||
|
||
<div class="loadinto"> | ||
|
||
</div> | ||
|
||
</div> | ||
|
||
</div> | ||
|
||
|
||
|
||
</body> | ||
</html> |