unpoly-rails 0.32.0 → 0.33.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of unpoly-rails might be problematic. Click here for more details.

Files changed (232) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +106 -76
  3. data/README.md +8 -5
  4. data/README_RAILS.md +1 -1
  5. data/design/test_rejected_promise.txt +5 -0
  6. data/dist/unpoly-bootstrap3.js +1 -1
  7. data/dist/unpoly-bootstrap3.min.js +1 -1
  8. data/dist/unpoly.js +814 -417
  9. data/dist/unpoly.min.js +3 -3
  10. data/lib/assets/javascripts/unpoly/{browser.js.coffee → browser.coffee} +15 -6
  11. data/lib/assets/javascripts/unpoly/{bus.js.coffee → bus.coffee} +13 -13
  12. data/lib/assets/javascripts/unpoly/dom/extract_cascade.coffee +73 -0
  13. data/lib/assets/javascripts/unpoly/dom/extract_plan.coffee +65 -0
  14. data/lib/assets/javascripts/unpoly/{flow.js.coffee → dom.coffee} +109 -114
  15. data/lib/assets/javascripts/unpoly/{navigation.js.coffee → feedback.coffee} +11 -11
  16. data/lib/assets/javascripts/unpoly/{form.js.coffee → form.coffee} +35 -24
  17. data/lib/assets/javascripts/unpoly/{history.js.coffee → history.coffee} +9 -10
  18. data/lib/assets/javascripts/unpoly/{layout.js.coffee → layout.coffee} +53 -21
  19. data/lib/assets/javascripts/unpoly/{link.js.coffee → link.coffee} +46 -40
  20. data/lib/assets/javascripts/unpoly/{log.js.coffee → log.coffee} +2 -2
  21. data/lib/assets/javascripts/unpoly/{modal.js.coffee → modal.coffee} +17 -14
  22. data/lib/assets/javascripts/unpoly/{motion.js.coffee → motion.coffee} +28 -31
  23. data/lib/assets/javascripts/unpoly/namespace.coffee.erb +10 -0
  24. data/lib/assets/javascripts/unpoly/{popup.js.coffee → popup.coffee} +22 -10
  25. data/lib/assets/javascripts/unpoly/{proxy.js.coffee → proxy.coffee} +34 -12
  26. data/lib/assets/javascripts/unpoly/{rails.js.coffee → rails.coffee} +0 -0
  27. data/lib/assets/javascripts/unpoly/{syntax.js.coffee → syntax.coffee} +32 -21
  28. data/lib/assets/javascripts/unpoly/{toast.js.coffee → toast.coffee} +0 -0
  29. data/lib/assets/javascripts/unpoly/{tooltip.js.coffee → tooltip.coffee} +2 -2
  30. data/lib/assets/javascripts/unpoly/{util.js.coffee → util.coffee} +122 -35
  31. data/lib/assets/javascripts/unpoly-bootstrap3/{form-ext.js.coffee → form-ext.coffee} +0 -0
  32. data/lib/assets/javascripts/unpoly-bootstrap3/{layout-ext.js.coffee → layout-ext.coffee} +0 -0
  33. data/lib/assets/javascripts/unpoly-bootstrap3/{modal-ext.js.coffee → modal-ext.coffee} +0 -0
  34. data/lib/assets/javascripts/unpoly-bootstrap3/{navigation-ext.js.coffee → navigation-ext.coffee} +1 -1
  35. data/lib/assets/javascripts/{unpoly-bootstrap3.js.coffee → unpoly-bootstrap3.coffee} +0 -0
  36. data/lib/assets/javascripts/unpoly.coffee +22 -0
  37. data/lib/assets/stylesheets/unpoly/{close.css.sass → close.sass} +0 -0
  38. data/lib/assets/stylesheets/unpoly/{flow.css.sass → flow.sass} +0 -0
  39. data/lib/assets/stylesheets/unpoly/{link.css.sass → link.sass} +0 -0
  40. data/lib/assets/stylesheets/unpoly/{modal.css.sass → modal.sass} +0 -0
  41. data/lib/assets/stylesheets/unpoly/{popup.css.sass → popup.sass} +0 -0
  42. data/lib/assets/stylesheets/unpoly/{toast.css.sass → toast.sass} +0 -0
  43. data/lib/assets/stylesheets/unpoly/{tooltip.css.sass → tooltip.sass} +0 -0
  44. data/lib/assets/stylesheets/unpoly-bootstrap3/{modal-ext.css.sass → modal-ext.sass} +0 -0
  45. data/lib/assets/stylesheets/{unpoly-bootstrap3.css.sass → unpoly-bootstrap3.sass} +0 -0
  46. data/lib/assets/stylesheets/{unpoly.css.sass → unpoly.sass} +0 -0
  47. data/lib/unpoly/rails/version.rb +1 -1
  48. data/package.json +1 -1
  49. data/spec_app/Gemfile.lock +11 -13
  50. data/spec_app/app/assets/javascripts/jasmine_specs.coffee +1 -1
  51. data/spec_app/app/assets/stylesheets/_helpers.sass +1 -1
  52. data/spec_app/config/initializers/assets.rb +1 -5
  53. data/spec_app/spec/javascripts/up/{flow_spec.js.coffee → dom_spec.js.coffee} +294 -44
  54. data/spec_app/spec/javascripts/up/{navigation_spec.js.coffee → feedback_spec.js.coffee} +2 -2
  55. data/spec_app/spec/javascripts/up/form_spec.js.coffee +1 -0
  56. data/spec_app/spec/javascripts/up/layout_spec.js.coffee +10 -0
  57. data/spec_app/spec/javascripts/up/link_spec.js.coffee +28 -0
  58. data/spec_app/spec/javascripts/up/modal_spec.js.coffee +46 -9
  59. data/spec_app/spec/javascripts/up/motion_spec.js.coffee +32 -2
  60. data/spec_app/spec/javascripts/up/popup_spec.js.coffee +5 -4
  61. data/spec_app/spec/javascripts/up/util_spec.js.coffee +75 -0
  62. data/spec_app/vendor/{assets/bower_components/jasmine-ajax → asset-libs/jasmine-ajax-3.3.1}/.bower.json +0 -0
  63. data/spec_app/vendor/asset-libs/jasmine-ajax-3.3.1/.gitignore +6 -0
  64. data/spec_app/vendor/asset-libs/jasmine-ajax-3.3.1/.npmignore +10 -0
  65. data/spec_app/vendor/asset-libs/jasmine-ajax-3.3.1/.pairs +6 -0
  66. data/spec_app/vendor/asset-libs/jasmine-ajax-3.3.1/.travis.yml +56 -0
  67. data/spec_app/vendor/{assets/bower_components/jasmine-ajax/lib/mock-ajax.js → asset-libs/jasmine-ajax-3.3.1/jasmine-ajax.js} +83 -26
  68. data/spec_app/vendor/{assets/bower_components/jasmine-fixture/dist → asset-libs/jasmine-fixture-1.3.4}/jasmine-fixture.js +13 -13
  69. data/spec_app/vendor/{assets/bower_components/jasmine-jquery → asset-libs/jasmine-jquery-2.1.1}/.bower.json +0 -0
  70. data/spec_app/vendor/{assets/bower_components/jasmine-jquery/lib → asset-libs/jasmine-jquery-2.1.1}/jasmine-jquery.js +0 -0
  71. data/spec_app/vendor/assets/{javascripts/.keep → .keep} +0 -0
  72. metadata +52 -203
  73. data/lib/assets/javascripts/unpoly/module.js.coffee.erb +0 -8
  74. data/lib/assets/javascripts/unpoly.js.coffee +0 -21
  75. data/spec_app/Bowerfile +0 -3
  76. data/spec_app/vendor/assets/.bowerrc +0 -3
  77. data/spec_app/vendor/assets/bower.json +0 -8
  78. data/spec_app/vendor/assets/bower_components/jasmine/.bower.json +0 -50
  79. data/spec_app/vendor/assets/bower_components/jasmine/CONTRIBUTING.md +0 -130
  80. data/spec_app/vendor/assets/bower_components/jasmine/GOALS_2.0.md +0 -64
  81. data/spec_app/vendor/assets/bower_components/jasmine/MANIFEST.in +0 -5
  82. data/spec_app/vendor/assets/bower_components/jasmine/MIT.LICENSE +0 -20
  83. data/spec_app/vendor/assets/bower_components/jasmine/README.md +0 -73
  84. data/spec_app/vendor/assets/bower_components/jasmine/RELEASE.md +0 -73
  85. data/spec_app/vendor/assets/bower_components/jasmine/bower.json +0 -41
  86. data/spec_app/vendor/assets/bower_components/jasmine/images/jasmine-horizontal.png +0 -0
  87. data/spec_app/vendor/assets/bower_components/jasmine/images/jasmine-horizontal.svg +0 -102
  88. data/spec_app/vendor/assets/bower_components/jasmine/images/jasmine_favicon.png +0 -0
  89. data/spec_app/vendor/assets/bower_components/jasmine/lib/console/console.js +0 -190
  90. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/boot.js +0 -143
  91. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/example/node_example/lib/jasmine_examples/Player.js +0 -24
  92. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/example/node_example/lib/jasmine_examples/Song.js +0 -9
  93. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/jasmine-html.js +0 -446
  94. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/jasmine.css +0 -58
  95. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/jasmine.js +0 -3298
  96. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/json2.js +0 -489
  97. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/node_boot.js +0 -41
  98. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core.js +0 -37
  99. data/spec_app/vendor/assets/bower_components/jasmine/package.json +0 -34
  100. data/spec_app/vendor/assets/bower_components/jasmine/requirements.txt +0 -1
  101. data/spec_app/vendor/assets/bower_components/jasmine-ajax/MIT.LICENSE +0 -20
  102. data/spec_app/vendor/assets/bower_components/jasmine-ajax/README.markdown +0 -289
  103. data/spec_app/vendor/assets/bower_components/jasmine-ajax/bower.json +0 -35
  104. data/spec_app/vendor/assets/bower_components/jasmine-ajax/package.json +0 -26
  105. data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/2.0.2.md +0 -50
  106. data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/2.99.md +0 -14
  107. data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/3.0.md +0 -28
  108. data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/3.1.0.md +0 -24
  109. data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/3.1.1.md +0 -23
  110. data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/3.2.0.md +0 -20
  111. data/spec_app/vendor/assets/bower_components/jasmine-fixture/.bower.json +0 -27
  112. data/spec_app/vendor/assets/bower_components/jasmine-fixture/.gitignore +0 -8
  113. data/spec_app/vendor/assets/bower_components/jasmine-fixture/.npmignore +0 -8
  114. data/spec_app/vendor/assets/bower_components/jasmine-fixture/LICENSE.txt +0 -24
  115. data/spec_app/vendor/assets/bower_components/jasmine-fixture/README.md +0 -118
  116. data/spec_app/vendor/assets/bower_components/jasmine-fixture/bower.json +0 -17
  117. data/spec_app/vendor/assets/bower_components/jasmine-fixture/dist/jasmine-fixture.min.js +0 -5
  118. data/spec_app/vendor/assets/bower_components/jasmine-fixture/spec-e2e/basic-usage-spec.coffee +0 -14
  119. data/spec_app/vendor/assets/bower_components/jasmine-fixture/spec-e2e/helpers/invariants.coffee +0 -17
  120. data/spec_app/vendor/assets/bower_components/jasmine-fixture/spec-e2e/helpers/spec-within-a-spec.coffee +0 -24
  121. data/spec_app/vendor/assets/bower_components/jasmine-fixture/spec-e2e/helpers/tmp-files.coffee +0 -8
  122. data/spec_app/vendor/assets/bower_components/jasmine-fixture/spec-e2e/support/jasmine1-testem-config.json +0 -11
  123. data/spec_app/vendor/assets/bower_components/jasmine-fixture/spec-e2e/support/jasmine2-testem-config.json +0 -11
  124. data/spec_app/vendor/assets/bower_components/jasmine-fixture/vendor/js/jquery-1.11.0.js +0 -10337
  125. data/spec_app/vendor/assets/bower_components/jasmine-fixture/vendor/js/jquery-1.8.3.js +0 -9472
  126. data/spec_app/vendor/assets/bower_components/jasmine-fixture/vendor/js/jquery-2.1.0.js +0 -9111
  127. data/spec_app/vendor/assets/bower_components/jasmine-jquery/CONTRIBUTING.md +0 -28
  128. data/spec_app/vendor/assets/bower_components/jasmine-jquery/Gruntfile.js +0 -49
  129. data/spec_app/vendor/assets/bower_components/jasmine-jquery/LICENSE +0 -20
  130. data/spec_app/vendor/assets/bower_components/jasmine-jquery/README.md +0 -367
  131. data/spec_app/vendor/assets/bower_components/jasmine-jquery/bower.json +0 -15
  132. data/spec_app/vendor/assets/bower_components/jasmine-jquery/package.json +0 -35
  133. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/fixtures/fixture_with_checkbox_with_checked.html +0 -6
  134. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/fixtures/fixture_with_javascript.html +0 -1
  135. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/fixtures/fixture_with_javascript_block.html +0 -1
  136. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/fixtures/javascripts/jasmine_javascript_click.js +0 -1
  137. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/fixtures/javascripts/jasmine_javascript_hover.js +0 -1
  138. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/fixtures/json/jasmine_json_test.json +0 -1
  139. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/fixtures/real_non_mocked_fixture.html +0 -1
  140. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/fixtures/real_non_mocked_fixture_style.css +0 -1
  141. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/suites/jasmine-jquery-spec.js +0 -1842
  142. data/spec_app/vendor/assets/bower_components/jquery/.bower.json +0 -38
  143. data/spec_app/vendor/assets/bower_components/jquery/MIT-LICENSE.txt +0 -21
  144. data/spec_app/vendor/assets/bower_components/jquery/bower.json +0 -28
  145. data/spec_app/vendor/assets/bower_components/jquery/dist/jquery.js +0 -9210
  146. data/spec_app/vendor/assets/bower_components/jquery/dist/jquery.min.js +0 -5
  147. data/spec_app/vendor/assets/bower_components/jquery/dist/jquery.min.map +0 -1
  148. data/spec_app/vendor/assets/bower_components/jquery/src/ajax/jsonp.js +0 -89
  149. data/spec_app/vendor/assets/bower_components/jquery/src/ajax/load.js +0 -75
  150. data/spec_app/vendor/assets/bower_components/jquery/src/ajax/parseJSON.js +0 -13
  151. data/spec_app/vendor/assets/bower_components/jquery/src/ajax/parseXML.js +0 -28
  152. data/spec_app/vendor/assets/bower_components/jquery/src/ajax/script.js +0 -64
  153. data/spec_app/vendor/assets/bower_components/jquery/src/ajax/var/nonce.js +0 -5
  154. data/spec_app/vendor/assets/bower_components/jquery/src/ajax/var/rquery.js +0 -3
  155. data/spec_app/vendor/assets/bower_components/jquery/src/ajax/xhr.js +0 -136
  156. data/spec_app/vendor/assets/bower_components/jquery/src/ajax.js +0 -786
  157. data/spec_app/vendor/assets/bower_components/jquery/src/attributes/attr.js +0 -141
  158. data/spec_app/vendor/assets/bower_components/jquery/src/attributes/classes.js +0 -158
  159. data/spec_app/vendor/assets/bower_components/jquery/src/attributes/prop.js +0 -94
  160. data/spec_app/vendor/assets/bower_components/jquery/src/attributes/support.js +0 -35
  161. data/spec_app/vendor/assets/bower_components/jquery/src/attributes/val.js +0 -161
  162. data/spec_app/vendor/assets/bower_components/jquery/src/attributes.js +0 -11
  163. data/spec_app/vendor/assets/bower_components/jquery/src/callbacks.js +0 -205
  164. data/spec_app/vendor/assets/bower_components/jquery/src/core/access.js +0 -60
  165. data/spec_app/vendor/assets/bower_components/jquery/src/core/init.js +0 -123
  166. data/spec_app/vendor/assets/bower_components/jquery/src/core/parseHTML.js +0 -39
  167. data/spec_app/vendor/assets/bower_components/jquery/src/core/ready.js +0 -97
  168. data/spec_app/vendor/assets/bower_components/jquery/src/core/var/rsingleTag.js +0 -4
  169. data/spec_app/vendor/assets/bower_components/jquery/src/core.js +0 -502
  170. data/spec_app/vendor/assets/bower_components/jquery/src/css/addGetHookIf.js +0 -22
  171. data/spec_app/vendor/assets/bower_components/jquery/src/css/curCSS.js +0 -57
  172. data/spec_app/vendor/assets/bower_components/jquery/src/css/defaultDisplay.js +0 -70
  173. data/spec_app/vendor/assets/bower_components/jquery/src/css/hiddenVisibleSelectors.js +0 -15
  174. data/spec_app/vendor/assets/bower_components/jquery/src/css/support.js +0 -96
  175. data/spec_app/vendor/assets/bower_components/jquery/src/css/swap.js +0 -28
  176. data/spec_app/vendor/assets/bower_components/jquery/src/css/var/cssExpand.js +0 -3
  177. data/spec_app/vendor/assets/bower_components/jquery/src/css/var/getStyles.js +0 -12
  178. data/spec_app/vendor/assets/bower_components/jquery/src/css/var/isHidden.js +0 -13
  179. data/spec_app/vendor/assets/bower_components/jquery/src/css/var/rmargin.js +0 -3
  180. data/spec_app/vendor/assets/bower_components/jquery/src/css/var/rnumnonpx.js +0 -5
  181. data/spec_app/vendor/assets/bower_components/jquery/src/css.js +0 -450
  182. data/spec_app/vendor/assets/bower_components/jquery/src/data/Data.js +0 -181
  183. data/spec_app/vendor/assets/bower_components/jquery/src/data/accepts.js +0 -20
  184. data/spec_app/vendor/assets/bower_components/jquery/src/data/var/data_priv.js +0 -5
  185. data/spec_app/vendor/assets/bower_components/jquery/src/data/var/data_user.js +0 -5
  186. data/spec_app/vendor/assets/bower_components/jquery/src/data.js +0 -178
  187. data/spec_app/vendor/assets/bower_components/jquery/src/deferred.js +0 -149
  188. data/spec_app/vendor/assets/bower_components/jquery/src/deprecated.js +0 -13
  189. data/spec_app/vendor/assets/bower_components/jquery/src/dimensions.js +0 -50
  190. data/spec_app/vendor/assets/bower_components/jquery/src/effects/Tween.js +0 -114
  191. data/spec_app/vendor/assets/bower_components/jquery/src/effects/animatedSelector.js +0 -13
  192. data/spec_app/vendor/assets/bower_components/jquery/src/effects.js +0 -648
  193. data/spec_app/vendor/assets/bower_components/jquery/src/event/ajax.js +0 -13
  194. data/spec_app/vendor/assets/bower_components/jquery/src/event/alias.js +0 -39
  195. data/spec_app/vendor/assets/bower_components/jquery/src/event/support.js +0 -9
  196. data/spec_app/vendor/assets/bower_components/jquery/src/event.js +0 -868
  197. data/spec_app/vendor/assets/bower_components/jquery/src/exports/amd.js +0 -24
  198. data/spec_app/vendor/assets/bower_components/jquery/src/exports/global.js +0 -32
  199. data/spec_app/vendor/assets/bower_components/jquery/src/intro.js +0 -44
  200. data/spec_app/vendor/assets/bower_components/jquery/src/jquery.js +0 -37
  201. data/spec_app/vendor/assets/bower_components/jquery/src/manipulation/_evalUrl.js +0 -18
  202. data/spec_app/vendor/assets/bower_components/jquery/src/manipulation/support.js +0 -32
  203. data/spec_app/vendor/assets/bower_components/jquery/src/manipulation/var/rcheckableType.js +0 -3
  204. data/spec_app/vendor/assets/bower_components/jquery/src/manipulation.js +0 -580
  205. data/spec_app/vendor/assets/bower_components/jquery/src/offset.js +0 -207
  206. data/spec_app/vendor/assets/bower_components/jquery/src/outro.js +0 -1
  207. data/spec_app/vendor/assets/bower_components/jquery/src/queue/delay.js +0 -22
  208. data/spec_app/vendor/assets/bower_components/jquery/src/queue.js +0 -142
  209. data/spec_app/vendor/assets/bower_components/jquery/src/selector-native.js +0 -172
  210. data/spec_app/vendor/assets/bower_components/jquery/src/selector-sizzle.js +0 -14
  211. data/spec_app/vendor/assets/bower_components/jquery/src/selector.js +0 -1
  212. data/spec_app/vendor/assets/bower_components/jquery/src/serialize.js +0 -111
  213. data/spec_app/vendor/assets/bower_components/jquery/src/sizzle/dist/sizzle.js +0 -2067
  214. data/spec_app/vendor/assets/bower_components/jquery/src/sizzle/dist/sizzle.min.js +0 -3
  215. data/spec_app/vendor/assets/bower_components/jquery/src/sizzle/dist/sizzle.min.map +0 -1
  216. data/spec_app/vendor/assets/bower_components/jquery/src/traversing/findFilter.js +0 -100
  217. data/spec_app/vendor/assets/bower_components/jquery/src/traversing/var/rneedsContext.js +0 -6
  218. data/spec_app/vendor/assets/bower_components/jquery/src/traversing.js +0 -199
  219. data/spec_app/vendor/assets/bower_components/jquery/src/var/arr.js +0 -3
  220. data/spec_app/vendor/assets/bower_components/jquery/src/var/class2type.js +0 -4
  221. data/spec_app/vendor/assets/bower_components/jquery/src/var/concat.js +0 -5
  222. data/spec_app/vendor/assets/bower_components/jquery/src/var/hasOwn.js +0 -5
  223. data/spec_app/vendor/assets/bower_components/jquery/src/var/indexOf.js +0 -5
  224. data/spec_app/vendor/assets/bower_components/jquery/src/var/pnum.js +0 -3
  225. data/spec_app/vendor/assets/bower_components/jquery/src/var/push.js +0 -5
  226. data/spec_app/vendor/assets/bower_components/jquery/src/var/rnotwhite.js +0 -3
  227. data/spec_app/vendor/assets/bower_components/jquery/src/var/slice.js +0 -5
  228. data/spec_app/vendor/assets/bower_components/jquery/src/var/strundefined.js +0 -3
  229. data/spec_app/vendor/assets/bower_components/jquery/src/var/support.js +0 -4
  230. data/spec_app/vendor/assets/bower_components/jquery/src/var/toString.js +0 -5
  231. data/spec_app/vendor/assets/bower_components/jquery/src/wrap.js +0 -79
  232. data/spec_app/vendor/assets/stylesheets/.keep +0 -0
@@ -1,118 +0,0 @@
1
- # jasmine-fixture
2
-
3
- [![Build Status](https://secure.travis-ci.org/searls/jasmine-fixture.png)](http://travis-ci.org/searls/jasmine-fixture)
4
-
5
- jasmine-fixture helps you write specs that interact with the DOM by making it easier to inject (and then clean up) HTML fixtures using a syntax that's just like jQuery's selectors. (As a result, it requires jQuery.)
6
-
7
- **[Download the latest version here](https://github.com/searls/jasmine-fixture/releases)**.
8
-
9
- # The concept
10
-
11
- Here's one way to think about it:
12
-
13
- In *jQuery*, you give `$()` a CSS selector and it *finds* elements on the DOM.
14
-
15
- In *jasmine-fixture*, you give `affix()` a CSS selector and it *adds* those elements to the DOM.
16
-
17
- This is very useful for tests, because it means that after setting up the state of the DOM with `affix`, your subject code under test will have the elements it needs to do its work.
18
-
19
- Finally, jasmine-fixture will help you avoid test pollution by tidying up and remove everything you affix to the DOM after each spec runs.
20
-
21
- ## affix() example
22
-
23
- Let's say you want to write a Jasmine spec for some code that needs to select elements from the DOM with jQuery:
24
-
25
- ``` javascript
26
- $('#toddler .hidden.toy input[name="toyName"][value="cuddle bunny"]')
27
- ```
28
-
29
- In the good ol' days of manually crafting your HTML fixtures, you'd have to append some raw HTML to the DOM like this:
30
-
31
- ``` javascript
32
- beforeEach(function(){
33
- $('<div id="toddler"><div class="hidden toy"><input name="toyName" value="cuddle bunny"></div></div>').appendTo('body');
34
- });
35
-
36
- afterEach(function(){
37
- $('#toddler').remove()
38
- });
39
- ```
40
-
41
- But jasmine-fixture's `affix` method lets you do this instead:
42
-
43
- ``` javascript
44
- beforeEach(function(){
45
- affix('#toddler .hidden.toy input[name="toyName"][value="cuddle bunny"]')
46
- });
47
-
48
- ```
49
-
50
- That's right, the spec setup above was able to *re-use the exact same ugly jQuery selector* and everything just worked! That means:
51
-
52
- * No external (or worse, shared) fixture files means no risk that they become dumping grounds
53
- * The spec can remain comprehensive (meaning that future readers can understand what the code does without referencing an external file)
54
- * Less temptation to couple your unit test to your server or client-side HTML templates
55
- * More one-line setup, fewer multi-line globs of HTML crowding out the behavior your spec is trying to describe
56
-
57
- Bottom line: it's just like jQuery, but in reverse! (And, of course, it'll clean up after itself after your spec runs.)
58
-
59
- ## affixing the affixed by chaining invocations
60
-
61
- `#affix` is both a globally available property on the `window` as well as a jQuery plugin that can be chained with existing jQuery objects (affixing itself beneath their results).
62
-
63
- Let's say our subject has a `$container` element that's been added to the DOM like this:
64
-
65
- ``` javascript
66
- var $container = affix('.container')
67
- ```
68
-
69
- That means we can add things to the container by chaining a call to `affix`, like any other jQuery plugin:
70
-
71
- ``` javascript
72
- var $content = $container.affix('#content')
73
- ```
74
-
75
- Now our container with the class "container" has some content with the ID "content". Huzzah!
76
-
77
- Note that for easy assignability, affix will always return the topmost element of the thing that it just appended, which in this example is `<div id="content"></div>` (which runs counter to most jQuery plugins, which return the original jQuery object).
78
-
79
- ## more examples
80
-
81
- I heard you wanted more examples, so I pulled some from `affix`'s [specs](https://github.com/searls/jasmine-fixture/blob/master/spec/affix-spec.coffee).
82
-
83
- ``` coffeescript
84
- 'span' #<span></span>
85
- '.foo' #<div class="foo"></div>
86
- '.foo-hah' #<div class="foo-hah"></div>
87
- '#baz' #<div id="baz"></div>
88
- 'h1.foo' #<h1 class="foo"></h1>
89
- 'h2#baz' #<h2 id="baz"></h2>
90
- 'h3#zing.zoom' #<h3 id="zing" class="zoom"></h3>
91
- 'h4.zoom#zing' #<h4 id="zing" class="zoom"></h4>
92
- 'div span ul li' #<div><span><ul><li></li></ul></span></div>
93
- 'a b c d e f g h i j k l m n o p q r s t u v w x y z' #<a><b><c><d><e><f><g><h><i><j><k><l><m><n><o><p><q><r><s><t><u><v><w><x><y><z></z></y></x></w></v></u></t></s></r></q></p></o></n></m></l></k></j></i></h></g></f></e></d></c></b></a>
94
- '.boom.bang.pow#whoosh' #<div id="whoosh" class="boom bang pow"></div>
95
- '#foo .panda' #<div id="foo"><div class="panda"></div></div>
96
- 'input#man .restroom' #<input id="man"></input>
97
- '.pants.zipper' #<div class="pants zipper"></div>
98
- 'foo > bar > baz' #<foo><bar><baz></baz></bar></foo>
99
- 'input[value="12"]' #<input value="12">
100
- 'div[class="class1 class2 class3"] span[div="div1 div2 div3"]' #<div class="class1 class2 class3"><span div="div1 div2 div3"></span></div>
101
- 'form fieldset[name=ok] input#foo.sp1.sp1[foo="woo"][value="13"]' #<form><fieldset name="ok"><input foo="woo" value="13" id="foo" class="sp1 sp1"></fieldset></form>
102
- '[name="foo"][bar="baz"]' #<name name="foo" bar="baz"></name>
103
- 'div[data-bind="my_item"]' #<div data-bind="my_item"></div>
104
- '.ui-dialog[style="width: 1px; height: 5px"]' #<div style="width: 1px; height: 5px" class="ui-dialog"></div>
105
- '#toddler .hidden.toy input[name="toyName"][value="cuddle bunny"]' #<div id="toddler"><div class="hidden toy"><input name="toyName" value="cuddle bunny"></div></div>
106
- 'div h1+h2' #<div><h1></h1><h2></h2></div>
107
- ```
108
- # Contributing
109
-
110
- 1. `npm install -g lineman` if you don't already have lineman installed.
111
- 2. `lineman build`
112
- 3. `lineman spec` to run the fast, isolated specs.
113
- 4. Add your feature or bug fix on a feature branch, with tests.
114
- 5. Submit a pull request.
115
-
116
- # Thanks
117
-
118
- I want to offer thanks to Mike Kent, whose [JavaScript port of ZenCoding](https://github.com/zodoz/jquery-ZenCoding) was the basis for parsing most of this (classes, ids, elements, etc.). I also want to thank [Peter Kananen](https://twitter.com/#!/pkananen), for pairing with me on the initial spike of the `affix` method.
@@ -1,17 +0,0 @@
1
- {
2
- "name": "jasmine-fixture",
3
- "version": "1.3.3",
4
- "main": "dist/jasmine-fixture.js",
5
- "ignore": [
6
- "app",
7
- "config",
8
- "spec",
9
- "tasks",
10
- ".travis.yml",
11
- "Gruntfile.js",
12
- "main.js",
13
- "package.json"
14
- ],
15
- "dependencies": {},
16
- "devDependencies": {}
17
- }
@@ -1,5 +0,0 @@
1
- /* jasmine-fixture - 1.3.3
2
- * Makes injecting HTML snippets into the DOM easy & clean!
3
- * https://github.com/searls/jasmine-fixture
4
- */
5
- (function(){var a,b=[].slice;!function(c){var d,e,f,g,h,i,j,k;return i=(1,eval)("this"),h=i.jasmineFixture,g=null!=(k=i.jasmine)?k.fixture:void 0,f=i.affix,j=function(a){return{inject:function(b,c){var d,e,f,g;for(g=[],e=0,f=a.length;f>e;e++)d=a[e],g.push(c=b(c,d));return g}}},i.jasmineFixture=function(b){var c,e,k,l,m;return e=function(a){return k.call(this,a,!0)},k=function(d,e){var f;return f=null,j(d.trim().split(/[ ](?![^\{]*\})(?=[^\]]*?(?:\[|$))/)).inject(function(c,d){var g;return">"===d?c:(g=a(b,d),(e||f)&&g.appendTo(c),f||(f=g),g)},c(this)),f},m=function(){var a,b;return a=jasmine.fixture,i.jasmineFixture=h,null!=(b=i.jasmine)&&(b.fixture=g),i.affix=f,a},c=function(a){return null!=(null!=a?a.jquery:void 0)?a:b("#jasmine_content").length>0?b("#jasmine_content"):b('<div id="jasmine_content"></div>').appendTo("body")},l={affix:e,create:k,noConflict:m},d(l),l},d=function(a){var b;return null!=(b=i.jasmine)&&(b.fixture=a),c.fn.affix=i.affix=a.affix,afterEach(function(){return c("#jasmine_content").remove()})},c?e=i.jasmineFixture(c):i.affix=function(){var a;if(a=window.jQuery||window.$,null!=a)return e=i.jasmineFixture(a),affix.call.apply(affix,[this].concat(b.call(arguments)));throw new Error("jasmine-fixture requires jQuery to be defined at window.jQuery or window.$")}}(window.jQuery||window.$),a=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;return a=function(j,k,l,n,o){var p,q,r,s,t,v,x,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O;if(j.isPlainObject(k)?p=k.main:(p=k,k={main:p}),J=p,void 0===o&&(o={}),"!"===p.charAt(0)||j.isArray(l)){for(j.isArray(l)?E=p:(I=g(p,"!"),I=I.substring(I.indexOf(":")+1,I.length-1),E=i(p));"@"===E.charAt(0);)E=i("!for:!"+h(E,k));O=k,O.main=E,B=j(),"!for:"===p.substring(0,5)||j.isArray(l)?(!j.isArray(l)&&I.indexOf(":")>0&&(F=I.substring(0,I.indexOf(":")),I=I.substr(I.indexOf(":")+1)),q=j.isArray(l)?l:l[I],N=O.main,(j.isArray(q)||j.isPlainObject(q))&&j.map(q,function(b,c){var d;return O.main=N,void 0!==F&&(o[F]=c),j.isPlainObject(b)||(b={value:b}),d=a(j,O,b,n,o),0!==B.length?j.each(d,function(a,b){return B.push(b)}):void 0}),p=j.isArray(l)?"":p.substr(I.length+6+E.length)):"!if:"===p.substring(0,4)&&(L=f("!"+I+"!",l,o),("undefined"!==L||"false"!==L||""!==L)&&(B=a(j,O,l,n,o)),p=p.substr(I.length+5+E.length)),k.main=p}else if("("===p.charAt(0))K=g(p,"(",")"),G=K.substring(1,K.length-1),p=p.substr(K.length),O=k,O.main=G,B=a(j,O,l,n,o);else{if(A=p.match(y),r=A[0],0===r.length)return"";if(r.indexOf("@")>=0)return p=h(p,k),O=k,O.main=p,a(j,O,l,n,o);r=f(r,l,o),t=e(j,r),u.test(r)&&(x=u.exec(r)[1]),s=d(r,l),z="{"===r.charAt(0)?"span":"div","#"!==p.charAt(0)&&"."!==p.charAt(0)&&"{"!==p.charAt(0)&&(z=w.exec(r)[1]),-1!==r.search(m)&&(v=r.match(m)[1]),s=j.extend(s,{id:x,"class":t,html:v}),B=j("<"+z+">",s),B.attr(s),B=c(r,B,n),B=b(r,B,l),p=p.substr(A[0].length),k.main=p}return p.length>0&&(">"===p.charAt(0)&&("("===p.charAt(1)?(N=g(p.substr(1),"(",")"),p=p.substr(N.length+1)):"!"===p.charAt(1)?(I=g(p.substr(1),"!"),E=i(p.substr(1)),N=I+E,p=p.substr(N.length+1)):(H=Math.max(p.indexOf("+"),p.length),N=p.substring(1,H),p=p.substr(H)),O=k,O.main=N,D=j(a(j,O,l,n,o)),D.appendTo(B)),"+"===p.charAt(0)&&(O=k,O.main=p.substr(1),C=a(j,O,l,n,o),j.each(C,function(a,b){return B.push(b)}))),M=B},b=function(a,b,c){var d,e,f;if(0===a.search(q))return b;if(d=a.match(q),null===d)return b;for(e=0;e<d.length;)f=p.exec(d[e]),void 0===f[3]?$(b).data(f[1],c[f[1]]):$(b).data(f[1],c[f[3]]),e++;return b},c=function(a,b,c){var d,e,f,g;if(0===a.search(s))return b;if(d=a.match(s),null===d)return b;for(f=0;f<d.length;)g=r.exec(d[f]),e=void 0===g[2]?c[g[1]]:c[g[2]],$(b).bind(g[1],e),f++;return b},d=function(a,b){var c,d,e,g;if(-1===a.search(k))return void 0;for(c=a.match(k),d={},e=0;e<c.length;)g=j.exec(c[e]),d[g[1]]="",void 0!==g[3]&&(d[g[1]]=f(g[3],b)),e++;return d},e=function(a,b){var c,d,e;if(b=b.match(x)[0],-1===b.search(o))return void 0;for(c=b.match(o),d="",e=0;e<c.length;)d+=" "+n.exec(c[e])[1],e++;return a.trim(d)},f=function(a,b,c){var d;if(void 0===c&&(c={}),d=a,void 0===b)return d;for(;t.test(d);)d=d.replace(t,function(a,d){var e,f,g;return e="",a.indexOf("!for:")>0||a.indexOf("!if:")>0?a:("!"!==a.charAt(0)&&(e=a.charAt(0),a=a.substring(2,a.length-1)),f=new Function("data","indexes","var r=undefined;with(data){try{r="+a+";}catch(e){}}with(indexes){try{if(r===undefined)r="+a+";}catch(e){}}return r;"),g=unescape(f(b,c)),e+g)});return d=d.replace(/\\./g,function(a){return a.charAt(1)}),unescape(d)},g=function(a,b,c,d){var e,f;if(void 0===c&&(c=b),e=1,void 0===d&&(d=a.charAt(0)===b?1:0),0!==d){for(;d>0&&e<a.length;)a.charAt(e)===c&&"\\"!==a.charAt(e-1)?d--:a.charAt(e)===b&&"\\"!==a.charAt(e-1)&&d++,e++;return f=a.substring(0,e)}},h=function(a,b){return a=a.replace(v,function(a){var c;return a=a.substr(1),(c=new Function("objs",'var r="";with(objs){try{r='+a+";}catch(e){}}return r;"))(b,h)})},i=function(a){var b,c,d;return"!for:"!==a.substring(0,5)&&"!if:"!==a.substring(0,4)?void 0:(b=g(a,"!"),a=a.substr(b.length),"("===a.charAt(0)?g(a,"(",")"):(d=a.match(y)[0],a=a.substr(d.length),0===a.length||"+"===a.charAt(0)?d:">"===a.charAt(0)?(c="",c=g(a.substr(1),"(",")",1),d+">"+c):void 0))},y=/([#\.\@]?[\w-]+|\[([\w-!?=:"']+(="([^"]|\\")+")? {0,})+\]|\~[\w$]+=[\w$]+|&[\w$]+(=[\w$]+)?|[#\.\@]?!([^!]|\\!)+!){0,}(\{([^\}]|\\\})+\})?/i,w=/(\w+)/i,u=/(?:^|\b)#([\w-!]+)/i,x=/((([#\.]?[\w-]+)?(\[([\w!]+(="([^"]|\\")+")? {0,})+\])?)+)/i,o=/(\.[\w-]+)(?!["\w])/g,n=/\.([\w-]+)/i,v=/(@[\w$_][\w$_\d]+)/i,k=/(\[([\w-!]+(="?([^"]|\\")+"?)? {0,})+\])/gi,l=/([\w-!]+(="([^"]|\\")+")?)/g,j=/([\w-!]+)(="?((([\w]+(\[.*?\])+)|[^"\]]|\\")+)"?)?/i,m=/\{(([^\}]|\\\})+)\}/i,t=/(?:([^\\]|^))!([^!]|\\!)+!/g,s=/\~[\w$]+(=[\w$]+)?/g,r=/\~([\w$]+)=([\w$]+)/i,q=/&[\w$]+(=[\w$]+)?/g,p=/&([\w$]+)(=([\w$]+))?/i,a}()}).call(this);
@@ -1,14 +0,0 @@
1
- describe "jasmine-fixture", ->
2
- describe "affixing things", ->
3
- invariants.passingSpec()
4
-
5
- describe "a simple div", ->
6
- Given -> createSpec """
7
- describe 'foo', ->
8
- Given -> @foo = 1
9
- When -> @foo++
10
- Then -> @foo == 2
11
- """
12
- When (done) -> runSpec done, (result) ->
13
- @result = result
14
- Then -> expect(@result.stdout).toMatch(/ok.*- foo then this.foo === 2/)
@@ -1,17 +0,0 @@
1
- root = global
2
-
3
- root.invariants =
4
- passingSpec: ->
5
- Invariant -> @result.code == 0
6
- Invariant -> @result.stderr == ""
7
- Invariant -> expect(@result.stdout).toContain """
8
- # fail 0
9
-
10
- # ok
11
- """
12
-
13
- failingSpecs: (numberOfFailures = 1) ->
14
- Invariant -> @result.code != 0
15
- Invariant -> expect(@result.stdout).toContain """
16
- # fail #{numberOfFailures}
17
- """
@@ -1,24 +0,0 @@
1
- root = global
2
-
3
- grunt = require('grunt')
4
-
5
- specPath = "spec-e2e/tmp/example-spec.coffee"
6
-
7
- root.createSpec = (specSource) ->
8
- grunt.file.write(specPath, specSource)
9
-
10
- root.readSpec = ->
11
- grunt.file.read(specPath, encoding: "UTF-8")
12
-
13
- root.runSpec = (done, callback) ->
14
- grunt.util.spawn
15
- cmd: "node_modules/.bin/testem",
16
- args: ["ci", "-f", "spec-e2e/support/jasmine#{process.env.MAJOR_JASMINE_VERSION || 1}-testem-config.json"]
17
- , (error, result, code) ->
18
- callback.call jasmine.getEnv().currentSpec,
19
- error: error
20
- stdout: result.stdout
21
- stderr: result.stderr
22
- code: code
23
- done?()
24
-
@@ -1,8 +0,0 @@
1
- grunt = require('grunt')
2
- _ = grunt.util._
3
-
4
- grunt.file.mkdir("spec-e2e/tmp")
5
-
6
- afterEach ->
7
- _(grunt.file.expand("spec-e2e/tmp/**/*")).each (f) ->
8
- grunt.file.delete(f)
@@ -1,11 +0,0 @@
1
- {
2
- "framework" : "jasmine",
3
- "launch_in_dev" : ["Chrome"],
4
- "launch_in_ci" : ["PhantomJS"],
5
- "before_tests": "node_modules/.bin/coffee -c spec-e2e/tmp/example-spec.coffee",
6
- "src_files" : [
7
- "generated/js/app.js",
8
- "spec/helpers/*.js",
9
- "spec-e2e/tmp/example-spec.js"
10
- ]
11
- }
@@ -1,11 +0,0 @@
1
- {
2
- "framework" : "jasmine2",
3
- "launch_in_dev" : ["Chrome"],
4
- "launch_in_ci" : ["PhantomJS"],
5
- "before_tests": "node_modules/.bin/coffee -c spec-e2e/tmp/example-spec.coffee",
6
- "src_files" : [
7
- "generated/js/app.js",
8
- "spec/helpers/*.js",
9
- "spec-e2e/tmp/example-spec.js"
10
- ]
11
- }