diff --git a/js/jquery.mobile.fetchlinks.js b/js/jquery.mobile.fetchlinks.js
index 6fff520a..c80dcae4 100644
--- a/js/jquery.mobile.fetchlinks.js
+++ b/js/jquery.mobile.fetchlinks.js
@@ -65,12 +65,11 @@ $.widget( "mobile.fetchlink", $.mobile.widget, {
targetEl.filter( ':jqmData(role="listview")' ).length && targetEl.listview( "refresh" );
targetEl
- .trigger( "create" )
.removeClass('ui-loading-inline')
.height('auto');
-
- console.log("Plugin fired and completed");
+ responseEl.trigger( "create" );
+
}, 300);
});
}
@@ -93,7 +92,6 @@ $( document ).bind( "inlineLoader", function( e, ui ){
//auto self-init widgets
$( document ).bind( "pagecreate create", function( e ){
- console.log("Create called");
$( $.mobile.fetchlink.prototype.options.initSelector, e.target ).fetchlink();
});
diff --git a/tests/unit/fetchlink/ext-1.html b/tests/unit/fetchlink/ext-1.html
new file mode 100644
index 00000000..b5d27d7a
--- /dev/null
+++ b/tests/unit/fetchlink/ext-1.html
@@ -0,0 +1,17 @@
+
+
+
+
+
+ jQuery Mobile Event Test Suite
+
+
+
+
+ “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?”
+ Arthur Conan Doyle
+ Sherlock Holmes: The Sign of the Four
+
+
+
+
diff --git a/tests/unit/fetchlink/ext-2.html b/tests/unit/fetchlink/ext-2.html
new file mode 100644
index 00000000..9dfa2ac0
--- /dev/null
+++ b/tests/unit/fetchlink/ext-2.html
@@ -0,0 +1,17 @@
+
+
+
+
+
+ jQuery Mobile Event Test Suite
+
+
+
+
+ “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.”
+ Arthur Conan Doyle
+ Sherlock Holmes: A Study in Scarlet
+
+
+
+
diff --git a/tests/unit/fetchlink/ext-3.html b/tests/unit/fetchlink/ext-3.html
new file mode 100644
index 00000000..7f38b4a5
--- /dev/null
+++ b/tests/unit/fetchlink/ext-3.html
@@ -0,0 +1,43 @@
+
+
+
+
+
+ jQuery Mobile Event Test Suite
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Header
+
+
+
+
Quote 1
+
+
Flip switch:
+
+ Off
+ On
+
+
+
Slider:
+
+
+
+
+
Footer
+
+
+
+
+
diff --git a/tests/unit/fetchlink/fetchlink_core.js b/tests/unit/fetchlink/fetchlink_core.js
new file mode 100644
index 00000000..788432e2
--- /dev/null
+++ b/tests/unit/fetchlink/fetchlink_core.js
@@ -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);
\ No newline at end of file
diff --git a/tests/unit/fetchlink/index.html b/tests/unit/fetchlink/index.html
new file mode 100644
index 00000000..9397ddd6
--- /dev/null
+++ b/tests/unit/fetchlink/index.html
@@ -0,0 +1,52 @@
+
+
+
+
+
+ jQuery Mobile Event Test Suite
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+