X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fjquery%2FcoreTest.js;h=c20d4068d7dd690d924fa753b1f30e9b10c9fc52;hb=9791855ea91988e9ff02063e0c5ece759d8ba898;hp=6b73b0cf70d3847aa0a5307561a21b4ffed2f6f3;hpb=d4849a0d3589ea3d369137f79b102eb68403b489;p=jquery.git
diff --git a/src/jquery/coreTest.js b/src/jquery/coreTest.js
index 6b73b0c..c20d406 100644
--- a/src/jquery/coreTest.js
+++ b/src/jquery/coreTest.js
@@ -74,7 +74,7 @@ test("index(Object)", function() {
});
test("attr(String)", function() {
- expect(12);
+ expect(15);
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' );
@@ -87,6 +87,16 @@ test("attr(String)", function() {
ok( $('#name').attr('name') == "name", 'Check for name attribute' );
ok( $('#text1').attr('name') == "action", 'Check for name attribute' );
ok( $('#form').attr('action').indexOf("formaction") >= 0, 'Check for action attribute' );
+
+ $('').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();
+ });
});
test("attr(String, Function)", function() {
@@ -203,7 +213,7 @@ test("wrap(String|Element)", function() {
});
test("append(String|Element|Array<Element>|jQuery)", function() {
- expect(9);
+ expect(11);
var defaultText = 'Try them out:'
var result = $('#first').append('buga');
ok( result.text() == defaultText + 'buga', 'Check if text appending works' );
@@ -229,9 +239,18 @@ test("append(String|Element|Array<Element>|jQuery)", function() {
ok( $("#sap")[0].innerHTML.match( /5$/ ), "Check for appending a number" );
reset();
+ $("#sap").append( " text with spaces " );
+ ok( $("#sap")[0].innerHTML.match(/ text with spaces $/), "Check for appending text with spaces" );
+
+ reset();
ok( $("#sap").append([]), "Check for appending an empty array." );
ok( $("#sap").append(""), "Check for appending an empty string." );
ok( $("#sap").append(document.getElementsByTagName("foo")), "Check for appending an empty nodelist." );
+
+ reset();
+ $("#sap").append(document.getElementById('form'));
+ ok( $("#sap>form").size() == 1, "Check for appending a form" ); // Bug #910
+
});
test("appendTo(String|Element|Array<Element>|jQuery)", function() {
@@ -414,7 +433,7 @@ test("clone()", function() {
});
test("is(String)", function() {
- expect(22);
+ expect(26);
ok( $('#form').is('form'), 'Check for element: A form must be a form' );
ok( !$('#form').is('div'), 'Check for element: A form is not a div' );
ok( $('#mark').is('.blog'), 'Check for class: Expected class "blog"' );
@@ -437,6 +456,12 @@ test("is(String)", function() {
ok( !$('#foo').is(null), 'Expected false for an invalid expression - null' );
ok( !$('#foo').is(''), 'Expected false for an invalid expression - ""' );
ok( !$('#foo').is(undefined), 'Expected false for an invalid expression - undefined' );
+
+ // test is() with comma-seperated expressions
+ ok( $('#en').is('[@lang="en"],[@lang="de"]'), 'Check for lang attribute: Expecte en or de' );
+ ok( $('#en').is('[@lang="de"],[@lang="en"]'), 'Check for lang attribute: Expecte en or de' );
+ ok( $('#en').is('[@lang="en"] , [@lang="de"]'), 'Check for lang attribute: Expecte en or de' );
+ ok( $('#en').is('[@lang="de"] , [@lang="en"]'), 'Check for lang attribute: Expecte en or de' );
});
test("$.extend(Object, Object)", function() {
@@ -677,4 +702,4 @@ test("click() context", function() {
//console.log( close[0]); // it's the and not a element
return false;
}).click();
-});
\ No newline at end of file
+});