@@ -47,6 +47,49 @@ test( "jQuery(html) loose rules", function() {
47
47
}
48
48
} ) ;
49
49
50
+ test ( "selector state" , function ( ) {
51
+ expect ( 18 ) ;
52
+
53
+ var test ;
54
+
55
+ test = jQuery ( undefined ) ;
56
+ equal ( test . selector , "" , "Empty jQuery Selector" ) ;
57
+ equal ( test . context , undefined , "Empty jQuery Context" ) ;
58
+
59
+ test = jQuery ( document ) ;
60
+ equal ( test . selector , "" , "Document Selector" ) ;
61
+ equal ( test . context , document , "Document Context" ) ;
62
+
63
+ test = jQuery ( document . body ) ;
64
+ equal ( test . selector , "" , "Body Selector" ) ;
65
+ equal ( test . context , document . body , "Body Context" ) ;
66
+
67
+ test = jQuery ( "#qunit-fixture" ) ;
68
+ equal ( test . selector , "#qunit-fixture" , "#qunit-fixture Selector" ) ;
69
+ equal ( test . context , document , "#qunit-fixture Context" ) ;
70
+
71
+ test = jQuery ( "#notfoundnono" ) ;
72
+ equal ( test . selector , "#notfoundnono" , "#notfoundnono Selector" ) ;
73
+ equal ( test . context , document , "#notfoundnono Context" ) ;
74
+
75
+ test = jQuery ( "#qunit-fixture" , document ) ;
76
+ equal ( test . selector , "#qunit-fixture" , "#qunit-fixture Selector" ) ;
77
+ equal ( test . context , document , "#qunit-fixture Context" ) ;
78
+
79
+ test = jQuery ( "#qunit-fixture" , document . body ) ;
80
+ equal ( test . selector , "#qunit-fixture" , "#qunit-fixture Selector" ) ;
81
+ equal ( test . context , document . body , "#qunit-fixture Context" ) ;
82
+
83
+ // Test cloning
84
+ test = jQuery ( test ) ;
85
+ equal ( test . selector , "#qunit-fixture" , "#qunit-fixture Selector" ) ;
86
+ equal ( test . context , document . body , "#qunit-fixture Context" ) ;
87
+
88
+ test = jQuery ( document . body ) . find ( "#qunit-fixture" ) ;
89
+ equal ( test . selector , "#qunit-fixture" , "#qunit-fixture find Selector" ) ;
90
+ equal ( test . context , document . body , "#qunit-fixture find Context" ) ;
91
+ } ) ;
92
+
50
93
test ( "XSS injection" , function ( ) {
51
94
expect ( 10 ) ;
52
95
0 commit comments