From 6d03f9290eb7b3f51b18413acdbd61d856749174 Mon Sep 17 00:00:00 2001 From: John Resig Date: Sat, 24 Mar 2007 02:07:37 +0000 Subject: [PATCH] An Ajax-based test was being run locally (which doesn't work). --- src/jquery/coreTest.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/jquery/coreTest.js b/src/jquery/coreTest.js index 5c982ee2..ab47c463 100644 --- a/src/jquery/coreTest.js +++ b/src/jquery/coreTest.js @@ -159,7 +159,7 @@ test("index(Object)", function() { }); test("attr(String)", function() { - expect(15); + expect(13); ok( $('#text1').attr('value') == "Test", 'Check for value attribute' ); ok( $('#text1').attr('type') == "text", 'Check for type attribute' ); ok( $('#radio1').attr('type') == "radio", 'Check for type attribute' ); @@ -175,15 +175,20 @@ test("attr(String)", function() { $('').attr('href', '#5').appendTo('#main'); // using innerHTML in IE causes href attribute to be serialized to the full path ok( $('#tAnchor5').attr('href') == "#5", 'Check for non-absolute href (an anchor)' ); - - stop(); - $.get("data/dashboard.xml", function(xml) { - ok( $("locations", xml).attr("class") == "foo", "Check class attribute in XML document" ); - ok( $("location", xml).attr("for") == "bar", "Check for attribute in XML document" ); - start(); - }); }); +if ( location.protocol != "file:" ) { + test("attr(String) in XML Files", function() { + expect(2); + stop(); + $.get("data/dashboard.xml", function(xml) { + ok( $("locations", xml).attr("class") == "foo", "Check class attribute in XML document" ); + ok( $("location", xml).attr("for") == "bar", "Check for attribute in XML document" ); + start(); + }); + }); +} + test("attr(String, Function)", function() { expect(2); ok( $('#text1').attr('value', function() { return this.id })[0].value == "text1", "Set value from id" );