lady_josephine 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (304) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +32 -0
  4. data/app/assets/fonts/lady_josephine/icons/icons.eot +0 -0
  5. data/app/assets/fonts/lady_josephine/icons/icons.svg +215 -0
  6. data/app/assets/fonts/lady_josephine/icons/icons.ttf +0 -0
  7. data/app/assets/fonts/lady_josephine/icons/icons.woff +0 -0
  8. data/app/assets/javascripts/lady_josephine/blocks/facebook.js +25 -0
  9. data/app/assets/javascripts/lady_josephine/blocks/instagram.js +22 -0
  10. data/app/assets/javascripts/lady_josephine/blocks/soundcloud.js +24 -0
  11. data/app/assets/javascripts/lady_josephine/blocks/twitter.js +25 -0
  12. data/app/assets/javascripts/lady_josephine/blocks/vimeo.js +55 -0
  13. data/app/assets/javascripts/lady_josephine/blocks/youtube.js +64 -0
  14. data/app/assets/javascripts/lady_josephine/editor.js +40 -0
  15. data/app/assets/javascripts/lady_josephine/lady_josephine.js +4 -0
  16. data/app/assets/javascripts/lady_josephine/lady_josephine_view.js +6 -0
  17. data/app/assets/stylesheets/lady_josephine/content.sass +33 -0
  18. data/app/assets/stylesheets/lady_josephine/icons.sass +175 -0
  19. data/app/assets/stylesheets/lady_josephine/lady_josephine.sass +6 -0
  20. data/app/assets/stylesheets/lady_josephine/sir_trevor.sass +619 -0
  21. data/app/assets/stylesheets/lady_josephine/vars.sass +36 -0
  22. data/app/controllers/lady_josephine/application_controller.rb +4 -0
  23. data/app/controllers/lady_josephine/editor_controller.rb +40 -0
  24. data/app/controllers/lady_josephine/images_controller.rb +26 -0
  25. data/app/helpers/lady_josephine/helper.rb +25 -0
  26. data/app/helpers/lady_josephine/sir_trevor_helper.rb +172 -0
  27. data/app/models/lady_josephine/concerns/model.rb +29 -0
  28. data/app/models/lady_josephine/concerns/pingable.rb +28 -0
  29. data/app/models/lady_josephine/concerns/server_uuid.rb +24 -0
  30. data/app/models/lady_josephine/concerns/sir_trevor_images.rb +38 -0
  31. data/app/models/lady_josephine/image.rb +41 -0
  32. data/app/uploader/lady_josephine/base_uploader.rb +47 -0
  33. data/app/uploader/lady_josephine/image_uploader.rb +149 -0
  34. data/app/views/lady_josephine/blocks/_audio_block.haml +2 -0
  35. data/app/views/lady_josephine/blocks/_definition_block.haml +4 -0
  36. data/app/views/lady_josephine/blocks/_divider_block.haml +2 -0
  37. data/app/views/lady_josephine/blocks/_extended_image_block.haml +63 -0
  38. data/app/views/lady_josephine/blocks/_extended_quote_block.haml +5 -0
  39. data/app/views/lady_josephine/blocks/_extended_tweet_block.haml +2 -0
  40. data/app/views/lady_josephine/blocks/_facebook_post_block.haml +2 -0
  41. data/app/views/lady_josephine/blocks/_heading_block.haml +2 -0
  42. data/app/views/lady_josephine/blocks/_html_block.haml +1 -0
  43. data/app/views/lady_josephine/blocks/_instagram_block.haml +2 -0
  44. data/app/views/lady_josephine/blocks/_list_block.haml +3 -0
  45. data/app/views/lady_josephine/blocks/_quote_block.haml +5 -0
  46. data/app/views/lady_josephine/blocks/_text_block.html.haml +2 -0
  47. data/app/views/lady_josephine/blocks/_video_block.haml +9 -0
  48. data/config/routes.rb +9 -0
  49. data/db/migrate/20160222151500_lady_josephine_image.rb +18 -0
  50. data/lib/generators/lady_josephine_migration/USAGE +9 -0
  51. data/lib/generators/lady_josephine_migration/lady_josephine_migration_generator.rb +17 -0
  52. data/lib/generators/lady_josephine_migration/templates/migration.rb +9 -0
  53. data/lib/lady_josephine.rb +18 -0
  54. data/lib/lady_josephine/engine.rb +18 -0
  55. data/lib/lady_josephine/redcarpet/custom_markdown_formatter.rb +63 -0
  56. data/lib/lady_josephine/renderer/sir_trevor_renderer.rb +16 -0
  57. data/lib/lady_josephine/version.rb +3 -0
  58. data/lib/lady_josephine/whitelist.rb +26 -0
  59. data/lib/tasks/lady_josephine_tasks.rake +4 -0
  60. data/spec/controllers/lady_josephine/editor_controller_spec.rb +58 -0
  61. data/spec/dummy/README.rdoc +28 -0
  62. data/spec/dummy/Rakefile +6 -0
  63. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  64. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  65. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  66. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  67. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  68. data/spec/dummy/bin/bundle +3 -0
  69. data/spec/dummy/bin/rails +4 -0
  70. data/spec/dummy/bin/rake +4 -0
  71. data/spec/dummy/bin/setup +29 -0
  72. data/spec/dummy/config.ru +4 -0
  73. data/spec/dummy/config/application.rb +26 -0
  74. data/spec/dummy/config/boot.rb +5 -0
  75. data/spec/dummy/config/database.yml +25 -0
  76. data/spec/dummy/config/environment.rb +5 -0
  77. data/spec/dummy/config/environments/development.rb +41 -0
  78. data/spec/dummy/config/environments/production.rb +79 -0
  79. data/spec/dummy/config/environments/test.rb +42 -0
  80. data/spec/dummy/config/initializers/assets.rb +11 -0
  81. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  82. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  83. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  84. data/spec/dummy/config/initializers/inflections.rb +16 -0
  85. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  86. data/spec/dummy/config/initializers/session_store.rb +3 -0
  87. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  88. data/spec/dummy/config/locales/en.yml +23 -0
  89. data/spec/dummy/config/routes.rb +4 -0
  90. data/spec/dummy/config/secrets.yml +22 -0
  91. data/spec/dummy/db/development.sqlite3 +0 -0
  92. data/spec/dummy/db/schema.rb +16 -0
  93. data/spec/dummy/db/test.sqlite3 +0 -0
  94. data/spec/dummy/log/bla +0 -0
  95. data/spec/dummy/public/404.html +67 -0
  96. data/spec/dummy/public/422.html +67 -0
  97. data/spec/dummy/public/500.html +66 -0
  98. data/spec/dummy/public/favicon.ico +0 -0
  99. data/spec/spec_helper.rb +17 -0
  100. data/vendor/assets/components/Eventable/README.md +12 -0
  101. data/vendor/assets/components/Eventable/bower.json +10 -0
  102. data/vendor/assets/components/Eventable/component.json +11 -0
  103. data/vendor/assets/components/Eventable/eventable.js +207 -0
  104. data/vendor/assets/components/Eventable/package.json +15 -0
  105. data/vendor/assets/components/jquery-autosize/bower.json +30 -0
  106. data/vendor/assets/components/jquery-autosize/demo.html +36 -0
  107. data/vendor/assets/components/jquery-autosize/jquery.autosize.js +273 -0
  108. data/vendor/assets/components/jquery-autosize/jquery.autosize.min.js +6 -0
  109. data/vendor/assets/components/jquery-autosize/package.json +32 -0
  110. data/vendor/assets/components/jquery-autosize/readme.md +216 -0
  111. data/vendor/assets/components/jquery/AUTHORS.txt +163 -0
  112. data/vendor/assets/components/jquery/CONTRIBUTING.md +216 -0
  113. data/vendor/assets/components/jquery/Gruntfile.js +496 -0
  114. data/vendor/assets/components/jquery/MIT-LICENSE.txt +21 -0
  115. data/vendor/assets/components/jquery/README.md +415 -0
  116. data/vendor/assets/components/jquery/build/release-notes.js +59 -0
  117. data/vendor/assets/components/jquery/build/release.js +246 -0
  118. data/vendor/assets/components/jquery/component.json +13 -0
  119. data/vendor/assets/components/jquery/composer.json +35 -0
  120. data/vendor/assets/components/jquery/jquery-migrate.js +496 -0
  121. data/vendor/assets/components/jquery/jquery-migrate.min.js +3 -0
  122. data/vendor/assets/components/jquery/jquery.js +9597 -0
  123. data/vendor/assets/components/jquery/jquery.min.js +5 -0
  124. data/vendor/assets/components/jquery/jquery.min.map +1 -0
  125. data/vendor/assets/components/jquery/package.json +39 -0
  126. data/vendor/assets/components/jquery/speed/benchmark.js +15 -0
  127. data/vendor/assets/components/jquery/speed/benchmarker.css +65 -0
  128. data/vendor/assets/components/jquery/speed/benchmarker.js +181 -0
  129. data/vendor/assets/components/jquery/speed/closest.html +39 -0
  130. data/vendor/assets/components/jquery/speed/css.html +82 -0
  131. data/vendor/assets/components/jquery/speed/event.html +58 -0
  132. data/vendor/assets/components/jquery/speed/filter.html +183 -0
  133. data/vendor/assets/components/jquery/speed/find.html +179 -0
  134. data/vendor/assets/components/jquery/speed/index.html +72 -0
  135. data/vendor/assets/components/jquery/speed/jquery-basis.js +6238 -0
  136. data/vendor/assets/components/jquery/speed/slice.vs.concat.html +47 -0
  137. data/vendor/assets/components/jquery/src/ajax.js +851 -0
  138. data/vendor/assets/components/jquery/src/ajax/jsonp.js +80 -0
  139. data/vendor/assets/components/jquery/src/ajax/script.js +86 -0
  140. data/vendor/assets/components/jquery/src/ajax/xhr.js +207 -0
  141. data/vendor/assets/components/jquery/src/attributes.js +661 -0
  142. data/vendor/assets/components/jquery/src/callbacks.js +196 -0
  143. data/vendor/assets/components/jquery/src/core.js +949 -0
  144. data/vendor/assets/components/jquery/src/css.js +679 -0
  145. data/vendor/assets/components/jquery/src/data.js +340 -0
  146. data/vendor/assets/components/jquery/src/deferred.js +141 -0
  147. data/vendor/assets/components/jquery/src/deprecated.js +4 -0
  148. data/vendor/assets/components/jquery/src/dimensions.js +41 -0
  149. data/vendor/assets/components/jquery/src/effects.js +730 -0
  150. data/vendor/assets/components/jquery/src/event-alias.js +15 -0
  151. data/vendor/assets/components/jquery/src/event.js +991 -0
  152. data/vendor/assets/components/jquery/src/exports.js +18 -0
  153. data/vendor/assets/components/jquery/src/intro.js +20 -0
  154. data/vendor/assets/components/jquery/src/manipulation.js +796 -0
  155. data/vendor/assets/components/jquery/src/offset.js +169 -0
  156. data/vendor/assets/components/jquery/src/outro.js +2 -0
  157. data/vendor/assets/components/jquery/src/queue.js +147 -0
  158. data/vendor/assets/components/jquery/src/serialize.js +99 -0
  159. data/vendor/assets/components/jquery/src/sizzle-jquery.js +9 -0
  160. data/vendor/assets/components/jquery/src/support.js +241 -0
  161. data/vendor/assets/components/jquery/src/traversing.js +275 -0
  162. data/vendor/assets/components/jquery/test/csp.php +16 -0
  163. data/vendor/assets/components/jquery/test/data/1x1.jpg +0 -0
  164. data/vendor/assets/components/jquery/test/data/ajax/unreleasedXHR.html +25 -0
  165. data/vendor/assets/components/jquery/test/data/atom+xml.php +4 -0
  166. data/vendor/assets/components/jquery/test/data/badcall.js +1 -0
  167. data/vendor/assets/components/jquery/test/data/badjson.js +1 -0
  168. data/vendor/assets/components/jquery/test/data/cleanScript.html +10 -0
  169. data/vendor/assets/components/jquery/test/data/core/cc_on.html +22 -0
  170. data/vendor/assets/components/jquery/test/data/dashboard.xml +11 -0
  171. data/vendor/assets/components/jquery/test/data/dimensions/documentLarge.html +17 -0
  172. data/vendor/assets/components/jquery/test/data/dimensions/documentSmall.html +21 -0
  173. data/vendor/assets/components/jquery/test/data/echoData.php +1 -0
  174. data/vendor/assets/components/jquery/test/data/echoQuery.php +1 -0
  175. data/vendor/assets/components/jquery/test/data/errorWithText.php +5 -0
  176. data/vendor/assets/components/jquery/test/data/etag.php +21 -0
  177. data/vendor/assets/components/jquery/test/data/evalScript.php +1 -0
  178. data/vendor/assets/components/jquery/test/data/event/longLoadScript.php +4 -0
  179. data/vendor/assets/components/jquery/test/data/event/promiseReady.html +17 -0
  180. data/vendor/assets/components/jquery/test/data/event/syncReady.html +23 -0
  181. data/vendor/assets/components/jquery/test/data/headers.php +18 -0
  182. data/vendor/assets/components/jquery/test/data/if_modified_since.php +20 -0
  183. data/vendor/assets/components/jquery/test/data/iframe.html +8 -0
  184. data/vendor/assets/components/jquery/test/data/jquery-1.8.2.ajax_xhr.min.js +2 -0
  185. data/vendor/assets/components/jquery/test/data/json.php +13 -0
  186. data/vendor/assets/components/jquery/test/data/json_obj.js +1 -0
  187. data/vendor/assets/components/jquery/test/data/jsonp.php +14 -0
  188. data/vendor/assets/components/jquery/test/data/manipulation/iframe-denied.html +36 -0
  189. data/vendor/assets/components/jquery/test/data/name.html +1 -0
  190. data/vendor/assets/components/jquery/test/data/name.php +24 -0
  191. data/vendor/assets/components/jquery/test/data/nocontent.php +5 -0
  192. data/vendor/assets/components/jquery/test/data/offset/absolute.html +41 -0
  193. data/vendor/assets/components/jquery/test/data/offset/body.html +26 -0
  194. data/vendor/assets/components/jquery/test/data/offset/fixed.html +34 -0
  195. data/vendor/assets/components/jquery/test/data/offset/relative.html +31 -0
  196. data/vendor/assets/components/jquery/test/data/offset/scroll.html +39 -0
  197. data/vendor/assets/components/jquery/test/data/offset/static.html +31 -0
  198. data/vendor/assets/components/jquery/test/data/offset/table.html +43 -0
  199. data/vendor/assets/components/jquery/test/data/params_html.php +12 -0
  200. data/vendor/assets/components/jquery/test/data/readywaitasset.js +1 -0
  201. data/vendor/assets/components/jquery/test/data/readywaitloader.js +25 -0
  202. data/vendor/assets/components/jquery/test/data/script.php +11 -0
  203. data/vendor/assets/components/jquery/test/data/selector/html5_selector.html +114 -0
  204. data/vendor/assets/components/jquery/test/data/selector/sizzle_cache.html +21 -0
  205. data/vendor/assets/components/jquery/test/data/statusText.php +5 -0
  206. data/vendor/assets/components/jquery/test/data/support/bodyBackground.html +28 -0
  207. data/vendor/assets/components/jquery/test/data/support/shrinkWrapBlocks.html +23 -0
  208. data/vendor/assets/components/jquery/test/data/support/testElementCrash.html +17 -0
  209. data/vendor/assets/components/jquery/test/data/test.html +7 -0
  210. data/vendor/assets/components/jquery/test/data/test.js +3 -0
  211. data/vendor/assets/components/jquery/test/data/test.php +7 -0
  212. data/vendor/assets/components/jquery/test/data/test2.html +5 -0
  213. data/vendor/assets/components/jquery/test/data/test3.html +3 -0
  214. data/vendor/assets/components/jquery/test/data/testinit.js +269 -0
  215. data/vendor/assets/components/jquery/test/data/testrunner.js +368 -0
  216. data/vendor/assets/components/jquery/test/data/testsuite.css +155 -0
  217. data/vendor/assets/components/jquery/test/data/text.php +12 -0
  218. data/vendor/assets/components/jquery/test/data/ua.txt +272 -0
  219. data/vendor/assets/components/jquery/test/data/with_fries.xml +25 -0
  220. data/vendor/assets/components/jquery/test/data/with_fries_over_jsonp.php +7 -0
  221. data/vendor/assets/components/jquery/test/delegatetest.html +228 -0
  222. data/vendor/assets/components/jquery/test/hovertest.html +158 -0
  223. data/vendor/assets/components/jquery/test/index.html +330 -0
  224. data/vendor/assets/components/jquery/test/localfile.html +75 -0
  225. data/vendor/assets/components/jquery/test/networkerror.html +84 -0
  226. data/vendor/assets/components/jquery/test/polluted.php +110 -0
  227. data/vendor/assets/components/jquery/test/readywait.html +70 -0
  228. data/vendor/assets/components/jquery/test/unit/ajax.js +1971 -0
  229. data/vendor/assets/components/jquery/test/unit/attributes.js +1332 -0
  230. data/vendor/assets/components/jquery/test/unit/callbacks.js +326 -0
  231. data/vendor/assets/components/jquery/test/unit/core.js +1332 -0
  232. data/vendor/assets/components/jquery/test/unit/css.js +1036 -0
  233. data/vendor/assets/components/jquery/test/unit/data.js +636 -0
  234. data/vendor/assets/components/jquery/test/unit/deferred.js +440 -0
  235. data/vendor/assets/components/jquery/test/unit/deprecated.js +1 -0
  236. data/vendor/assets/components/jquery/test/unit/dimensions.js +461 -0
  237. data/vendor/assets/components/jquery/test/unit/effects.js +2050 -0
  238. data/vendor/assets/components/jquery/test/unit/event.js +2690 -0
  239. data/vendor/assets/components/jquery/test/unit/exports.js +7 -0
  240. data/vendor/assets/components/jquery/test/unit/manipulation.js +2242 -0
  241. data/vendor/assets/components/jquery/test/unit/offset.js +549 -0
  242. data/vendor/assets/components/jquery/test/unit/queue.js +316 -0
  243. data/vendor/assets/components/jquery/test/unit/selector.js +185 -0
  244. data/vendor/assets/components/jquery/test/unit/serialize.js +146 -0
  245. data/vendor/assets/components/jquery/test/unit/support.js +384 -0
  246. data/vendor/assets/components/jquery/test/unit/traversing.js +667 -0
  247. data/vendor/assets/components/jquery/test/xhtml.php +5 -0
  248. data/vendor/assets/components/sir-trevor-js/CHANGELOG.md +44 -0
  249. data/vendor/assets/components/sir-trevor-js/Gemfile +3 -0
  250. data/vendor/assets/components/sir-trevor-js/Gemfile.lock +10 -0
  251. data/vendor/assets/components/sir-trevor-js/Gruntfile.js +109 -0
  252. data/vendor/assets/components/sir-trevor-js/MIT-LICENCE +20 -0
  253. data/vendor/assets/components/sir-trevor-js/Readme.md +84 -0
  254. data/vendor/assets/components/sir-trevor-js/bower.json +21 -0
  255. data/vendor/assets/components/sir-trevor-js/component.json +42 -0
  256. data/vendor/assets/components/sir-trevor-js/contributing.md +74 -0
  257. data/vendor/assets/components/sir-trevor-js/examples-component/component.json +14 -0
  258. data/vendor/assets/components/sir-trevor-js/examples-component/index.html +33 -0
  259. data/vendor/assets/components/sir-trevor-js/examples-component/index.js +29 -0
  260. data/vendor/assets/components/sir-trevor-js/examples-component/javascript/example_block.js +203 -0
  261. data/vendor/assets/components/sir-trevor-js/examples-component/javascript/limit_chars.js +46 -0
  262. data/vendor/assets/components/sir-trevor-js/examples-component/sir-trevor.gif +0 -0
  263. data/vendor/assets/components/sir-trevor-js/locales/cn.js +51 -0
  264. data/vendor/assets/components/sir-trevor-js/locales/de.js +51 -0
  265. data/vendor/assets/components/sir-trevor-js/locales/es.js +51 -0
  266. data/vendor/assets/components/sir-trevor-js/locales/fi.js +51 -0
  267. data/vendor/assets/components/sir-trevor-js/locales/fr.js +51 -0
  268. data/vendor/assets/components/sir-trevor-js/locales/pt.js +52 -0
  269. data/vendor/assets/components/sir-trevor-js/package.json +23 -0
  270. data/vendor/assets/components/sir-trevor-js/sir-trevor-icons.css +6 -0
  271. data/vendor/assets/components/sir-trevor-js/sir-trevor.css +393 -0
  272. data/vendor/assets/components/sir-trevor-js/sir-trevor.css.map +7 -0
  273. data/vendor/assets/components/sir-trevor-js/sir-trevor.js +5481 -0
  274. data/vendor/assets/components/sir-trevor-js/sir-trevor.min.js +13 -0
  275. data/vendor/assets/components/underscore/CNAME +1 -0
  276. data/vendor/assets/components/underscore/CONTRIBUTING.md +9 -0
  277. data/vendor/assets/components/underscore/LICENSE +22 -0
  278. data/vendor/assets/components/underscore/README.md +19 -0
  279. data/vendor/assets/components/underscore/Rakefile +10 -0
  280. data/vendor/assets/components/underscore/docs/docco.css +192 -0
  281. data/vendor/assets/components/underscore/docs/favicon.ico +0 -0
  282. data/vendor/assets/components/underscore/docs/images/background.png +0 -0
  283. data/vendor/assets/components/underscore/docs/images/underscore.png +0 -0
  284. data/vendor/assets/components/underscore/docs/underscore.html +823 -0
  285. data/vendor/assets/components/underscore/favicon.ico +0 -0
  286. data/vendor/assets/components/underscore/index.html +2467 -0
  287. data/vendor/assets/components/underscore/index.js +1 -0
  288. data/vendor/assets/components/underscore/package.json +16 -0
  289. data/vendor/assets/components/underscore/test/arrays.js +200 -0
  290. data/vendor/assets/components/underscore/test/chaining.js +59 -0
  291. data/vendor/assets/components/underscore/test/collections.js +453 -0
  292. data/vendor/assets/components/underscore/test/functions.js +265 -0
  293. data/vendor/assets/components/underscore/test/index.html +44 -0
  294. data/vendor/assets/components/underscore/test/objects.js +570 -0
  295. data/vendor/assets/components/underscore/test/speed.js +75 -0
  296. data/vendor/assets/components/underscore/test/utility.js +266 -0
  297. data/vendor/assets/components/underscore/test/vendor/jquery.js +9404 -0
  298. data/vendor/assets/components/underscore/test/vendor/jslitmus.js +670 -0
  299. data/vendor/assets/components/underscore/test/vendor/qunit.css +235 -0
  300. data/vendor/assets/components/underscore/test/vendor/qunit.js +1977 -0
  301. data/vendor/assets/components/underscore/test/vendor/runner.js +98 -0
  302. data/vendor/assets/components/underscore/underscore-min.js +1 -0
  303. data/vendor/assets/components/underscore/underscore.js +1226 -0
  304. metadata +473 -0
@@ -0,0 +1,667 @@
1
+ module("traversing", { teardown: moduleTeardown });
2
+
3
+ test( "find(String)", function() {
4
+ expect( 7 );
5
+ equal( "Yahoo", jQuery("#foo").find(".blogTest").text(), "Check for find" );
6
+
7
+ // using contents will get comments regular, text, and comment nodes
8
+ var j = jQuery("#nonnodes").contents();
9
+ equal( j.find("div").length, 0, "Check node,textnode,comment to find zero divs" );
10
+ equal( j.find("div").andSelf().length, 3, "Check node,textnode,comment to find zero divs, but preserves pushStack" );
11
+
12
+ deepEqual( jQuery("#qunit-fixture").find("> div").get(), q( "foo", "nothiddendiv", "moretests", "tabindex-tests", "liveHandlerOrder", "siblingTest", "fx-test-group" ), "find child elements" );
13
+ deepEqual( jQuery("#qunit-fixture").find("> #foo, > #moretests").get(), q( "foo", "moretests" ), "find child elements" );
14
+ deepEqual( jQuery("#qunit-fixture").find("> #foo > p").get(), q( "sndp", "en", "sap" ), "find child elements" );
15
+
16
+ deepEqual( jQuery("#siblingTest, #siblingfirst").find("+ *").get(), q( "siblingnext", "fx-test-group" ), "ensure document order" );
17
+ });
18
+
19
+ test( "find(node|jQuery object)", function() {
20
+ expect( 12 );
21
+
22
+ var $foo = jQuery("#foo"),
23
+ $blog = jQuery(".blogTest"),
24
+ $first = jQuery("#first"),
25
+ $two = $blog.add( $first ),
26
+ $fooTwo = $foo.add( $blog );
27
+
28
+ equal( $foo.find( $blog ).text(), "Yahoo", "Find with blog jQuery object" );
29
+ equal( $foo.find( $blog[ 0 ] ).text(), "Yahoo", "Find with blog node" );
30
+ equal( $foo.find( $first ).length, 0, "#first is not in #foo" );
31
+ equal( $foo.find( $first[ 0 ]).length, 0, "#first not in #foo (node)" );
32
+ ok( $foo.find( $two ).is(".blogTest"), "Find returns only nodes within #foo" );
33
+ ok( $fooTwo.find( $blog ).is(".blogTest"), "Blog is part of the collection, but also within foo" );
34
+ ok( $fooTwo.find( $blog[ 0 ] ).is(".blogTest"), "Blog is part of the collection, but also within foo(node)" );
35
+
36
+ equal( $two.find( $foo ).length, 0, "Foo is not in two elements" );
37
+ equal( $two.find( $foo[ 0 ] ).length, 0, "Foo is not in two elements(node)" );
38
+ equal( $two.find( $first ).length, 0, "first is in the collection and not within two" );
39
+ equal( $two.find( $first ).length, 0, "first is in the collection and not within two(node)" );
40
+
41
+ equal( $two.find( $foo[ 0 ] ).andSelf().length, 2, "find preserves the pushStack, see #12009" );
42
+ });
43
+
44
+ test("is(String|undefined)", function() {
45
+ expect(30);
46
+ ok( jQuery("#form").is("form"), "Check for element: A form must be a form" );
47
+ ok( !jQuery("#form").is("div"), "Check for element: A form is not a div" );
48
+ ok( jQuery("#mark").is(".blog"), "Check for class: Expected class 'blog'" );
49
+ ok( !jQuery("#mark").is(".link"), "Check for class: Did not expect class 'link'" );
50
+ ok( jQuery("#simon").is(".blog.link"), "Check for multiple classes: Expected classes 'blog' and 'link'" );
51
+ ok( !jQuery("#simon").is(".blogTest"), "Check for multiple classes: Expected classes 'blog' and 'link', but not 'blogTest'" );
52
+ ok( jQuery("#en").is("[lang=\"en\"]"), "Check for attribute: Expected attribute lang to be 'en'" );
53
+ ok( !jQuery("#en").is("[lang=\"de\"]"), "Check for attribute: Expected attribute lang to be 'en', not 'de'" );
54
+ ok( jQuery("#text1").is("[type=\"text\"]"), "Check for attribute: Expected attribute type to be 'text'" );
55
+ ok( !jQuery("#text1").is("[type=\"radio\"]"), "Check for attribute: Expected attribute type to be 'text', not 'radio'" );
56
+ ok( jQuery("#text2").is(":disabled"), "Check for pseudoclass: Expected to be disabled" );
57
+ ok( !jQuery("#text1").is(":disabled"), "Check for pseudoclass: Expected not disabled" );
58
+ ok( jQuery("#radio2").is(":checked"), "Check for pseudoclass: Expected to be checked" );
59
+ ok( !jQuery("#radio1").is(":checked"), "Check for pseudoclass: Expected not checked" );
60
+ ok( jQuery("#foo").is(":has(p)"), "Check for child: Expected a child 'p' element" );
61
+ ok( !jQuery("#foo").is(":has(ul)"), "Check for child: Did not expect 'ul' element" );
62
+ ok( jQuery("#foo").is(":has(p):has(a):has(code)"), "Check for childs: Expected 'p', 'a' and 'code' child elements" );
63
+ ok( !jQuery("#foo").is(":has(p):has(a):has(code):has(ol)"), "Check for childs: Expected 'p', 'a' and 'code' child elements, but no 'ol'" );
64
+
65
+ ok( !jQuery("#foo").is(0), "Expected false for an invalid expression - 0" );
66
+ ok( !jQuery("#foo").is(null), "Expected false for an invalid expression - null" );
67
+ ok( !jQuery("#foo").is(""), "Expected false for an invalid expression - \"\"" );
68
+ ok( !jQuery("#foo").is(undefined), "Expected false for an invalid expression - undefined" );
69
+ ok( !jQuery("#foo").is({ plain: "object" }), "Check passing invalid object" );
70
+
71
+ // test is() with comma-seperated expressions
72
+ ok( jQuery("#en").is("[lang=\"en\"],[lang=\"de\"]"), "Comma-seperated; Check for lang attribute: Expect en or de" );
73
+ ok( jQuery("#en").is("[lang=\"de\"],[lang=\"en\"]"), "Comma-seperated; Check for lang attribute: Expect en or de" );
74
+ ok( jQuery("#en").is("[lang=\"en\"] , [lang=\"de\"]"), "Comma-seperated; Check for lang attribute: Expect en or de" );
75
+ ok( jQuery("#en").is("[lang=\"de\"] , [lang=\"en\"]"), "Comma-seperated; Check for lang attribute: Expect en or de" );
76
+
77
+ ok( !jQuery(window).is("a"), "Checking is on a window does not throw an exception(#10178)" );
78
+ ok( !jQuery(document).is("a"), "Checking is on a document does not throw an exception(#10178)" );
79
+
80
+ ok( jQuery("#option1b").is("#select1 option:not(:first)"), "POS inside of :not() (#10970)" );
81
+ });
82
+
83
+ test("is(jQuery)", function() {
84
+ expect(21);
85
+ ok( jQuery("#form").is( jQuery("form") ), "Check for element: A form is a form" );
86
+ ok( !jQuery("#form").is( jQuery("div") ), "Check for element: A form is not a div" );
87
+ ok( jQuery("#mark").is( jQuery(".blog") ), "Check for class: Expected class 'blog'" );
88
+ ok( !jQuery("#mark").is( jQuery(".link") ), "Check for class: Did not expect class 'link'" );
89
+ ok( jQuery("#simon").is( jQuery(".blog.link") ), "Check for multiple classes: Expected classes 'blog' and 'link'" );
90
+ ok( !jQuery("#simon").is( jQuery(".blogTest") ), "Check for multiple classes: Expected classes 'blog' and 'link', but not 'blogTest'" );
91
+ ok( jQuery("#en").is( jQuery("[lang=\"en\"]") ), "Check for attribute: Expected attribute lang to be 'en'" );
92
+ ok( !jQuery("#en").is( jQuery("[lang=\"de\"]") ), "Check for attribute: Expected attribute lang to be 'en', not 'de'" );
93
+ ok( jQuery("#text1").is( jQuery("[type=\"text\"]") ), "Check for attribute: Expected attribute type to be 'text'" );
94
+ ok( !jQuery("#text1").is( jQuery("[type=\"radio\"]") ), "Check for attribute: Expected attribute type to be 'text', not 'radio'" );
95
+ ok( !jQuery("#text1").is( jQuery("input:disabled") ), "Check for pseudoclass: Expected not disabled" );
96
+ ok( jQuery("#radio2").is( jQuery("input:checked") ), "Check for pseudoclass: Expected to be checked" );
97
+ ok( !jQuery("#radio1").is( jQuery("input:checked") ), "Check for pseudoclass: Expected not checked" );
98
+ ok( jQuery("#foo").is( jQuery("div:has(p)") ), "Check for child: Expected a child 'p' element" );
99
+ ok( !jQuery("#foo").is( jQuery("div:has(ul)") ), "Check for child: Did not expect 'ul' element" );
100
+
101
+ // Some raw elements
102
+ ok( jQuery("#form").is( jQuery("form")[0] ), "Check for element: A form is a form" );
103
+ ok( !jQuery("#form").is( jQuery("div")[0] ), "Check for element: A form is not a div" );
104
+ ok( jQuery("#mark").is( jQuery(".blog")[0] ), "Check for class: Expected class 'blog'" );
105
+ ok( !jQuery("#mark").is( jQuery(".link")[0] ), "Check for class: Did not expect class 'link'" );
106
+ ok( jQuery("#simon").is( jQuery(".blog.link")[0] ), "Check for multiple classes: Expected classes 'blog' and 'link'" );
107
+ ok( !jQuery("#simon").is( jQuery(".blogTest")[0] ), "Check for multiple classes: Expected classes 'blog' and 'link', but not 'blogTest'" );
108
+ });
109
+
110
+ test("is() with positional selectors", function() {
111
+ expect(23);
112
+
113
+ var html = jQuery(
114
+ "<p id='posp'><a class='firsta' href='#'><em>first</em></a><a class='seconda' href='#'><b>test</b></a><em></em></p>"
115
+ ).appendTo( "body" ),
116
+ isit = function(sel, match, expect) {
117
+ equal( jQuery( sel ).is( match ), expect, "jQuery('" + sel + "').is('" + match + "')" );
118
+ };
119
+
120
+ isit( "#posp", "#posp:first", true );
121
+ isit( "#posp", "#posp:eq(2)", false );
122
+ isit( "#posp", "#posp a:first", false );
123
+
124
+ isit( "#posp .firsta", "#posp a:first", true );
125
+ isit( "#posp .firsta", "#posp a:last", false );
126
+ isit( "#posp .firsta", "#posp a:even", true );
127
+ isit( "#posp .firsta", "#posp a:odd", false );
128
+ isit( "#posp .firsta", "#posp a:eq(0)", true );
129
+ isit( "#posp .firsta", "#posp a:eq(9)", false );
130
+ isit( "#posp .firsta", "#posp em:eq(0)", false );
131
+ isit( "#posp .firsta", "#posp em:first", false );
132
+ isit( "#posp .firsta", "#posp:first", false );
133
+
134
+ isit( "#posp .seconda", "#posp a:first", false );
135
+ isit( "#posp .seconda", "#posp a:last", true );
136
+ isit( "#posp .seconda", "#posp a:gt(0)", true );
137
+ isit( "#posp .seconda", "#posp a:lt(5)", true );
138
+ isit( "#posp .seconda", "#posp a:lt(1)", false );
139
+
140
+ isit( "#posp em", "#posp a:eq(0) em", true );
141
+ isit( "#posp em", "#posp a:lt(1) em", true );
142
+ isit( "#posp em", "#posp a:gt(1) em", false );
143
+ isit( "#posp em", "#posp a:first em", true );
144
+ isit( "#posp em", "#posp a em:last", true );
145
+ isit( "#posp em", "#posp a em:eq(2)", false );
146
+
147
+ html.remove();
148
+ });
149
+
150
+ test("index()", function() {
151
+ expect( 2 );
152
+
153
+ equal( jQuery("#text2").index(), 2, "Returns the index of a child amongst its siblings" );
154
+
155
+ equal( jQuery("<div/>").index(), -1, "Node without parent returns -1" );
156
+ });
157
+
158
+ test("index(Object|String|undefined)", function() {
159
+ expect(16);
160
+
161
+ var elements = jQuery([window, document]),
162
+ inputElements = jQuery("#radio1,#radio2,#check1,#check2");
163
+
164
+ // Passing a node
165
+ equal( elements.index(window), 0, "Check for index of elements" );
166
+ equal( elements.index(document), 1, "Check for index of elements" );
167
+ equal( inputElements.index(document.getElementById("radio1")), 0, "Check for index of elements" );
168
+ equal( inputElements.index(document.getElementById("radio2")), 1, "Check for index of elements" );
169
+ equal( inputElements.index(document.getElementById("check1")), 2, "Check for index of elements" );
170
+ equal( inputElements.index(document.getElementById("check2")), 3, "Check for index of elements" );
171
+ equal( inputElements.index(window), -1, "Check for not found index" );
172
+ equal( inputElements.index(document), -1, "Check for not found index" );
173
+
174
+ // Passing a jQuery object
175
+ // enabled since [5500]
176
+ equal( elements.index( elements ), 0, "Pass in a jQuery object" );
177
+ equal( elements.index( elements.eq(1) ), 1, "Pass in a jQuery object" );
178
+ equal( jQuery("#form :radio").index( jQuery("#radio2") ), 1, "Pass in a jQuery object" );
179
+
180
+ // Passing a selector or nothing
181
+ // enabled since [6330]
182
+ equal( jQuery("#text2").index(), 2, "Check for index amongst siblings" );
183
+ equal( jQuery("#form").children().eq(4).index(), 4, "Check for index amongst siblings" );
184
+ equal( jQuery("#radio2").index("#form :radio") , 1, "Check for index within a selector" );
185
+ equal( jQuery("#form :radio").index( jQuery("#radio2") ), 1, "Check for index within a selector" );
186
+ equal( jQuery("#radio2").index("#form :text") , -1, "Check for index not found within a selector" );
187
+ });
188
+
189
+ test("filter(Selector|undefined)", function() {
190
+ expect(9);
191
+ deepEqual( jQuery("#form input").filter(":checked").get(), q("radio2", "check1"), "filter(String)" );
192
+ deepEqual( jQuery("p").filter("#ap, #sndp").get(), q("ap", "sndp"), "filter('String, String')" );
193
+ deepEqual( jQuery("p").filter("#ap,#sndp").get(), q("ap", "sndp"), "filter('String,String')" );
194
+
195
+ deepEqual( jQuery("p").filter(null).get(), [], "filter(null) should return an empty jQuery object");
196
+ deepEqual( jQuery("p").filter(undefined).get(), [], "filter(undefined) should return an empty jQuery object");
197
+ deepEqual( jQuery("p").filter(0).get(), [], "filter(0) should return an empty jQuery object");
198
+ deepEqual( jQuery("p").filter("").get(), [], "filter('') should return an empty jQuery object");
199
+
200
+ // using contents will get comments regular, text, and comment nodes
201
+ var j = jQuery("#nonnodes").contents();
202
+ equal( j.filter("span").length, 1, "Check node,textnode,comment to filter the one span" );
203
+ equal( j.filter("[name]").length, 0, "Check node,textnode,comment to filter the one span" );
204
+ });
205
+
206
+ test("filter(Function)", function() {
207
+ expect(2);
208
+
209
+ deepEqual( jQuery("#qunit-fixture p").filter(function() {
210
+ return !jQuery("a", this).length;
211
+ }).get(), q("sndp", "first"), "filter(Function)" );
212
+
213
+ deepEqual( jQuery("#qunit-fixture p").filter(function(i, elem) { return !jQuery("a", elem).length; }).get(), q("sndp", "first"), "filter(Function) using arg" );
214
+ });
215
+
216
+ test("filter(Element)", function() {
217
+ expect(1);
218
+
219
+ var element = document.getElementById("text1");
220
+ deepEqual( jQuery("#form input").filter(element).get(), q("text1"), "filter(Element)" );
221
+ });
222
+
223
+ test("filter(Array)", function() {
224
+ expect(1);
225
+
226
+ var elements = [ document.getElementById("text1") ];
227
+ deepEqual( jQuery("#form input").filter(elements).get(), q("text1"), "filter(Element)" );
228
+ });
229
+
230
+ test("filter(jQuery)", function() {
231
+ expect(1);
232
+
233
+ var elements = jQuery("#text1");
234
+ deepEqual( jQuery("#form input").filter(elements).get(), q("text1"), "filter(Element)" );
235
+ });
236
+
237
+
238
+ test("filter() with positional selectors", function() {
239
+ expect(19);
240
+
241
+ var html = jQuery( "" +
242
+ "<p id='posp'>" +
243
+ "<a class='firsta' href='#'>" +
244
+ "<em>first</em>" +
245
+ "</a>" +
246
+ "<a class='seconda' href='#'>" +
247
+ "<b>test</b>" +
248
+ "</a>" +
249
+ "<em></em>" +
250
+ "</p>" ).appendTo( "body" ),
251
+ filterit = function(sel, filter, length) {
252
+ equal( jQuery( sel ).filter( filter ).length, length, "jQuery( " + sel + " ).filter( " + filter + " )" );
253
+ };
254
+
255
+ filterit( "#posp", "#posp:first", 1);
256
+ filterit( "#posp", "#posp:eq(2)", 0 );
257
+ filterit( "#posp", "#posp a:first", 0 );
258
+
259
+ // Keep in mind this is within the selection and
260
+ // not in relation to other elements (.is() is a different story)
261
+ filterit( "#posp .firsta", "#posp a:first", 1 );
262
+ filterit( "#posp .firsta", "#posp a:last", 1 );
263
+ filterit( "#posp .firsta", "#posp a:last-child", 0 );
264
+ filterit( "#posp .firsta", "#posp a:even", 1 );
265
+ filterit( "#posp .firsta", "#posp a:odd", 0 );
266
+ filterit( "#posp .firsta", "#posp a:eq(0)", 1 );
267
+ filterit( "#posp .firsta", "#posp a:eq(9)", 0 );
268
+ filterit( "#posp .firsta", "#posp em:eq(0)", 0 );
269
+ filterit( "#posp .firsta", "#posp em:first", 0 );
270
+ filterit( "#posp .firsta", "#posp:first", 0 );
271
+
272
+ filterit( "#posp .seconda", "#posp a:first", 1 );
273
+ filterit( "#posp .seconda", "#posp em:first", 0 );
274
+ filterit( "#posp .seconda", "#posp a:last", 1 );
275
+ filterit( "#posp .seconda", "#posp a:gt(0)", 0 );
276
+ filterit( "#posp .seconda", "#posp a:lt(5)", 1 );
277
+ filterit( "#posp .seconda", "#posp a:lt(1)", 1 );
278
+ html.remove();
279
+ });
280
+
281
+ test("closest()", function() {
282
+ expect( 14 );
283
+
284
+ deepEqual( jQuery("body").closest("body").get(), q("body"), "closest(body)" );
285
+ deepEqual( jQuery("body").closest("html").get(), q("html"), "closest(html)" );
286
+ deepEqual( jQuery("body").closest("div").get(), [], "closest(div)" );
287
+ deepEqual( jQuery("#qunit-fixture").closest("span,#html").get(), q("html"), "closest(span,#html)" );
288
+
289
+ deepEqual( jQuery("#qunit-fixture").closest("div:first").get(), [], "closest(div:first)" );
290
+ deepEqual( jQuery("#qunit-fixture div").closest("body:first div:last").get(), q("fx-tests"), "closest(body:first div:last)" );
291
+
292
+ // Test .closest() limited by the context
293
+ var jq = jQuery("#nothiddendivchild");
294
+ deepEqual( jq.closest("html", document.body).get(), [], "Context limited." );
295
+ deepEqual( jq.closest("body", document.body).get(), [], "Context limited." );
296
+ deepEqual( jq.closest("#nothiddendiv", document.body).get(), q("nothiddendiv"), "Context not reached." );
297
+
298
+ //Test that .closest() returns unique'd set
299
+ equal( jQuery("#qunit-fixture p").closest("#qunit-fixture").length, 1, "Closest should return a unique set" );
300
+
301
+ // Test on disconnected node
302
+ equal( jQuery("<div><p></p></div>").find("p").closest("table").length, 0, "Make sure disconnected closest work." );
303
+
304
+ // Bug #7369
305
+ equal( jQuery("<div foo='bar'></div>").closest("[foo]").length, 1, "Disconnected nodes with attribute selector" );
306
+ equal( jQuery("<div>text</div>").closest("[lang]").length, 0, "Disconnected nodes with text and non-existent attribute selector" );
307
+
308
+ ok( !jQuery(document).closest("#foo").length, "Calling closest on a document fails silently" );
309
+ });
310
+
311
+ test("closest(jQuery)", function() {
312
+ expect(8);
313
+ var $child = jQuery("#nothiddendivchild"),
314
+ $parent = jQuery("#nothiddendiv"),
315
+ $sibling = jQuery("#foo"),
316
+ $body = jQuery("body");
317
+ ok( $child.closest( $parent ).is("#nothiddendiv"), "closest( jQuery('#nothiddendiv') )" );
318
+ ok( $child.closest( $parent[0] ).is("#nothiddendiv"), "closest( jQuery('#nothiddendiv') ) :: node" );
319
+ ok( $child.closest( $child ).is("#nothiddendivchild"), "child is included" );
320
+ ok( $child.closest( $child[0] ).is("#nothiddendivchild"), "child is included :: node" );
321
+ equal( $child.closest( document.createElement("div") ).length, 0, "created element is not related" );
322
+ equal( $child.closest( $sibling ).length, 0, "Sibling not a parent of child" );
323
+ equal( $child.closest( $sibling[0] ).length, 0, "Sibling not a parent of child :: node" );
324
+ ok( $child.closest( $body.add($parent) ).is("#nothiddendiv"), "Closest ancestor retrieved." );
325
+ });
326
+
327
+ test("not(Selector|undefined)", function() {
328
+ expect(11);
329
+ equal( jQuery("#qunit-fixture > p#ap > a").not("#google").length, 2, "not('selector')" );
330
+ deepEqual( jQuery("p").not(".result").get(), q("firstp", "ap", "sndp", "en", "sap", "first"), "not('.class')" );
331
+ deepEqual( jQuery("p").not("#ap, #sndp, .result").get(), q("firstp", "en", "sap", "first"), "not('selector, selector')" );
332
+ deepEqual(
333
+ jQuery("#form option").not("option.emptyopt:contains('Nothing'),optgroup *,[value='1']").get(),
334
+ q("option1c", "option1d", "option2c", "option2d", "option3c", "option3d", "option3e", "option4d", "option4e", "option5a", "option5b"),
335
+ "not('complex selector')"
336
+ );
337
+
338
+ deepEqual( jQuery("#ap *").not("code").get(), q("google", "groups", "anchor1", "mark"), "not('tag selector')" );
339
+ deepEqual( jQuery("#ap *").not("code, #mark").get(), q("google", "groups", "anchor1"), "not('tag, ID selector')" );
340
+ deepEqual( jQuery("#ap *").not("#mark, code").get(), q("google", "groups", "anchor1"), "not('ID, tag selector')");
341
+
342
+ var all = jQuery("p").get();
343
+ deepEqual( jQuery("p").not(null).get(), all, "not(null) should have no effect");
344
+ deepEqual( jQuery("p").not(undefined).get(), all, "not(undefined) should have no effect");
345
+ deepEqual( jQuery("p").not(0).get(), all, "not(0) should have no effect");
346
+ deepEqual( jQuery("p").not("").get(), all, "not('') should have no effect");
347
+ });
348
+
349
+ test("not(Element)", function() {
350
+ expect(1);
351
+
352
+ var selects = jQuery("#form select");
353
+ deepEqual( selects.not( selects[1] ).get(), q("select1", "select3", "select4", "select5"), "filter out DOM element");
354
+ });
355
+
356
+ test("not(Function)", function() {
357
+ expect(1);
358
+
359
+ deepEqual( jQuery("#qunit-fixture p").not(function() { return jQuery("a", this).length; }).get(), q("sndp", "first"), "not(Function)" );
360
+ });
361
+
362
+ test("not(Array)", function() {
363
+ expect(2);
364
+
365
+ equal( jQuery("#qunit-fixture > p#ap > a").not(document.getElementById("google")).length, 2, "not(DOMElement)" );
366
+ equal( jQuery("p").not(document.getElementsByTagName("p")).length, 0, "not(Array-like DOM collection)" );
367
+ });
368
+
369
+ test("not(jQuery)", function() {
370
+ expect( 1 );
371
+
372
+ deepEqual( jQuery("p").not(jQuery("#ap, #sndp, .result")).get(), q("firstp", "en", "sap", "first"), "not(jQuery)" );
373
+ });
374
+
375
+ test("has(Element)", function() {
376
+ expect(3);
377
+
378
+ var obj = jQuery("#qunit-fixture").has(jQuery("#sndp")[0]);
379
+ deepEqual( obj.get(), q("qunit-fixture"), "Keeps elements that have the element as a descendant" );
380
+
381
+ var detached = jQuery("<a><b><i/></b></a>");
382
+ deepEqual( detached.has( detached.find("i")[0] ).get(), detached.get(), "...Even when detached" );
383
+
384
+ var multipleParent = jQuery("#qunit-fixture, #header").has(jQuery("#sndp")[0]);
385
+ deepEqual( obj.get(), q("qunit-fixture"), "Does not include elements that do not have the element as a descendant" );
386
+ });
387
+
388
+ test("has(Selector)", function() {
389
+ expect( 5 );
390
+
391
+ var obj = jQuery("#qunit-fixture").has("#sndp");
392
+ deepEqual( obj.get(), q("qunit-fixture"), "Keeps elements that have any element matching the selector as a descendant" );
393
+
394
+ var detached = jQuery("<a><b><i/></b></a>");
395
+ deepEqual( detached.has("i").get(), detached.get(), "...Even when detached" );
396
+
397
+ var multipleParent = jQuery("#qunit-fixture, #header").has("#sndp");
398
+ deepEqual( multipleParent.get(), q("qunit-fixture"), "Does not include elements that do not have the element as a descendant" );
399
+
400
+ multipleParent = jQuery("#select1, #select2, #select3").has("#option1a, #option3a");
401
+ deepEqual( multipleParent.get(), q("select1", "select3"), "Multiple contexts are checks correctly" );
402
+
403
+ var multipleHas = jQuery("#qunit-fixture").has("#sndp, #first");
404
+ deepEqual( multipleHas.get(), q("qunit-fixture"), "Only adds elements once" );
405
+ });
406
+
407
+ test("has(Arrayish)", function() {
408
+ expect(4);
409
+
410
+ var simple = jQuery("#qunit-fixture").has(jQuery("#sndp"));
411
+ deepEqual( simple.get(), q("qunit-fixture"), "Keeps elements that have any element in the jQuery list as a descendant" );
412
+
413
+ var detached = jQuery("<a><b><i/></b></a>");
414
+ deepEqual( detached.has( detached.find("i") ).get(), detached.get(), "...Even when detached" );
415
+
416
+ var multipleParent = jQuery("#qunit-fixture, #header").has(jQuery("#sndp"));
417
+ deepEqual( multipleParent.get(), q("qunit-fixture"), "Does not include elements that do not have an element in the jQuery list as a descendant" );
418
+
419
+ var multipleHas = jQuery("#qunit-fixture").has(jQuery("#sndp, #first"));
420
+ deepEqual( simple.get(), q("qunit-fixture"), "Only adds elements once" );
421
+ });
422
+
423
+ test("addBack()", function() {
424
+ expect(5);
425
+ deepEqual( jQuery("#en").siblings().addBack().get(), q("sndp", "en", "sap"), "Check for siblings and self" );
426
+ deepEqual( jQuery("#foo").children().addBack().get(), q("foo", "sndp", "en", "sap"), "Check for children and self" );
427
+ deepEqual( jQuery("#sndp, #en").parent().addBack().get(), q("foo","sndp","en"), "Check for parent and self" );
428
+ deepEqual( jQuery("#groups").parents("p, div").addBack().get(), q("qunit-fixture", "ap", "groups"), "Check for parents and self" );
429
+ deepEqual( jQuery("#select1 > option").filter(":first-child").addBack(":last-child").get(), q("option1a", "option1d"), "Should contain the last elems plus the *filtered* prior set elements" );
430
+ });
431
+
432
+ test("siblings([String])", function() {
433
+ expect(7);
434
+ deepEqual( jQuery("#en").siblings().get(), q("sndp", "sap"), "Check for siblings" );
435
+ deepEqual( jQuery("#sndp").siblings(":has(code)").get(), q("sap"), "Check for filtered siblings (has code child element)" );
436
+ deepEqual( jQuery("#sndp").siblings(":has(a)").get(), q("en", "sap"), "Check for filtered siblings (has anchor child element)" );
437
+ deepEqual( jQuery("#foo").siblings("form, b").get(), q("form", "floatTest", "lengthtest", "name-tests", "testForm"), "Check for multiple filters" );
438
+ var set = q("sndp", "en", "sap");
439
+ deepEqual( jQuery("#en, #sndp").siblings().get(), set, "Check for unique results from siblings" );
440
+ deepEqual( jQuery("#option5a").siblings("option[data-attr]").get(), q("option5c"), "Has attribute selector in siblings (#9261)" );
441
+ equal( jQuery("<a/>").siblings().length, 0, "Detached elements have no siblings (#11370)" );
442
+ });
443
+
444
+ test("children([String])", function() {
445
+ expect(3);
446
+ deepEqual( jQuery("#foo").children().get(), q("sndp", "en", "sap"), "Check for children" );
447
+ deepEqual( jQuery("#foo").children(":has(code)").get(), q("sndp", "sap"), "Check for filtered children" );
448
+ deepEqual( jQuery("#foo").children("#en, #sap").get(), q("en", "sap"), "Check for multiple filters" );
449
+ });
450
+
451
+ test("parent([String])", function() {
452
+ expect(5);
453
+ equal( jQuery("#groups").parent()[0].id, "ap", "Simple parent check" );
454
+ equal( jQuery("#groups").parent("p")[0].id, "ap", "Filtered parent check" );
455
+ equal( jQuery("#groups").parent("div").length, 0, "Filtered parent check, no match" );
456
+ equal( jQuery("#groups").parent("div, p")[0].id, "ap", "Check for multiple filters" );
457
+ deepEqual( jQuery("#en, #sndp").parent().get(), q("foo"), "Check for unique results from parent" );
458
+ });
459
+
460
+ test("parents([String])", function() {
461
+ expect(5);
462
+ equal( jQuery("#groups").parents()[0].id, "ap", "Simple parents check" );
463
+ equal( jQuery("#groups").parents("p")[0].id, "ap", "Filtered parents check" );
464
+ equal( jQuery("#groups").parents("div")[0].id, "qunit-fixture", "Filtered parents check2" );
465
+ deepEqual( jQuery("#groups").parents("p, div").get(), q("ap", "qunit-fixture"), "Check for multiple filters" );
466
+ deepEqual( jQuery("#en, #sndp").parents().get(), q("foo", "qunit-fixture", "dl", "body", "html"), "Check for unique results from parents" );
467
+ });
468
+
469
+ test("parentsUntil([String])", function() {
470
+ expect(9);
471
+
472
+ var parents = jQuery("#groups").parents();
473
+
474
+ deepEqual( jQuery("#groups").parentsUntil().get(), parents.get(), "parentsUntil with no selector (nextAll)" );
475
+ deepEqual( jQuery("#groups").parentsUntil(".foo").get(), parents.get(), "parentsUntil with invalid selector (nextAll)" );
476
+ deepEqual( jQuery("#groups").parentsUntil("#html").get(), parents.not(":last").get(), "Simple parentsUntil check" );
477
+ equal( jQuery("#groups").parentsUntil("#ap").length, 0, "Simple parentsUntil check" );
478
+ deepEqual( jQuery("#groups").parentsUntil("#html, #body").get(), parents.slice( 0, 3 ).get(), "Less simple parentsUntil check" );
479
+ deepEqual( jQuery("#groups").parentsUntil("#html", "div").get(), jQuery("#qunit-fixture").get(), "Filtered parentsUntil check" );
480
+ deepEqual( jQuery("#groups").parentsUntil("#html", "p,div,dl").get(), parents.slice( 0, 3 ).get(), "Multiple-filtered parentsUntil check" );
481
+ equal( jQuery("#groups").parentsUntil("#html", "span").length, 0, "Filtered parentsUntil check, no match" );
482
+ deepEqual( jQuery("#groups, #ap").parentsUntil("#html", "p,div,dl").get(), parents.slice( 0, 3 ).get(), "Multi-source, multiple-filtered parentsUntil check" );
483
+ });
484
+
485
+ test("next([String])", function() {
486
+ expect(5);
487
+ equal( jQuery("#ap").next()[0].id, "foo", "Simple next check" );
488
+ equal( jQuery("#ap").next("div")[0].id, "foo", "Filtered next check" );
489
+ equal( jQuery("#ap").next("p").length, 0, "Filtered next check, no match" );
490
+ equal( jQuery("#ap").next("div, p")[0].id, "foo", "Multiple filters" );
491
+ equal( jQuery("body").next().length, 0, "Simple next check, no match" );
492
+ });
493
+
494
+ test("prev([String])", function() {
495
+ expect(4);
496
+ equal( jQuery("#foo").prev()[0].id, "ap", "Simple prev check" );
497
+ equal( jQuery("#foo").prev("p")[0].id, "ap", "Filtered prev check" );
498
+ equal( jQuery("#foo").prev("div").length, 0, "Filtered prev check, no match" );
499
+ equal( jQuery("#foo").prev("p, div")[0].id, "ap", "Multiple filters" );
500
+ });
501
+
502
+ test("nextAll([String])", function() {
503
+ expect(4);
504
+
505
+ var elems = jQuery("#form").children();
506
+
507
+ deepEqual( jQuery("#label-for").nextAll().get(), elems.not(":first").get(), "Simple nextAll check" );
508
+ deepEqual( jQuery("#label-for").nextAll("input").get(), elems.not(":first").filter("input").get(), "Filtered nextAll check" );
509
+ deepEqual( jQuery("#label-for").nextAll("input,select").get(), elems.not(":first").filter("input,select").get(), "Multiple-filtered nextAll check" );
510
+ deepEqual( jQuery("#label-for, #hidden1").nextAll("input,select").get(), elems.not(":first").filter("input,select").get(), "Multi-source, multiple-filtered nextAll check" );
511
+ });
512
+
513
+ test("prevAll([String])", function() {
514
+ expect(4);
515
+
516
+ var elems = jQuery( jQuery("#form").children().slice(0, 12).get().reverse() );
517
+
518
+ deepEqual( jQuery("#area1").prevAll().get(), elems.get(), "Simple prevAll check" );
519
+ deepEqual( jQuery("#area1").prevAll("input").get(), elems.filter("input").get(), "Filtered prevAll check" );
520
+ deepEqual( jQuery("#area1").prevAll("input,select").get(), elems.filter("input,select").get(), "Multiple-filtered prevAll check" );
521
+ deepEqual( jQuery("#area1, #hidden1").prevAll("input,select").get(), elems.filter("input,select").get(), "Multi-source, multiple-filtered prevAll check" );
522
+ });
523
+
524
+ test("nextUntil([String])", function() {
525
+ expect(11);
526
+
527
+ var elems = jQuery("#form").children().slice( 2, 12 );
528
+
529
+ deepEqual( jQuery("#text1").nextUntil().get(), jQuery("#text1").nextAll().get(), "nextUntil with no selector (nextAll)" );
530
+ deepEqual( jQuery("#text1").nextUntil(".foo").get(), jQuery("#text1").nextAll().get(), "nextUntil with invalid selector (nextAll)" );
531
+ deepEqual( jQuery("#text1").nextUntil("#area1").get(), elems.get(), "Simple nextUntil check" );
532
+ equal( jQuery("#text1").nextUntil("#text2").length, 0, "Simple nextUntil check" );
533
+ deepEqual( jQuery("#text1").nextUntil("#area1, #radio1").get(), jQuery("#text1").next().get(), "Less simple nextUntil check" );
534
+ deepEqual( jQuery("#text1").nextUntil("#area1", "input").get(), elems.not("button").get(), "Filtered nextUntil check" );
535
+ deepEqual( jQuery("#text1").nextUntil("#area1", "button").get(), elems.not("input").get(), "Filtered nextUntil check" );
536
+ deepEqual( jQuery("#text1").nextUntil("#area1", "button,input").get(), elems.get(), "Multiple-filtered nextUntil check" );
537
+ equal( jQuery("#text1").nextUntil("#area1", "div").length, 0, "Filtered nextUntil check, no match" );
538
+ deepEqual( jQuery("#text1, #hidden1").nextUntil("#area1", "button,input").get(), elems.get(), "Multi-source, multiple-filtered nextUntil check" );
539
+
540
+ deepEqual( jQuery("#text1").nextUntil("[class=foo]").get(), jQuery("#text1").nextAll().get(), "Non-element nodes must be skipped, since they have no attributes" );
541
+ });
542
+
543
+ test("prevUntil([String])", function() {
544
+ expect(10);
545
+
546
+ var elems = jQuery("#area1").prevAll();
547
+
548
+ deepEqual( jQuery("#area1").prevUntil().get(), elems.get(), "prevUntil with no selector (prevAll)" );
549
+ deepEqual( jQuery("#area1").prevUntil(".foo").get(), elems.get(), "prevUntil with invalid selector (prevAll)" );
550
+ deepEqual( jQuery("#area1").prevUntil("label").get(), elems.not(":last").get(), "Simple prevUntil check" );
551
+ equal( jQuery("#area1").prevUntil("#button").length, 0, "Simple prevUntil check" );
552
+ deepEqual( jQuery("#area1").prevUntil("label, #search").get(), jQuery("#area1").prev().get(), "Less simple prevUntil check" );
553
+ deepEqual( jQuery("#area1").prevUntil("label", "input").get(), elems.not(":last").not("button").get(), "Filtered prevUntil check" );
554
+ deepEqual( jQuery("#area1").prevUntil("label", "button").get(), elems.not(":last").not("input").get(), "Filtered prevUntil check" );
555
+ deepEqual( jQuery("#area1").prevUntil("label", "button,input").get(), elems.not(":last").get(), "Multiple-filtered prevUntil check" );
556
+ equal( jQuery("#area1").prevUntil("label", "div").length, 0, "Filtered prevUntil check, no match" );
557
+ deepEqual( jQuery("#area1, #hidden1").prevUntil("label", "button,input").get(), elems.not(":last").get(), "Multi-source, multiple-filtered prevUntil check" );
558
+ });
559
+
560
+ test("contents()", function() {
561
+ expect(12);
562
+ equal( jQuery("#ap").contents().length, 9, "Check element contents" );
563
+ ok( jQuery("#iframe").contents()[0], "Check existance of IFrame document" );
564
+ var ibody = jQuery("#loadediframe").contents()[0].body;
565
+ ok( ibody, "Check existance of IFrame body" );
566
+
567
+ equal( jQuery("span", ibody).text(), "span text", "Find span in IFrame and check its text" );
568
+
569
+ jQuery(ibody).append("<div>init text</div>");
570
+ equal( jQuery("div", ibody).length, 2, "Check the original div and the new div are in IFrame" );
571
+
572
+ equal( jQuery("div:last", ibody).text(), "init text", "Add text to div in IFrame" );
573
+
574
+ jQuery("div:last", ibody).text("div text");
575
+ equal( jQuery("div:last", ibody).text(), "div text", "Add text to div in IFrame" );
576
+
577
+ jQuery("div:last", ibody).remove();
578
+ equal( jQuery("div", ibody).length, 1, "Delete the div and check only one div left in IFrame" );
579
+
580
+ equal( jQuery("div", ibody).text(), "span text", "Make sure the correct div is still left after deletion in IFrame" );
581
+
582
+ jQuery("<table/>", ibody).append("<tr><td>cell</td></tr>").appendTo(ibody);
583
+ jQuery("table", ibody).remove();
584
+ equal( jQuery("div", ibody).length, 1, "Check for JS error on add and delete of a table in IFrame" );
585
+
586
+ // using contents will get comments regular, text, and comment nodes
587
+ var c = jQuery("#nonnodes").contents().contents();
588
+ equal( c.length, 1, "Check node,textnode,comment contents is just one" );
589
+ equal( c[0].nodeValue, "hi", "Check node,textnode,comment contents is just the one from span" );
590
+ });
591
+
592
+ test("add(String|Element|Array|undefined)", function() {
593
+ expect( 15 );
594
+ deepEqual( jQuery("#sndp").add("#en").add("#sap").get(), q("sndp", "en", "sap"), "Check elements from document" );
595
+ deepEqual( jQuery("#sndp").add( jQuery("#en")[0] ).add( jQuery("#sap") ).get(), q("sndp", "en", "sap"), "Check elements from document" );
596
+
597
+ // We no longer support .add(form.elements), unfortunately.
598
+ // There is no way, in browsers, to reliably determine the difference
599
+ // between form.elements and form - and doing .add(form) and having it
600
+ // add the form elements is way to unexpected, so this gets the boot.
601
+ // ok( jQuery([]).add(jQuery("#form")[0].elements).length >= 13, "Check elements from array" );
602
+
603
+ // For the time being, we're discontinuing support for jQuery(form.elements) since it's ambiguous in IE
604
+ // use jQuery([]).add(form.elements) instead.
605
+ //equal( jQuery([]).add(jQuery("#form")[0].elements).length, jQuery(jQuery("#form")[0].elements).length, "Array in constructor must equals array in add()" );
606
+
607
+ var divs = jQuery("<div/>").add("#sndp");
608
+ ok( divs[0].parentNode, "Sort with the disconnected node last (started with disconnected first)." );
609
+
610
+ divs = jQuery("#sndp").add("<div/>");
611
+ ok( !divs[1].parentNode, "Sort with the disconnected node last." );
612
+
613
+ var tmp = jQuery("<div/>");
614
+
615
+ var x = jQuery([]).add(jQuery("<p id='x1'>xxx</p>").appendTo(tmp)).add(jQuery("<p id='x2'>xxx</p>").appendTo(tmp));
616
+ equal( x[0].id, "x1", "Check on-the-fly element1" );
617
+ equal( x[1].id, "x2", "Check on-the-fly element2" );
618
+
619
+ x = jQuery([]).add(jQuery("<p id='x1'>xxx</p>").appendTo(tmp)[0]).add(jQuery("<p id='x2'>xxx</p>").appendTo(tmp)[0]);
620
+ equal( x[0].id, "x1", "Check on-the-fly element1" );
621
+ equal( x[1].id, "x2", "Check on-the-fly element2" );
622
+
623
+ x = jQuery([]).add(jQuery("<p id='x1'>xxx</p>")).add(jQuery("<p id='x2'>xxx</p>"));
624
+ equal( x[0].id, "x1", "Check on-the-fly element1" );
625
+ equal( x[1].id, "x2", "Check on-the-fly element2" );
626
+
627
+ x = jQuery([]).add("<p id='x1'>xxx</p>").add("<p id='x2'>xxx</p>");
628
+ equal( x[0].id, "x1", "Check on-the-fly element1" );
629
+ equal( x[1].id, "x2", "Check on-the-fly element2" );
630
+
631
+ var notDefined;
632
+ equal( jQuery([]).add(notDefined).length, 0, "Check that undefined adds nothing" );
633
+
634
+ equal( jQuery([]).add( document.getElementById("form") ).length, 1, "Add a form" );
635
+ equal( jQuery([]).add( document.getElementById("select1") ).length, 1, "Add a select" );
636
+ });
637
+
638
+ test("add(String, Context)", function() {
639
+ expect(6);
640
+
641
+ deepEqual( jQuery( "#firstp" ).add( "#ap" ).get(), q( "firstp", "ap" ), "Add selector to selector " );
642
+ deepEqual( jQuery( document.getElementById("firstp") ).add( "#ap" ).get(), q( "firstp", "ap" ), "Add gEBId to selector" );
643
+ deepEqual( jQuery( document.getElementById("firstp") ).add( document.getElementById("ap") ).get(), q( "firstp", "ap" ), "Add gEBId to gEBId" );
644
+
645
+ var ctx = document.getElementById("firstp");
646
+ deepEqual( jQuery( "#firstp" ).add( "#ap", ctx ).get(), q( "firstp" ), "Add selector to selector " );
647
+ deepEqual( jQuery( document.getElementById("firstp") ).add( "#ap", ctx ).get(), q( "firstp" ), "Add gEBId to selector, not in context" );
648
+ deepEqual( jQuery( document.getElementById("firstp") ).add( "#ap", document.getElementsByTagName("body")[0] ).get(), q( "firstp", "ap" ), "Add gEBId to selector, in context" );
649
+ });
650
+
651
+ test("eq('-1') #10616", function() {
652
+ expect(3);
653
+ var $divs = jQuery( "div" );
654
+
655
+ equal( $divs.eq( -1 ).length, 1, "The number -1 returns a selection that has length 1" );
656
+ equal( $divs.eq( "-1" ).length, 1, "The string '-1' returns a selection that has length 1" );
657
+ deepEqual( $divs.eq( "-1" ), $divs.eq( -1 ), "String and number -1 match" );
658
+ });
659
+
660
+ test("index(no arg) #10977", function() {
661
+ expect(1);
662
+
663
+ var $list = jQuery("<ul id='indextest'><li>THIS ONE</li><li class='one'>a</li><li class='two'>b</li><li class='three'>c</li></ul>");
664
+ jQuery("#qunit-fixture").append( $list );
665
+ strictEqual ( jQuery( "#indextest li:not(.one,.two)" ).index() , 0, "No Argument Index Check" );
666
+ $list.remove();
667
+ });