javascriptmvc 3.0.0.pre15
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/README.markdown +15 -0
- data/Rakefile +17 -0
- data/VERSION +1 -0
- data/bin/jmvc-build +4 -0
- data/bin/jmvc-gen +4 -0
- data/bin/jmvc-get +4 -0
- data/bin/jmvc-init +4 -0
- data/bin/jmvc-update +4 -0
- data/lib/javascriptmvc.rb +97 -0
- data/lib/javascriptmvc/documentjs/README +0 -0
- data/lib/javascriptmvc/documentjs/add.js +76 -0
- data/lib/javascriptmvc/documentjs/application.js +285 -0
- data/lib/javascriptmvc/documentjs/attribute.js +61 -0
- data/lib/javascriptmvc/documentjs/baseclass.js +537 -0
- data/lib/javascriptmvc/documentjs/class.js +141 -0
- data/lib/javascriptmvc/documentjs/constructor.js +145 -0
- data/lib/javascriptmvc/documentjs/directives.js +394 -0
- data/lib/javascriptmvc/documentjs/distance.js +49 -0
- data/lib/javascriptmvc/documentjs/document +21 -0
- data/lib/javascriptmvc/documentjs/documentjs.js +76 -0
- data/lib/javascriptmvc/documentjs/file.js +55 -0
- data/lib/javascriptmvc/documentjs/function.js +112 -0
- data/lib/javascriptmvc/documentjs/jmvcdoc/images/close.png +0 -0
- data/lib/javascriptmvc/documentjs/jmvcdoc/images/download.png +0 -0
- data/lib/javascriptmvc/documentjs/jmvcdoc/images/fav-off.png +0 -0
- data/lib/javascriptmvc/documentjs/jmvcdoc/images/fav-on.png +0 -0
- data/lib/javascriptmvc/documentjs/jmvcdoc/images/favicon.ico +0 -0
- data/lib/javascriptmvc/documentjs/jmvcdoc/images/logo.png +0 -0
- data/lib/javascriptmvc/documentjs/jmvcdoc/images/pre.png +0 -0
- data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-icons_222222_256x240.png +0 -0
- data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-icons_2e83ff_256x240.png +0 -0
- data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-icons_454545_256x240.png +0 -0
- data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-icons_888888_256x240.png +0 -0
- data/lib/javascriptmvc/documentjs/jmvcdoc/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/lib/javascriptmvc/documentjs/jmvcdoc/images/video.png +0 -0
- data/lib/javascriptmvc/documentjs/jmvcdoc/production.js +552 -0
- data/lib/javascriptmvc/documentjs/jmvcdoc/style.css +354 -0
- data/lib/javascriptmvc/documentjs/jmvcdoc/summary.ejs +134 -0
- data/lib/javascriptmvc/documentjs/json.js +172 -0
- data/lib/javascriptmvc/documentjs/page.js +107 -0
- data/lib/javascriptmvc/documentjs/pair.js +302 -0
- data/lib/javascriptmvc/documentjs/prototype.js +13 -0
- data/lib/javascriptmvc/documentjs/scripts/build.js +6 -0
- data/lib/javascriptmvc/documentjs/static.js +25 -0
- data/lib/javascriptmvc/documentjs/test/docs/Something.json +1 -0
- data/lib/javascriptmvc/documentjs/test/docs/searchData.json +1 -0
- data/lib/javascriptmvc/documentjs/test/something.js +8 -0
- data/lib/javascriptmvc/documentjs/test/test.html +6 -0
- data/lib/javascriptmvc/documentjs/test_doc.html +1 -0
- data/lib/javascriptmvc/documentjs/update +5 -0
- data/lib/javascriptmvc/funcunit/README +17 -0
- data/lib/javascriptmvc/funcunit/autosuggest/auto_suggest.js +495 -0
- data/lib/javascriptmvc/funcunit/autosuggest/autosuggest.css +24 -0
- data/lib/javascriptmvc/funcunit/autosuggest/autosuggest.html +26 -0
- data/lib/javascriptmvc/funcunit/autosuggest/autosuggest.js +17 -0
- data/lib/javascriptmvc/funcunit/autosuggest/autosuggest_test.js +14 -0
- data/lib/javascriptmvc/funcunit/autosuggest/funcunit.html +15 -0
- data/lib/javascriptmvc/funcunit/build.js +54 -0
- data/lib/javascriptmvc/funcunit/drivers/selenium.js +129 -0
- data/lib/javascriptmvc/funcunit/drivers/standard.js +169 -0
- data/lib/javascriptmvc/funcunit/envjs +13 -0
- data/lib/javascriptmvc/funcunit/envjs.bat +28 -0
- data/lib/javascriptmvc/funcunit/funcunit.html +20 -0
- data/lib/javascriptmvc/funcunit/funcunit.js +1509 -0
- data/lib/javascriptmvc/funcunit/java/selenium-java-client-driver.jar +0 -0
- data/lib/javascriptmvc/funcunit/java/selenium-server.jar +0 -0
- data/lib/javascriptmvc/funcunit/qunit.html +22 -0
- data/lib/javascriptmvc/funcunit/qunit/qunit.css +119 -0
- data/lib/javascriptmvc/funcunit/qunit/qunit.js +1124 -0
- data/lib/javascriptmvc/funcunit/qunit/rhino/rhino.js +24 -0
- data/lib/javascriptmvc/funcunit/qunit/test/qunit.html +18 -0
- data/lib/javascriptmvc/funcunit/qunit/test/test.js +7 -0
- data/lib/javascriptmvc/funcunit/resources/funcunit.js +31 -0
- data/lib/javascriptmvc/funcunit/resources/jquery.js +6378 -0
- data/lib/javascriptmvc/funcunit/resources/json.js +201 -0
- data/lib/javascriptmvc/funcunit/resources/selenium_start.js +43 -0
- data/lib/javascriptmvc/funcunit/scripts/run.js +36 -0
- data/lib/javascriptmvc/funcunit/scripts/test.js +55 -0
- data/lib/javascriptmvc/funcunit/settings.js +10 -0
- data/lib/javascriptmvc/funcunit/synthetic/browsers.js +151 -0
- data/lib/javascriptmvc/funcunit/synthetic/demo.html +150 -0
- data/lib/javascriptmvc/funcunit/synthetic/demo/record.js +254 -0
- data/lib/javascriptmvc/funcunit/synthetic/drag/drag.html +41 -0
- data/lib/javascriptmvc/funcunit/synthetic/drag/drag.js +268 -0
- data/lib/javascriptmvc/funcunit/synthetic/drag/qunit.html +20 -0
- data/lib/javascriptmvc/funcunit/synthetic/drag/test/qunit/drag_test.js +195 -0
- data/lib/javascriptmvc/funcunit/synthetic/drag/test/qunit/qunit.js +7 -0
- data/lib/javascriptmvc/funcunit/synthetic/key.js +832 -0
- data/lib/javascriptmvc/funcunit/synthetic/mouse.js +291 -0
- data/lib/javascriptmvc/funcunit/synthetic/qunit.html +22 -0
- data/lib/javascriptmvc/funcunit/synthetic/recorder.html +303 -0
- data/lib/javascriptmvc/funcunit/synthetic/synthetic.html +85 -0
- data/lib/javascriptmvc/funcunit/synthetic/synthetic.js +796 -0
- data/lib/javascriptmvc/funcunit/synthetic/test/qunit/key_test.js +391 -0
- data/lib/javascriptmvc/funcunit/synthetic/test/qunit/mouse_test.js +233 -0
- data/lib/javascriptmvc/funcunit/synthetic/test/qunit/qunit.js +6 -0
- data/lib/javascriptmvc/funcunit/synthetic/test/qunit/synthetic_test.js +91 -0
- data/lib/javascriptmvc/funcunit/synthetic/test/submit.html +29 -0
- data/lib/javascriptmvc/funcunit/synthetic/test/submitted.html +3 -0
- data/lib/javascriptmvc/funcunit/template.html +18 -0
- data/lib/javascriptmvc/funcunit/test/drag.html +63 -0
- data/lib/javascriptmvc/funcunit/test/funcunit/funcunit.js +3 -0
- data/lib/javascriptmvc/funcunit/test/funcunit/funcunit_test.js +87 -0
- data/lib/javascriptmvc/funcunit/test/funcunit/open_test.js +28 -0
- data/lib/javascriptmvc/funcunit/test/funcunit/protodrag_test.js +13 -0
- data/lib/javascriptmvc/funcunit/test/funcunit/syn_test.js +41 -0
- data/lib/javascriptmvc/funcunit/test/jquery.event.drag.js +801 -0
- data/lib/javascriptmvc/funcunit/test/jquery.event.drop.js +439 -0
- data/lib/javascriptmvc/funcunit/test/jquery.js +6360 -0
- data/lib/javascriptmvc/funcunit/test/myapp.html +103 -0
- data/lib/javascriptmvc/funcunit/test/myotherapp.html +15 -0
- data/lib/javascriptmvc/funcunit/test/protodrag/dragdrop.js +974 -0
- data/lib/javascriptmvc/funcunit/test/protodrag/effects.js +1123 -0
- data/lib/javascriptmvc/funcunit/test/protodrag/funcunit_test.js +20 -0
- data/lib/javascriptmvc/funcunit/test/protodrag/myapp.html +63 -0
- data/lib/javascriptmvc/funcunit/test/protodrag/prototype.js +4874 -0
- data/lib/javascriptmvc/funcunit/test/protodrag/scriptaculous.js +68 -0
- data/lib/javascriptmvc/funcunit/update +5 -0
- data/lib/javascriptmvc/jquery/README +24 -0
- data/lib/javascriptmvc/jquery/build.js +73 -0
- data/lib/javascriptmvc/jquery/class/class.html +109 -0
- data/lib/javascriptmvc/jquery/class/class.js +627 -0
- data/lib/javascriptmvc/jquery/class/qunit.html +15 -0
- data/lib/javascriptmvc/jquery/class/test/qunit/class_test.js +146 -0
- data/lib/javascriptmvc/jquery/class/test/qunit/qunit.js +5 -0
- data/lib/javascriptmvc/jquery/class/test/qunit/test.html +20 -0
- data/lib/javascriptmvc/jquery/controller/controller.html +89 -0
- data/lib/javascriptmvc/jquery/controller/controller.js +735 -0
- data/lib/javascriptmvc/jquery/controller/history/history.html +44 -0
- data/lib/javascriptmvc/jquery/controller/history/history.js +177 -0
- data/lib/javascriptmvc/jquery/controller/qunit.html +21 -0
- data/lib/javascriptmvc/jquery/controller/subscribe/funcunit.html +21 -0
- data/lib/javascriptmvc/jquery/controller/subscribe/scripts/compress.js +6 -0
- data/lib/javascriptmvc/jquery/controller/subscribe/scripts/docs.js +6 -0
- data/lib/javascriptmvc/jquery/controller/subscribe/subscribe.html +56 -0
- data/lib/javascriptmvc/jquery/controller/subscribe/subscribe.js +27 -0
- data/lib/javascriptmvc/jquery/controller/subscribe/test/funcunit/funcunit.js +3 -0
- data/lib/javascriptmvc/jquery/controller/subscribe/test/funcunit/run.js +10 -0
- data/lib/javascriptmvc/jquery/controller/subscribe/test/funcunit/subscribe_test.js +11 -0
- data/lib/javascriptmvc/jquery/controller/subscribe/test/qunit/qunit.html +21 -0
- data/lib/javascriptmvc/jquery/controller/subscribe/test/qunit/qunit.js +9 -0
- data/lib/javascriptmvc/jquery/controller/subscribe/test/qunit/run.js +2 -0
- data/lib/javascriptmvc/jquery/controller/subscribe/test/qunit/subscribe_test.js +4 -0
- data/lib/javascriptmvc/jquery/controller/test/qunit/controller_test.js +170 -0
- data/lib/javascriptmvc/jquery/controller/test/qunit/qunit.js +9 -0
- data/lib/javascriptmvc/jquery/controller/view/qunit.html +21 -0
- data/lib/javascriptmvc/jquery/controller/view/test/qunit/controller_view_test.js +15 -0
- data/lib/javascriptmvc/jquery/controller/view/test/qunit/qunit.js +6 -0
- data/lib/javascriptmvc/jquery/controller/view/test/qunit/views/init.micro +1 -0
- data/lib/javascriptmvc/jquery/controller/view/view.js +102 -0
- data/lib/javascriptmvc/jquery/dom/closest/closest.html +23 -0
- data/lib/javascriptmvc/jquery/dom/closest/closest.js +47 -0
- data/lib/javascriptmvc/jquery/dom/closest/funcunit.html +20 -0
- data/lib/javascriptmvc/jquery/dom/closest/qunit.html +22 -0
- data/lib/javascriptmvc/jquery/dom/closest/scripts/compress.js +3 -0
- data/lib/javascriptmvc/jquery/dom/closest/scripts/doc.js +4 -0
- data/lib/javascriptmvc/jquery/dom/closest/scripts/test.js +55 -0
- data/lib/javascriptmvc/jquery/dom/closest/settings.js +40 -0
- data/lib/javascriptmvc/jquery/dom/closest/test/funcunit/funcunit.js +3 -0
- data/lib/javascriptmvc/jquery/dom/closest/test/funcunit/tests/basic.js +11 -0
- data/lib/javascriptmvc/jquery/dom/closest/test/qunit/qunit.js +4 -0
- data/lib/javascriptmvc/jquery/dom/closest/test/qunit/tests/basic.js +4 -0
- data/lib/javascriptmvc/jquery/dom/compare/compare.html +88 -0
- data/lib/javascriptmvc/jquery/dom/compare/compare.js +67 -0
- data/lib/javascriptmvc/jquery/dom/compare/qunit.html +20 -0
- data/lib/javascriptmvc/jquery/dom/compare/test/qunit/compare_test.js +19 -0
- data/lib/javascriptmvc/jquery/dom/compare/test/qunit/qunit.js +5 -0
- data/lib/javascriptmvc/jquery/dom/cookie/cookie.html +25 -0
- data/lib/javascriptmvc/jquery/dom/cookie/cookie.js +119 -0
- data/lib/javascriptmvc/jquery/dom/cookie/scripts/compress.js +6 -0
- data/lib/javascriptmvc/jquery/dom/cookie/scripts/doc.js +6 -0
- data/lib/javascriptmvc/jquery/dom/cookie/test/funcunit/cookie_test.js +11 -0
- data/lib/javascriptmvc/jquery/dom/cookie/test/funcunit/funcunit.html +21 -0
- data/lib/javascriptmvc/jquery/dom/cookie/test/funcunit/funcunit.js +3 -0
- data/lib/javascriptmvc/jquery/dom/cookie/test/funcunit/run.js +10 -0
- data/lib/javascriptmvc/jquery/dom/cookie/test/qunit/cookie_test.js +4 -0
- data/lib/javascriptmvc/jquery/dom/cookie/test/qunit/qunit.html +21 -0
- data/lib/javascriptmvc/jquery/dom/cookie/test/qunit/qunit.js +9 -0
- data/lib/javascriptmvc/jquery/dom/cookie/test/qunit/run.js +2 -0
- data/lib/javascriptmvc/jquery/dom/cur_styles/cur_styles.html +71 -0
- data/lib/javascriptmvc/jquery/dom/cur_styles/cur_styles.js +120 -0
- data/lib/javascriptmvc/jquery/dom/cur_styles/qunit.html +22 -0
- data/lib/javascriptmvc/jquery/dom/cur_styles/test/qunit/curStyles.micro +3 -0
- data/lib/javascriptmvc/jquery/dom/cur_styles/test/qunit/cur_styles_test.js +22 -0
- data/lib/javascriptmvc/jquery/dom/cur_styles/test/qunit/outer.micro +0 -0
- data/lib/javascriptmvc/jquery/dom/cur_styles/test/qunit/qunit.js +4 -0
- data/lib/javascriptmvc/jquery/dom/dimensions/curstyles.html +22 -0
- data/lib/javascriptmvc/jquery/dom/dimensions/dimensions.html +132 -0
- data/lib/javascriptmvc/jquery/dom/dimensions/dimensions.js +140 -0
- data/lib/javascriptmvc/jquery/dom/dimensions/qunit.html +22 -0
- data/lib/javascriptmvc/jquery/dom/dimensions/test/qunit/curStyles.micro +3 -0
- data/lib/javascriptmvc/jquery/dom/dimensions/test/qunit/dimensions_test.js +8 -0
- data/lib/javascriptmvc/jquery/dom/dimensions/test/qunit/outer.micro +0 -0
- data/lib/javascriptmvc/jquery/dom/dimensions/test/qunit/qunit.js +4 -0
- data/lib/javascriptmvc/jquery/dom/dom.js +7 -0
- data/lib/javascriptmvc/jquery/dom/fixture/fixture.html +143 -0
- data/lib/javascriptmvc/jquery/dom/fixture/fixture.js +521 -0
- data/lib/javascriptmvc/jquery/dom/fixture/fixtures/messages.html +31 -0
- data/lib/javascriptmvc/jquery/dom/fixture/fixtures/test.json +3 -0
- data/lib/javascriptmvc/jquery/dom/fixture/qunit.html +22 -0
- data/lib/javascriptmvc/jquery/dom/fixture/test/qunit/fixture_test.js +50 -0
- data/lib/javascriptmvc/jquery/dom/fixture/test/qunit/qunit.js +4 -0
- data/lib/javascriptmvc/jquery/dom/form_params/form_params.html +57 -0
- data/lib/javascriptmvc/jquery/dom/form_params/form_params.js +106 -0
- data/lib/javascriptmvc/jquery/dom/form_params/qunit.html +22 -0
- data/lib/javascriptmvc/jquery/dom/form_params/test/qunit/basics.micro +27 -0
- data/lib/javascriptmvc/jquery/dom/form_params/test/qunit/checkbox.micro +20 -0
- data/lib/javascriptmvc/jquery/dom/form_params/test/qunit/form_params_test.js +43 -0
- data/lib/javascriptmvc/jquery/dom/form_params/test/qunit/qunit.js +4 -0
- data/lib/javascriptmvc/jquery/dom/form_params/test/qunit/truthy.micro +8 -0
- data/lib/javascriptmvc/jquery/dom/within/within.js +67 -0
- data/lib/javascriptmvc/jquery/error/background.png +0 -0
- data/lib/javascriptmvc/jquery/error/error.html +31 -0
- data/lib/javascriptmvc/jquery/error/error.js +227 -0
- data/lib/javascriptmvc/jquery/error/setup.js +4 -0
- data/lib/javascriptmvc/jquery/error/test/test.html +23 -0
- data/lib/javascriptmvc/jquery/error/test/test.js +4 -0
- data/lib/javascriptmvc/jquery/event/default/compress.js +7 -0
- data/lib/javascriptmvc/jquery/event/default/default.html +85 -0
- data/lib/javascriptmvc/jquery/event/default/default.js +193 -0
- data/lib/javascriptmvc/jquery/event/default/defaultjquery.html +117 -0
- data/lib/javascriptmvc/jquery/event/default/qunit.html +22 -0
- data/lib/javascriptmvc/jquery/event/default/test/qunit/default_test.js +104 -0
- data/lib/javascriptmvc/jquery/event/default/test/qunit/html.micro +8 -0
- data/lib/javascriptmvc/jquery/event/default/test/qunit/qunit.js +6 -0
- data/lib/javascriptmvc/jquery/event/default/test/qunit/run.js +2 -0
- data/lib/javascriptmvc/jquery/event/destroyed/destroyed.html +24 -0
- data/lib/javascriptmvc/jquery/event/destroyed/destroyed.js +40 -0
- data/lib/javascriptmvc/jquery/event/destroyed/destroyed_menu.html +96 -0
- data/lib/javascriptmvc/jquery/event/destroyed/qunit.html +21 -0
- data/lib/javascriptmvc/jquery/event/destroyed/test/qunit/destroyed_test.js +12 -0
- data/lib/javascriptmvc/jquery/event/destroyed/test/qunit/qunit.js +6 -0
- data/lib/javascriptmvc/jquery/event/drag/drag.html +105 -0
- data/lib/javascriptmvc/jquery/event/drag/drag.js +466 -0
- data/lib/javascriptmvc/jquery/event/drag/limit/limit.html +74 -0
- data/lib/javascriptmvc/jquery/event/drag/limit/limit.js +56 -0
- data/lib/javascriptmvc/jquery/event/drag/limit/scripts/compress.js +6 -0
- data/lib/javascriptmvc/jquery/event/drag/limit/scripts/doc.js +6 -0
- data/lib/javascriptmvc/jquery/event/drag/limit/test/funcunit/funcunit.html +21 -0
- data/lib/javascriptmvc/jquery/event/drag/limit/test/funcunit/funcunit.js +3 -0
- data/lib/javascriptmvc/jquery/event/drag/limit/test/funcunit/limit_test.js +11 -0
- data/lib/javascriptmvc/jquery/event/drag/limit/test/funcunit/run.js +10 -0
- data/lib/javascriptmvc/jquery/event/drag/limit/test/qunit/limit_test.js +4 -0
- data/lib/javascriptmvc/jquery/event/drag/limit/test/qunit/qunit.html +21 -0
- data/lib/javascriptmvc/jquery/event/drag/limit/test/qunit/qunit.js +9 -0
- data/lib/javascriptmvc/jquery/event/drag/limit/test/qunit/run.js +2 -0
- data/lib/javascriptmvc/jquery/event/drag/qunit.html +16 -0
- data/lib/javascriptmvc/jquery/event/drag/scroll/scroll.js +120 -0
- data/lib/javascriptmvc/jquery/event/drag/test/qunit/drag_test.js +130 -0
- data/lib/javascriptmvc/jquery/event/drag/test/qunit/qunit.js +4 -0
- data/lib/javascriptmvc/jquery/event/drop/drop.html +74 -0
- data/lib/javascriptmvc/jquery/event/drop/drop.js +301 -0
- data/lib/javascriptmvc/jquery/event/event.js +6 -0
- data/lib/javascriptmvc/jquery/event/hashchange/hashchange.js +245 -0
- data/lib/javascriptmvc/jquery/event/hover/compress.js +7 -0
- data/lib/javascriptmvc/jquery/event/hover/hover.html +56 -0
- data/lib/javascriptmvc/jquery/event/hover/hover.js +219 -0
- data/lib/javascriptmvc/jquery/event/hover/qunit.html +16 -0
- data/lib/javascriptmvc/jquery/event/hover/test/qunit/hover_test.js +55 -0
- data/lib/javascriptmvc/jquery/event/hover/test/qunit/qunit.js +4 -0
- data/lib/javascriptmvc/jquery/event/livehack/compress.js +7 -0
- data/lib/javascriptmvc/jquery/event/livehack/funcunit.html +21 -0
- data/lib/javascriptmvc/jquery/event/livehack/livehack.html +25 -0
- data/lib/javascriptmvc/jquery/event/livehack/livehack.js +167 -0
- data/lib/javascriptmvc/jquery/event/offline/funcunit.html +20 -0
- data/lib/javascriptmvc/jquery/event/offline/offline.html +26 -0
- data/lib/javascriptmvc/jquery/event/offline/offline.js +36 -0
- data/lib/javascriptmvc/jquery/event/offline/qunit.html +22 -0
- data/lib/javascriptmvc/jquery/event/offline/scripts/compress.js +3 -0
- data/lib/javascriptmvc/jquery/event/offline/scripts/doc.js +4 -0
- data/lib/javascriptmvc/jquery/event/offline/settings.js +41 -0
- data/lib/javascriptmvc/jquery/event/offline/test/funcunit/funcunit.js +3 -0
- data/lib/javascriptmvc/jquery/event/offline/test/funcunit/tests/basic.js +11 -0
- data/lib/javascriptmvc/jquery/event/offline/test/qunit/qunit.js +4 -0
- data/lib/javascriptmvc/jquery/event/offline/test/qunit/tests/basic.js +4 -0
- data/lib/javascriptmvc/jquery/event/resize/funcunit.html +20 -0
- data/lib/javascriptmvc/jquery/event/resize/qunit.html +22 -0
- data/lib/javascriptmvc/jquery/event/resize/resize.html +23 -0
- data/lib/javascriptmvc/jquery/event/resize/resize.js +50 -0
- data/lib/javascriptmvc/jquery/event/resize/scripts/compress.js +3 -0
- data/lib/javascriptmvc/jquery/event/resize/scripts/doc.js +4 -0
- data/lib/javascriptmvc/jquery/event/resize/scripts/test.js +55 -0
- data/lib/javascriptmvc/jquery/event/resize/settings.js +40 -0
- data/lib/javascriptmvc/jquery/event/resize/test/funcunit/funcunit.js +3 -0
- data/lib/javascriptmvc/jquery/event/resize/test/funcunit/tests/basic.js +11 -0
- data/lib/javascriptmvc/jquery/event/resize/test/qunit/qunit.js +4 -0
- data/lib/javascriptmvc/jquery/event/resize/test/qunit/tests/basic.js +4 -0
- data/lib/javascriptmvc/jquery/event/select/scripts/compress.js +6 -0
- data/lib/javascriptmvc/jquery/event/select/scripts/doc.js +6 -0
- data/lib/javascriptmvc/jquery/event/select/select.html +63 -0
- data/lib/javascriptmvc/jquery/event/select/select.js +65 -0
- data/lib/javascriptmvc/jquery/event/select/test/funcunit/funcunit.html +21 -0
- data/lib/javascriptmvc/jquery/event/select/test/funcunit/funcunit.js +3 -0
- data/lib/javascriptmvc/jquery/event/select/test/funcunit/run.js +10 -0
- data/lib/javascriptmvc/jquery/event/select/test/funcunit/select_test.js +11 -0
- data/lib/javascriptmvc/jquery/event/select/test/qunit/qunit.html +21 -0
- data/lib/javascriptmvc/jquery/event/select/test/qunit/qunit.js +5 -0
- data/lib/javascriptmvc/jquery/event/select/test/qunit/run.js +2 -0
- data/lib/javascriptmvc/jquery/event/select/test/qunit/select_test.js +4 -0
- data/lib/javascriptmvc/jquery/generate/app +23 -0
- data/lib/javascriptmvc/jquery/generate/controller +21 -0
- data/lib/javascriptmvc/jquery/generate/model +26 -0
- data/lib/javascriptmvc/jquery/generate/page +20 -0
- data/lib/javascriptmvc/jquery/generate/plugin +20 -0
- data/lib/javascriptmvc/jquery/generate/scaffold +23 -0
- data/lib/javascriptmvc/jquery/generate/templates/app/(application_name).css.ejs +4 -0
- data/lib/javascriptmvc/jquery/generate/templates/app/(application_name).html.ejs +23 -0
- data/lib/javascriptmvc/jquery/generate/templates/app/(application_name).js.ejs +21 -0
- data/lib/javascriptmvc/jquery/generate/templates/app/controllers/.ignore +0 -0
- data/lib/javascriptmvc/jquery/generate/templates/app/docs/.ignore +0 -0
- data/lib/javascriptmvc/jquery/generate/templates/app/fixtures/.ignore +0 -0
- data/lib/javascriptmvc/jquery/generate/templates/app/funcunit.html.ejs +15 -0
- data/lib/javascriptmvc/jquery/generate/templates/app/models/.ignore +0 -0
- data/lib/javascriptmvc/jquery/generate/templates/app/qunit.html.ejs +20 -0
- data/lib/javascriptmvc/jquery/generate/templates/app/resources/.ignore +0 -0
- data/lib/javascriptmvc/jquery/generate/templates/app/scripts/build.js.ejs +6 -0
- data/lib/javascriptmvc/jquery/generate/templates/app/scripts/clean.js.ejs +6 -0
- data/lib/javascriptmvc/jquery/generate/templates/app/scripts/docs.js.ejs +4 -0
- data/lib/javascriptmvc/jquery/generate/templates/app/test/funcunit/(application_name)_test.js.ejs +9 -0
- data/lib/javascriptmvc/jquery/generate/templates/app/test/funcunit/funcunit.js.ejs +3 -0
- data/lib/javascriptmvc/jquery/generate/templates/app/test/qunit/(application_name)_test.js.ejs +5 -0
- data/lib/javascriptmvc/jquery/generate/templates/app/test/qunit/qunit.js.ejs +3 -0
- data/lib/javascriptmvc/jquery/generate/templates/app/views/.ignore +0 -0
- data/lib/javascriptmvc/jquery/generate/templates/controller/controllers/(underscore)_controller.js.ejs +12 -0
- data/lib/javascriptmvc/jquery/generate/templates/model/fixtures.link +1 -0
- data/lib/javascriptmvc/jquery/generate/templates/model/models.link +1 -0
- data/lib/javascriptmvc/jquery/generate/templates/model/test/qunit.link +1 -0
- data/lib/javascriptmvc/jquery/generate/templates/page.ejs +23 -0
- data/lib/javascriptmvc/jquery/generate/templates/plugin/(application_name).html.ejs +23 -0
- data/lib/javascriptmvc/jquery/generate/templates/plugin/(application_name).js.ejs +3 -0
- data/lib/javascriptmvc/jquery/generate/templates/plugin/fixtures/.ignore +0 -0
- data/lib/javascriptmvc/jquery/generate/templates/plugin/funcunit.html.ejs +15 -0
- data/lib/javascriptmvc/jquery/generate/templates/plugin/qunit.html.ejs +20 -0
- data/lib/javascriptmvc/jquery/generate/templates/plugin/resources/.ignore +0 -0
- data/lib/javascriptmvc/jquery/generate/templates/plugin/scripts.link +1 -0
- data/lib/javascriptmvc/jquery/generate/templates/plugin/test.link +1 -0
- data/lib/javascriptmvc/jquery/generate/templates/plugin/views/.ignore +0 -0
- data/lib/javascriptmvc/jquery/generate/templates/scaffold/controllers/(underscore)_controller.js.ejs +96 -0
- data/lib/javascriptmvc/jquery/generate/templates/scaffold/fixtures/(plural).json.get.ejs +3 -0
- data/lib/javascriptmvc/jquery/generate/templates/scaffold/models/(underscore).js.ejs +83 -0
- data/lib/javascriptmvc/jquery/generate/templates/scaffold/test/funcunit/(underscore)_controller_test.js.ejs +63 -0
- data/lib/javascriptmvc/jquery/generate/templates/scaffold/test/qunit/(underscore)_test.js.ejs +45 -0
- data/lib/javascriptmvc/jquery/generate/templates/scaffold/views/(underscore)/edit.ejs.ejs +10 -0
- data/lib/javascriptmvc/jquery/generate/templates/scaffold/views/(underscore)/init.ejs.ejs +26 -0
- data/lib/javascriptmvc/jquery/generate/templates/scaffold/views/(underscore)/list.ejs.ejs +5 -0
- data/lib/javascriptmvc/jquery/generate/templates/scaffold/views/(underscore)/show.ejs.ejs +10 -0
- data/lib/javascriptmvc/jquery/jquery.js +6360 -0
- data/lib/javascriptmvc/jquery/lang/json/json.html +25 -0
- data/lib/javascriptmvc/jquery/lang/json/json.js +201 -0
- data/lib/javascriptmvc/jquery/lang/json/scripts/compress.js +6 -0
- data/lib/javascriptmvc/jquery/lang/json/scripts/doc.js +6 -0
- data/lib/javascriptmvc/jquery/lang/json/test/funcunit/funcunit.html +21 -0
- data/lib/javascriptmvc/jquery/lang/json/test/funcunit/funcunit.js +3 -0
- data/lib/javascriptmvc/jquery/lang/json/test/funcunit/json_test.js +11 -0
- data/lib/javascriptmvc/jquery/lang/json/test/funcunit/run.js +10 -0
- data/lib/javascriptmvc/jquery/lang/json/test/qunit/json_test.js +4 -0
- data/lib/javascriptmvc/jquery/lang/json/test/qunit/qunit.html +21 -0
- data/lib/javascriptmvc/jquery/lang/json/test/qunit/qunit.js +9 -0
- data/lib/javascriptmvc/jquery/lang/json/test/qunit/run.js +2 -0
- data/lib/javascriptmvc/jquery/lang/lang.html +27 -0
- data/lib/javascriptmvc/jquery/lang/lang.js +104 -0
- data/lib/javascriptmvc/jquery/lang/openajax/openajax.js +202 -0
- data/lib/javascriptmvc/jquery/lang/rsplit/rsplit.js +31 -0
- data/lib/javascriptmvc/jquery/lang/vector/vector.js +167 -0
- data/lib/javascriptmvc/jquery/model/associations/associations.html +25 -0
- data/lib/javascriptmvc/jquery/model/associations/associations.js +46 -0
- data/lib/javascriptmvc/jquery/model/associations/qunit.html +21 -0
- data/lib/javascriptmvc/jquery/model/associations/test/qunit/associations_test.js +51 -0
- data/lib/javascriptmvc/jquery/model/associations/test/qunit/qunit.js +9 -0
- data/lib/javascriptmvc/jquery/model/associations/test/qunit/run.js +2 -0
- data/lib/javascriptmvc/jquery/model/backup/backup.js +82 -0
- data/lib/javascriptmvc/jquery/model/json_rest/json_rest.js +91 -0
- data/lib/javascriptmvc/jquery/model/list/list.js +148 -0
- data/lib/javascriptmvc/jquery/model/list/qunit.html +16 -0
- data/lib/javascriptmvc/jquery/model/list/test/qunit/list_test.js +58 -0
- data/lib/javascriptmvc/jquery/model/list/test/qunit/qunit.js +6 -0
- data/lib/javascriptmvc/jquery/model/list/test/qunit/run.js +0 -0
- data/lib/javascriptmvc/jquery/model/model.js +537 -0
- data/lib/javascriptmvc/jquery/model/qunit.html +17 -0
- data/lib/javascriptmvc/jquery/model/store/store.js +66 -0
- data/lib/javascriptmvc/jquery/model/test/qunit/model_test.js +71 -0
- data/lib/javascriptmvc/jquery/model/test/qunit/qunit.js +5 -0
- data/lib/javascriptmvc/jquery/qunit.html +15 -0
- data/lib/javascriptmvc/jquery/test/funcunit/funcunit.html +21 -0
- data/lib/javascriptmvc/jquery/test/funcunit/funcunit.js +3 -0
- data/lib/javascriptmvc/jquery/test/funcunit/jquerytest_test.js +11 -0
- data/lib/javascriptmvc/jquery/test/funcunit/run.js +10 -0
- data/lib/javascriptmvc/jquery/test/qunit/qunit.js +22 -0
- data/lib/javascriptmvc/jquery/update +5 -0
- data/lib/javascriptmvc/jquery/view/compress.js +7 -0
- data/lib/javascriptmvc/jquery/view/ejs/ejs.html +25 -0
- data/lib/javascriptmvc/jquery/view/ejs/ejs.js +489 -0
- data/lib/javascriptmvc/jquery/view/ejs/funcunit.html +21 -0
- data/lib/javascriptmvc/jquery/view/ejs/test/funcunit/ejs_test.js +11 -0
- data/lib/javascriptmvc/jquery/view/ejs/test/funcunit/funcunit.js +3 -0
- data/lib/javascriptmvc/jquery/view/ejs/test/funcunit/run.js +10 -0
- data/lib/javascriptmvc/jquery/view/ejs/test/qunit/ejs_test.js +4 -0
- data/lib/javascriptmvc/jquery/view/ejs/test/qunit/qunit.html +21 -0
- data/lib/javascriptmvc/jquery/view/ejs/test/qunit/qunit.js +9 -0
- data/lib/javascriptmvc/jquery/view/ejs/test/qunit/run.js +2 -0
- data/lib/javascriptmvc/jquery/view/fulljslint.js +3774 -0
- data/lib/javascriptmvc/jquery/view/helpers/helpers.js +338 -0
- data/lib/javascriptmvc/jquery/view/jaml/compress.js +7 -0
- data/lib/javascriptmvc/jquery/view/jaml/funcunit.html +21 -0
- data/lib/javascriptmvc/jquery/view/jaml/jaml.html +25 -0
- data/lib/javascriptmvc/jquery/view/jaml/jaml.js +73 -0
- data/lib/javascriptmvc/jquery/view/jaml/node.js +149 -0
- data/lib/javascriptmvc/jquery/view/jaml/template.js +131 -0
- data/lib/javascriptmvc/jquery/view/jaml/test/funcunit/funcunit.js +3 -0
- data/lib/javascriptmvc/jquery/view/jaml/test/funcunit/jaml_test.js +11 -0
- data/lib/javascriptmvc/jquery/view/jaml/test/funcunit/run.js +10 -0
- data/lib/javascriptmvc/jquery/view/jaml/test/qunit/jaml_test.js +4 -0
- data/lib/javascriptmvc/jquery/view/jaml/test/qunit/qunit.html +21 -0
- data/lib/javascriptmvc/jquery/view/jaml/test/qunit/qunit.js +9 -0
- data/lib/javascriptmvc/jquery/view/jaml/test/qunit/run.js +2 -0
- data/lib/javascriptmvc/jquery/view/micro/compress.js +7 -0
- data/lib/javascriptmvc/jquery/view/micro/funcunit.html +21 -0
- data/lib/javascriptmvc/jquery/view/micro/micro.html +25 -0
- data/lib/javascriptmvc/jquery/view/micro/micro.js +57 -0
- data/lib/javascriptmvc/jquery/view/micro/test/funcunit/funcunit.js +3 -0
- data/lib/javascriptmvc/jquery/view/micro/test/funcunit/micro_test.js +11 -0
- data/lib/javascriptmvc/jquery/view/micro/test/funcunit/run.js +10 -0
- data/lib/javascriptmvc/jquery/view/micro/test/qunit/micro_test.js +4 -0
- data/lib/javascriptmvc/jquery/view/micro/test/qunit/qunit.html +21 -0
- data/lib/javascriptmvc/jquery/view/micro/test/qunit/qunit.js +9 -0
- data/lib/javascriptmvc/jquery/view/micro/test/qunit/run.js +2 -0
- data/lib/javascriptmvc/jquery/view/qunit.html +16 -0
- data/lib/javascriptmvc/jquery/view/test/compression/compression.html +12 -0
- data/lib/javascriptmvc/jquery/view/test/compression/compression.js +11 -0
- data/lib/javascriptmvc/jquery/view/test/compression/run.js +36 -0
- data/lib/javascriptmvc/jquery/view/test/funcunit/funcunit.js +3 -0
- data/lib/javascriptmvc/jquery/view/test/funcunit/run.js +10 -0
- data/lib/javascriptmvc/jquery/view/test/funcunit/view_test.js +11 -0
- data/lib/javascriptmvc/jquery/view/test/qunit/nested_plugin.ejs +1 -0
- data/lib/javascriptmvc/jquery/view/test/qunit/plugin.ejs +1 -0
- data/lib/javascriptmvc/jquery/view/test/qunit/qunit.js +9 -0
- data/lib/javascriptmvc/jquery/view/test/qunit/template.ejs +1 -0
- data/lib/javascriptmvc/jquery/view/test/qunit/template.jaml +3 -0
- data/lib/javascriptmvc/jquery/view/test/qunit/template.micro +1 -0
- data/lib/javascriptmvc/jquery/view/test/qunit/template.tmpl +1 -0
- data/lib/javascriptmvc/jquery/view/test/qunit/view_test.js +24 -0
- data/lib/javascriptmvc/jquery/view/tmpl/tmpl.js +150 -0
- data/lib/javascriptmvc/jquery/view/view.html +65 -0
- data/lib/javascriptmvc/jquery/view/view.js +296 -0
- data/lib/javascriptmvc/js +56 -0
- data/lib/javascriptmvc/js.bat +57 -0
- data/lib/javascriptmvc/steal/README +26 -0
- data/lib/javascriptmvc/steal/build/apps/apps.js +208 -0
- data/lib/javascriptmvc/steal/build/apps/test.js +4 -0
- data/lib/javascriptmvc/steal/build/build.js +281 -0
- data/lib/javascriptmvc/steal/build/pluginify.js +73 -0
- data/lib/javascriptmvc/steal/build/scripts/compiler.jar +0 -0
- data/lib/javascriptmvc/steal/build/scripts/scripts.js +155 -0
- data/lib/javascriptmvc/steal/build/styles/cssmin.js +17 -0
- data/lib/javascriptmvc/steal/build/styles/styles.js +84 -0
- data/lib/javascriptmvc/steal/build/test/basicpage.html +6 -0
- data/lib/javascriptmvc/steal/build/test/basicproduction.js +1 -0
- data/lib/javascriptmvc/steal/build/test/basicsource.js +6 -0
- data/lib/javascriptmvc/steal/build/test/css/css/css1.css +1 -0
- data/lib/javascriptmvc/steal/build/test/css/css/justin.png +0 -0
- data/lib/javascriptmvc/steal/build/test/css/css2.css +5 -0
- data/lib/javascriptmvc/steal/build/test/css/page.html +9 -0
- data/lib/javascriptmvc/steal/build/test/css/production.css +1 -0
- data/lib/javascriptmvc/steal/build/test/css/test.js +7 -0
- data/lib/javascriptmvc/steal/build/test/css/upload.PNG +0 -0
- data/lib/javascriptmvc/steal/build/test/foreign.html +6 -0
- data/lib/javascriptmvc/steal/build/test/foreign.js +2 -0
- data/lib/javascriptmvc/steal/build/test/removecode.js +11 -0
- data/lib/javascriptmvc/steal/build/test/run.js +57 -0
- data/lib/javascriptmvc/steal/build/test/stealpage.html +10 -0
- data/lib/javascriptmvc/steal/build/test/stealprodpage.html +10 -0
- data/lib/javascriptmvc/steal/build/test/test.js +3 -0
- data/lib/javascriptmvc/steal/buildjs +21 -0
- data/lib/javascriptmvc/steal/clean/beautify.js +1108 -0
- data/lib/javascriptmvc/steal/clean/clean.js +179 -0
- data/lib/javascriptmvc/steal/clean/jslint.js +5662 -0
- data/lib/javascriptmvc/steal/clean/test.js +7 -0
- data/lib/javascriptmvc/steal/cleanjs +5 -0
- data/lib/javascriptmvc/steal/coffee/coffee-script.js +9 -0
- data/lib/javascriptmvc/steal/coffee/coffee.js +56 -0
- data/lib/javascriptmvc/steal/dev/dev.js +83 -0
- data/lib/javascriptmvc/steal/end.js +1 -0
- data/lib/javascriptmvc/steal/generate/app +23 -0
- data/lib/javascriptmvc/steal/generate/ejs.js +470 -0
- data/lib/javascriptmvc/steal/generate/generate.js +211 -0
- data/lib/javascriptmvc/steal/generate/inflector.js +117 -0
- data/lib/javascriptmvc/steal/generate/system.js +33 -0
- data/lib/javascriptmvc/steal/generate/templates/app/(application_name).css.ejs +10 -0
- data/lib/javascriptmvc/steal/generate/templates/app/(application_name).html.ejs +18 -0
- data/lib/javascriptmvc/steal/generate/templates/app/(application_name).js.ejs +10 -0
- data/lib/javascriptmvc/steal/generate/templates/app/docs/.ignore +0 -0
- data/lib/javascriptmvc/steal/generate/templates/app/resources/.ignore +0 -0
- data/lib/javascriptmvc/steal/generate/templates/app/resources/example.coffee.ejs +5 -0
- data/lib/javascriptmvc/steal/generate/templates/app/resources/example.js.ejs +13 -0
- data/lib/javascriptmvc/steal/generate/templates/app/resources/example.less.ejs +9 -0
- data/lib/javascriptmvc/steal/generate/templates/app/scripts/build.js.ejs +6 -0
- data/lib/javascriptmvc/steal/generate/templates/app/scripts/clean.js.ejs +6 -0
- data/lib/javascriptmvc/steal/generate/templates/app/test/.ignore +0 -0
- data/lib/javascriptmvc/steal/generate/templates/page.ejs +23 -0
- data/lib/javascriptmvc/steal/generate/test/test.js +92 -0
- data/lib/javascriptmvc/steal/get/get.js +163 -0
- data/lib/javascriptmvc/steal/get/gets.json +10 -0
- data/lib/javascriptmvc/steal/get/getter.js +115 -0
- data/lib/javascriptmvc/steal/get/github.js +134 -0
- data/lib/javascriptmvc/steal/get/json.js +172 -0
- data/lib/javascriptmvc/steal/getjs +5 -0
- data/lib/javascriptmvc/steal/js +56 -0
- data/lib/javascriptmvc/steal/js.bat +57 -0
- data/lib/javascriptmvc/steal/less/less.js +117 -0
- data/lib/javascriptmvc/steal/less/less_engine.js +2529 -0
- data/lib/javascriptmvc/steal/rhino/blank.html +6 -0
- data/lib/javascriptmvc/steal/rhino/build.js +31 -0
- data/lib/javascriptmvc/steal/rhino/docs.js +68 -0
- data/lib/javascriptmvc/steal/rhino/empty.html +12 -0
- data/lib/javascriptmvc/steal/rhino/env.js +11537 -0
- data/lib/javascriptmvc/steal/rhino/file.js +299 -0
- data/lib/javascriptmvc/steal/rhino/js.jar +0 -0
- data/lib/javascriptmvc/steal/rhino/loader.js +8 -0
- data/lib/javascriptmvc/steal/rhino/prompt.js +49 -0
- data/lib/javascriptmvc/steal/rhino/steal.js +122 -0
- data/lib/javascriptmvc/steal/rhino/test.js +16 -0
- data/lib/javascriptmvc/steal/steal.js +1317 -0
- data/lib/javascriptmvc/steal/steal.production.js +23 -0
- data/lib/javascriptmvc/steal/test/absoluteurl.html +7 -0
- data/lib/javascriptmvc/steal/test/absoluteurl/absoluteurl.js +1 -0
- data/lib/javascriptmvc/steal/test/absoluteurl/alert.js +1 -0
- data/lib/javascriptmvc/steal/test/another/two.js +2 -0
- data/lib/javascriptmvc/steal/test/one/four.js +1 -0
- data/lib/javascriptmvc/steal/test/one/one.js +6 -0
- data/lib/javascriptmvc/steal/test/qunit/qunit.html +22 -0
- data/lib/javascriptmvc/steal/test/qunit/qunit.js +3 -0
- data/lib/javascriptmvc/steal/test/qunit/steal_test.js +197 -0
- data/lib/javascriptmvc/steal/test/run.js +12 -0
- data/lib/javascriptmvc/steal/test/steal.html +37 -0
- data/lib/javascriptmvc/steal/test/test.js +82 -0
- data/lib/javascriptmvc/steal/test/three.js +3 -0
- data/lib/javascriptmvc/steal/testing/test.html +20 -0
- data/lib/javascriptmvc/steal/testing/testing.js +48 -0
- data/lib/javascriptmvc/steal/update +5 -0
- metadata +622 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>Dimensions Test Suite</title>
|
4
|
+
<link rel="stylesheet" type="text/css" href="../../../funcunit/qunit/qunit.css" />
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
margin: 0px; padding: 0px;
|
8
|
+
}
|
9
|
+
</style>
|
10
|
+
<script type='text/javascript' src='../../../steal/steal.js?steal[app]=jquery/dom/dimensions/test/qunit'></script>
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
|
14
|
+
<h1 id="qunit-header">Dimensions Test Suite</h1>
|
15
|
+
<h2 id="qunit-banner"></h2>
|
16
|
+
<div id="qunit-testrunner-toolbar"></div>
|
17
|
+
<h2 id="qunit-userAgent"></h2>
|
18
|
+
<div id="test-content"></div>
|
19
|
+
<ol id="qunit-tests"></ol>
|
20
|
+
<div id="qunit-test-area"></div>
|
21
|
+
</body>
|
22
|
+
</html>
|
File without changes
|
@@ -0,0 +1,143 @@
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
2
|
+
"http://www.w3.org/TR/html4/strict.dtd">
|
3
|
+
<html lang="en">
|
4
|
+
<head>
|
5
|
+
<title>Fixture Demo</title>
|
6
|
+
<style type='text/css'>
|
7
|
+
body {font-family: verdana}
|
8
|
+
#messages {height: 200px; overflow-y: auto;}
|
9
|
+
#content {height: 551px; overflow: hidden;}
|
10
|
+
</style>
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
<div id="demo-html">
|
14
|
+
<div id='content'></div>
|
15
|
+
</div>
|
16
|
+
<script type='text/javascript'
|
17
|
+
src='../../../steal/steal.js'></script>
|
18
|
+
<script type='text/javascript'>
|
19
|
+
steal.plugins('jquery/dom/fixture','jquery/dom/form_params').start()
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<script type='text/javascript' id="demo-source">
|
23
|
+
|
24
|
+
// gets content from a fixture
|
25
|
+
$.get("/messages.php",
|
26
|
+
function(html){
|
27
|
+
// put the result in content
|
28
|
+
$('#content').html(html)
|
29
|
+
},
|
30
|
+
'text',
|
31
|
+
'fixtures/messages.html');
|
32
|
+
|
33
|
+
|
34
|
+
// makes 20 messages in a fixture
|
35
|
+
$.fixture.make(["messages","message"],20, function(i, messages){
|
36
|
+
return {
|
37
|
+
subject: "This is message "+i,
|
38
|
+
body: "Here is some text for this message",
|
39
|
+
user: "Justin",
|
40
|
+
createdAt: String(new Date( Math.random() * new Date().getTime() ))
|
41
|
+
}
|
42
|
+
});
|
43
|
+
|
44
|
+
// gets messages on submit
|
45
|
+
$("#getMessages").live("submit",function(ev){
|
46
|
+
|
47
|
+
ev.preventDefault();
|
48
|
+
|
49
|
+
//get the limit and offset
|
50
|
+
var params = $(this).formParams().params;
|
51
|
+
|
52
|
+
//use -messages fixture created by make
|
53
|
+
$.ajax({
|
54
|
+
url: "/messages.json",
|
55
|
+
data: params,
|
56
|
+
success: function(json){
|
57
|
+
$("#messages").html( messagesHTML(json) )
|
58
|
+
},
|
59
|
+
dataType: "json",
|
60
|
+
fixture: "-messages"
|
61
|
+
})
|
62
|
+
});
|
63
|
+
|
64
|
+
|
65
|
+
// a fixture for creating messages
|
66
|
+
$.fixture["-createMessage"] = function(settings, cbType){
|
67
|
+
// add to the message data what the server would add
|
68
|
+
var message = $.extend({
|
69
|
+
id: arguments.callee.count++,
|
70
|
+
user: "Justin",
|
71
|
+
createdAt: String(new Date())
|
72
|
+
}, settings.data);
|
73
|
+
|
74
|
+
message.id = $.fixture["~messages"].length;
|
75
|
+
|
76
|
+
// adds the message to the fixture data
|
77
|
+
$.fixture["~messages"].push(message);
|
78
|
+
|
79
|
+
// return the data for the callback
|
80
|
+
return [message];
|
81
|
+
};
|
82
|
+
|
83
|
+
|
84
|
+
// creates a message on submit
|
85
|
+
$("#message").live("submit", function(ev){
|
86
|
+
ev.preventDefault();
|
87
|
+
|
88
|
+
// get message data
|
89
|
+
var message = $(this).formParams().message;
|
90
|
+
|
91
|
+
// uses -createMessage fixture
|
92
|
+
$.post("/message.json", message,function(json){
|
93
|
+
|
94
|
+
//clear the message form
|
95
|
+
$('[name*=message]').val("");
|
96
|
+
|
97
|
+
//show the new message
|
98
|
+
$('[name*=offset]').val(json.id)
|
99
|
+
$('[name*=limit]').val(1)
|
100
|
+
$("#getMessages").submit();
|
101
|
+
|
102
|
+
},'json',"-createMessage")
|
103
|
+
})
|
104
|
+
|
105
|
+
//creates the html from message data
|
106
|
+
var messagesHTML = function(json){
|
107
|
+
var html = ["<h4>Messages (count=",
|
108
|
+
json.count,
|
109
|
+
")</h4>",
|
110
|
+
"<table>",
|
111
|
+
"<tr>"],
|
112
|
+
cols = ["subject",
|
113
|
+
"body",
|
114
|
+
"user",
|
115
|
+
"createdAt"];
|
116
|
+
|
117
|
+
// html for the column headers
|
118
|
+
$.each(cols, function(i, prop){
|
119
|
+
html.push("<th>"+prop+"</th>")
|
120
|
+
})
|
121
|
+
|
122
|
+
html.push("</tr>")
|
123
|
+
|
124
|
+
// html for the messages
|
125
|
+
$.each(json.data, function(m, message){
|
126
|
+
html.push("<tr>")
|
127
|
+
$.each(cols, function(i, prop){
|
128
|
+
html.push("<td>"+message[prop]+"</td>")
|
129
|
+
})
|
130
|
+
html.push("</tr>")
|
131
|
+
})
|
132
|
+
|
133
|
+
html.push("</table>");
|
134
|
+
return html.join("");
|
135
|
+
}
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
</script>
|
142
|
+
</body>
|
143
|
+
</html>
|
@@ -0,0 +1,521 @@
|
|
1
|
+
steal.plugins('jquery/dom').then(function( $ ) {
|
2
|
+
|
3
|
+
var ajax = $.ajax,
|
4
|
+
get = $.get,
|
5
|
+
post = $.post;
|
6
|
+
|
7
|
+
/**
|
8
|
+
* @constructor jQuery.fixture
|
9
|
+
* @plugin jquery/dom/fixture
|
10
|
+
* @download jquery/dist/jquery.fixture.js
|
11
|
+
* @test jquery/dom/fixture/qunit.html
|
12
|
+
* @parent dom
|
13
|
+
*
|
14
|
+
* Fixtures simulate AJAX responses by overwriting
|
15
|
+
* [jQuery.ajax $.ajax],
|
16
|
+
* [jQuery.get $.get], and
|
17
|
+
* [jQuery.post $.post].
|
18
|
+
* Instead of making a request to a server, fixtures simulate
|
19
|
+
* the repsonse with a file or function.
|
20
|
+
*
|
21
|
+
* They are a great technique when you want to develop JavaScript
|
22
|
+
* independently of the backend.
|
23
|
+
*
|
24
|
+
* <h3>Quick Example</h3>
|
25
|
+
* <p>Instead of making a request to <code>/tasks.json</code>,
|
26
|
+
* $.ajax will look in <code>fixtures/tasks.json</code>.
|
27
|
+
* It's expected that a static <code>fixtures/tasks.json</code>
|
28
|
+
* file exists relative to the current page.
|
29
|
+
* </p>
|
30
|
+
* @codestart
|
31
|
+
* $.ajax({url: "/tasks.json",
|
32
|
+
* dataType: "json",
|
33
|
+
* type: "get",
|
34
|
+
* fixture: "fixtures/tasks.json",
|
35
|
+
* success: myCallback});
|
36
|
+
* @codeend
|
37
|
+
* <h2>Using Fixtures</h2>
|
38
|
+
* To enable fixtures, you must add this plugin to your page and
|
39
|
+
* set the fixture property.
|
40
|
+
*
|
41
|
+
* The fixture property is set as ...
|
42
|
+
* @codestart
|
43
|
+
* //... a property with $.ajax
|
44
|
+
* $.ajax({fixture: FIXTURE_VALUE})
|
45
|
+
*
|
46
|
+
* //... a parameter in $.get and $.post
|
47
|
+
* $.get ( url, data, callback, type, FIXTURE_VALUE )
|
48
|
+
* $.post( url, data, callback, type, FIXTURE_VALUE )
|
49
|
+
* @codeend
|
50
|
+
* <h3>Turning Off Fixtures</h3>
|
51
|
+
* <p>To turn off fixtures, simply remove the fixture plugin from
|
52
|
+
* your page. The Ajax methods will ignore <code>FIXTURE_VALUE</code>
|
53
|
+
* and revert to their normal behavior. If you want to ignore a single
|
54
|
+
* fixture, we suggest commenting it out.
|
55
|
+
* </p>
|
56
|
+
* <div class='whisper'>
|
57
|
+
* PRO TIP: Don't worry about leaving the fixture values in your source.
|
58
|
+
* They don't take up many characters and won't impact how jQuery makes
|
59
|
+
* requests. They can be useful even after the service they simulate
|
60
|
+
* is created.
|
61
|
+
* </div>
|
62
|
+
* <h2>Types of Fixtures</h2>
|
63
|
+
* <p>There are 2 types of fixtures</p>
|
64
|
+
* <ul>
|
65
|
+
* <li><b>Static</b> - the response is in a file.
|
66
|
+
* </li>
|
67
|
+
* <li>
|
68
|
+
* <b>Dynamic</b> - the response is generated by a function.
|
69
|
+
* </li>
|
70
|
+
* </ul>
|
71
|
+
* There are different ways to lookup static and dynamic fixtures.
|
72
|
+
* <h3>Static Fixtures</h3>
|
73
|
+
* Static fixture locations can be calculated:
|
74
|
+
* @codestart
|
75
|
+
* // looks in test/fixtures/tasks/1.get
|
76
|
+
* $.ajax({type:"get",
|
77
|
+
* url: "tasks/1",
|
78
|
+
* fixture: true})
|
79
|
+
* @codeend
|
80
|
+
* Or provided:
|
81
|
+
* @codestart
|
82
|
+
* // looks in fixtures/tasks1.json relative to page
|
83
|
+
* $.ajax({type:"get",
|
84
|
+
* url: "tasks/1",
|
85
|
+
* fixture: "fixtures/task1.json"})
|
86
|
+
*
|
87
|
+
* // looks in fixtures/tasks1.json relative to jmvc root
|
88
|
+
* // this assumes you are using steal
|
89
|
+
* $.ajax({type:"get",
|
90
|
+
* url: "tasks/1",
|
91
|
+
* fixture: "//fixtures/task1.json"})`
|
92
|
+
* @codeend
|
93
|
+
* <div class='whisper'>
|
94
|
+
* PRO TIP: Use provided fixtures. It's easier to understand what it is going.
|
95
|
+
* Also, create a fixtures folder in your app to hold your fixtures.
|
96
|
+
* </div>
|
97
|
+
* <h3>Dynamic Fixtures</h3>
|
98
|
+
* <p>Dynamic Fixtures are functions that return the arguments the $.ajax callbacks
|
99
|
+
* (<code>beforeSend</code>, <code>success</code>, <code>complete</code>,
|
100
|
+
* <code>error</code>) expect. </p>
|
101
|
+
* <p>For example, the "<code>success</code>" of a json request is called with
|
102
|
+
* <code>[data, textStatus, XMLHttpRequest].</p>
|
103
|
+
* <p>There are 2 ways to lookup dynamic fixtures.<p>
|
104
|
+
* They can provided:
|
105
|
+
* @codestart
|
106
|
+
* //just use a function as the fixture property
|
107
|
+
* $.ajax({
|
108
|
+
* type: "get",
|
109
|
+
* url: "tasks",
|
110
|
+
* data: {id: 5},
|
111
|
+
* dataType: "json",
|
112
|
+
* fixture: function( settings, callbackType ) {
|
113
|
+
* var xhr = {responseText: "{id:"+settings.data.id+"}"}
|
114
|
+
* switch(callbackType){
|
115
|
+
* case "success":
|
116
|
+
* return [{id: settings.data.id},"success",xhr]
|
117
|
+
* case "complete":
|
118
|
+
* return [xhr,"success"]
|
119
|
+
* }
|
120
|
+
* }
|
121
|
+
* })
|
122
|
+
* @codeend
|
123
|
+
* Or found by name on $.fixture:
|
124
|
+
* @codestart
|
125
|
+
* // add your function on $.fixture
|
126
|
+
* // We use -FUNC by convention
|
127
|
+
* $.fixture["-myGet"] = function(settings, cbType){...}
|
128
|
+
*
|
129
|
+
* // reference it
|
130
|
+
* $.ajax({
|
131
|
+
* type:"get",
|
132
|
+
* url: "tasks/1",
|
133
|
+
* dataType: "json",
|
134
|
+
* fixture: "-myGet"})
|
135
|
+
* @codeend
|
136
|
+
* <p>Dynamic fixture functions are called with:</p>
|
137
|
+
* <ul>
|
138
|
+
* <li> settings - the settings data passed to <code>$.ajax()</code>
|
139
|
+
* <li> calbackType - the type of callback about to be called:
|
140
|
+
* <code>"beforeSend"</code>, <code>"success"</code>, <code>"complete"</code>,
|
141
|
+
* <code>"error"</code></li>
|
142
|
+
* </ul>
|
143
|
+
* and should return an array of arguments for the callback.<br/><br/>
|
144
|
+
* <div class='whisper'>PRO TIP:
|
145
|
+
* Dynamic fixtures are awesome for performance testing. Want to see what
|
146
|
+
* 10000 files does to your app's performance? Make a fixture that returns 10000 items.
|
147
|
+
*
|
148
|
+
* What to see what the app feels like when a request takes 5 seconds to return? Set
|
149
|
+
* [jQuery.fixture.delay] to 5000.
|
150
|
+
* </div>
|
151
|
+
* <h2>Helpers</h2>
|
152
|
+
* <p>The fixture plugin comes with a few ready-made dynamic fixtures and
|
153
|
+
* fixture helpers:</p>
|
154
|
+
* <ul>
|
155
|
+
* <li>[jQuery.fixture.make] - creates fixtures for findAll, findOne.</li>
|
156
|
+
* <li>[jQuery.fixture.-restCreate] - a fixture for restful creates.</li>
|
157
|
+
* <li>[jQuery.fixture.-restDestroy] - a fixture for restful updates.</li>
|
158
|
+
* <li>[jQuery.fixture.-restUpdate] - a fixture for restful destroys.</li>
|
159
|
+
* </ul>
|
160
|
+
* @demo jquery/dom/fixture/fixture.html
|
161
|
+
* @init
|
162
|
+
* Takes an ajax settings and returns a url to look for a fixture. Overwrite this if you want a custom lookup method.
|
163
|
+
* @param {Object} settings
|
164
|
+
* @return {String} the url that will be used for the fixture
|
165
|
+
*/
|
166
|
+
$.fixture = function( settings ) {
|
167
|
+
var url = settings.url,
|
168
|
+
match, left, right;
|
169
|
+
url = url.replace(/%2F/g, "~").replace(/%20/g, "_");
|
170
|
+
|
171
|
+
if ( settings.data && settings.processData && typeof settings.data !== "string" ) {
|
172
|
+
settings.data = jQuery.param(settings.data);
|
173
|
+
}
|
174
|
+
|
175
|
+
|
176
|
+
if ( settings.data && settings.type.toLowerCase() == "get" ) {
|
177
|
+
url += ($.String.include(url, '?') ? '&' : '?') + settings.data;
|
178
|
+
}
|
179
|
+
|
180
|
+
match = url.match(/^(?:https?:\/\/[^\/]*)?\/?([^\?]*)\??(.*)?/);
|
181
|
+
left = match[1];
|
182
|
+
|
183
|
+
right = settings.type ? '.' + settings.type.toLowerCase() : '.post';
|
184
|
+
if ( match[2] ) {
|
185
|
+
left += '/';
|
186
|
+
right = match[2].replace(/\#|&/g, '-').replace(/\//g, '~') + right;
|
187
|
+
}
|
188
|
+
return left + right;
|
189
|
+
}
|
190
|
+
|
191
|
+
$.extend($.fixture, {
|
192
|
+
/**
|
193
|
+
* Provides a rest update fixture function
|
194
|
+
*/
|
195
|
+
"-restUpdate": function( settings, cbType ) {
|
196
|
+
switch ( cbType ) {
|
197
|
+
case "success":
|
198
|
+
return [$.extend({
|
199
|
+
id: parseInt(settings.url)
|
200
|
+
}, settings.data), "success", $.fixture.xhr()]
|
201
|
+
case "complete":
|
202
|
+
return [$.fixture.xhr(), "success"]
|
203
|
+
}
|
204
|
+
},
|
205
|
+
/**
|
206
|
+
* Provides a rest destroy fixture function
|
207
|
+
*/
|
208
|
+
"-restDestroy": function( settings, cbType ) {
|
209
|
+
switch ( cbType ) {
|
210
|
+
case "success":
|
211
|
+
return [true, "success", $.fixture.xhr()]
|
212
|
+
case "complete":
|
213
|
+
return [$.fixture.xhr(), "success"]
|
214
|
+
}
|
215
|
+
},
|
216
|
+
/**
|
217
|
+
* Provides a rest create fixture function
|
218
|
+
*/
|
219
|
+
"-restCreate": function( settings, cbType ) {
|
220
|
+
switch ( cbType ) {
|
221
|
+
case "success":
|
222
|
+
return [{
|
223
|
+
id: parseInt(Math.random() * 1000)
|
224
|
+
}, "success", $.fixture.xhr()];
|
225
|
+
case "complete":
|
226
|
+
return [$.fixture.xhr({
|
227
|
+
getResponseHeader: function() {
|
228
|
+
return settings.url + "/" + parseInt(Math.random() * 1000)
|
229
|
+
}
|
230
|
+
}), "success"]
|
231
|
+
}
|
232
|
+
|
233
|
+
|
234
|
+
},
|
235
|
+
/**
|
236
|
+
* Used to make fixtures for findAll / findOne style requests.
|
237
|
+
* @codestart
|
238
|
+
* //makes a threaded list of messages
|
239
|
+
* $.fixture.make(["messages","message"],1000, function(i, messages){
|
240
|
+
* return {
|
241
|
+
* subject: "This is message "+i,
|
242
|
+
* body: "Here is some text for this message",
|
243
|
+
* date: Math.floor( new Date().getTime() ),
|
244
|
+
* parentId : i < 100 ? null : Math.floor(Math.random()*i)
|
245
|
+
* }
|
246
|
+
* })
|
247
|
+
* //uses the message fixture to return messages limited by offset, limit, order, etc.
|
248
|
+
* $.ajax({
|
249
|
+
* url: "messages",
|
250
|
+
* data:{
|
251
|
+
* offset: 100,
|
252
|
+
* limit: 50,
|
253
|
+
* order: "date ASC",
|
254
|
+
* parentId: 5},
|
255
|
+
* },
|
256
|
+
* fixture: "-messages",
|
257
|
+
* success: function( messages ) { ... }
|
258
|
+
* });
|
259
|
+
* @codeend
|
260
|
+
* @param {Array} types An array of the fixture names
|
261
|
+
* @param {Number} count the number of items to create
|
262
|
+
* @param {Function} make a function that will return json data representing the object.
|
263
|
+
*/
|
264
|
+
make: function( types, count, make ) {
|
265
|
+
// make all items
|
266
|
+
var items = ($.fixture["~" + types[0]] = []);
|
267
|
+
for ( var i = 0; i < (count); i++ ) {
|
268
|
+
//call back provided make
|
269
|
+
var item = make(i, items)
|
270
|
+
if (!item.id ) {
|
271
|
+
item.id = i;
|
272
|
+
}
|
273
|
+
items.push(item)
|
274
|
+
}
|
275
|
+
//set plural fixture for findAll
|
276
|
+
$.fixture["-" + types[0]] = function( settings ) {
|
277
|
+
|
278
|
+
//copy array of items
|
279
|
+
var retArr = items.slice(0);
|
280
|
+
|
281
|
+
//sort using order
|
282
|
+
//order looks like ["age ASC","gender DESC"]
|
283
|
+
$.each((settings.data.order || []).slice(0).reverse(), function( i, name ) {
|
284
|
+
var split = name.split(" ");
|
285
|
+
retArr = retArr.sort(function( a, b ) {
|
286
|
+
if ( split[1].toUpperCase() != "ASC" ) return a[split[0]] < b[split[0]];
|
287
|
+
else return a[split[0]] > b[split[0]];
|
288
|
+
});
|
289
|
+
});
|
290
|
+
|
291
|
+
//group is just like a sort
|
292
|
+
$.each((settings.data.group || []).slice(0).reverse(), function( i, name ) {
|
293
|
+
var split = name.split(" ");
|
294
|
+
retArr = retArr.sort(function( a, b ) {
|
295
|
+
return a[split[0]] > b[split[0]]
|
296
|
+
});
|
297
|
+
});
|
298
|
+
|
299
|
+
|
300
|
+
var offset = parseInt(settings.data.offset) || 0,
|
301
|
+
limit = parseInt(settings.data.limit) || (count - offset),
|
302
|
+
i = 0;
|
303
|
+
|
304
|
+
//filter results if someone added an attr like parentId
|
305
|
+
for ( var param in settings.data ) {
|
306
|
+
if ( param.indexOf("Id") != -1 ) {
|
307
|
+
while ( i < retArr.length ) {
|
308
|
+
if ( settings.data[param] != retArr[i][param] ) {
|
309
|
+
retArr.splice(i, 1)
|
310
|
+
} else {
|
311
|
+
i++;
|
312
|
+
}
|
313
|
+
}
|
314
|
+
}
|
315
|
+
}
|
316
|
+
|
317
|
+
//return data spliced with limit and offset
|
318
|
+
return [{
|
319
|
+
"count": retArr.length,
|
320
|
+
"limit": settings.data.limit,
|
321
|
+
"offset": settings.data.offset,
|
322
|
+
"data": retArr.slice(offset, offset + limit)
|
323
|
+
}]
|
324
|
+
}
|
325
|
+
$.fixture["-" + types[1]] = function( settings ) {
|
326
|
+
for ( var i = 0; i < (count); i++ ) {
|
327
|
+
if ( settings.data.id == items[i].id ) {
|
328
|
+
return [items[i]]
|
329
|
+
}
|
330
|
+
}
|
331
|
+
}
|
332
|
+
|
333
|
+
},
|
334
|
+
/**
|
335
|
+
* Use $.fixture.xhr to create an object that looks like an xhr object.
|
336
|
+
* <h3>Example</h3>
|
337
|
+
* The following example shows how the -restCreate fixture uses xhr to return
|
338
|
+
* a simulated xhr object:
|
339
|
+
* @codestart
|
340
|
+
* "-restCreate" : function( settings, cbType ) {
|
341
|
+
* switch(cbType){
|
342
|
+
* case "success":
|
343
|
+
* return [
|
344
|
+
* {id: parseInt(Math.random()*1000)},
|
345
|
+
* "success",
|
346
|
+
* $.fixture.xhr()];
|
347
|
+
* case "complete":
|
348
|
+
* return [
|
349
|
+
* $.fixture.xhr({
|
350
|
+
* getResponseHeader: function() {
|
351
|
+
* return settings.url+"/"+parseInt(Math.random()*1000);
|
352
|
+
* }
|
353
|
+
* }),
|
354
|
+
* "success"];
|
355
|
+
* }
|
356
|
+
* }
|
357
|
+
* @codeend
|
358
|
+
* @param {Object} [xhr] properties that you want to overwrite
|
359
|
+
* @return {Object} an object that looks like a successful XHR object.
|
360
|
+
*/
|
361
|
+
xhr: function( xhr ) {
|
362
|
+
return $.extend({}, {
|
363
|
+
abort: $.noop,
|
364
|
+
getAllResponseHeaders: function() {
|
365
|
+
return "";
|
366
|
+
},
|
367
|
+
getResponseHeader: function() {
|
368
|
+
return "";
|
369
|
+
},
|
370
|
+
open: $.noop,
|
371
|
+
overrideMimeType: $.noop,
|
372
|
+
readyState: 4,
|
373
|
+
responseText: "",
|
374
|
+
responseXML: null,
|
375
|
+
send: $.noop,
|
376
|
+
setRequestHeader: $.noop,
|
377
|
+
status: 200,
|
378
|
+
statusText: "OK"
|
379
|
+
}, xhr);
|
380
|
+
}
|
381
|
+
})
|
382
|
+
/**
|
383
|
+
* @attribute delay
|
384
|
+
* Sets the delay in milliseconds between an ajax request is made and
|
385
|
+
* the success and complete handlers are called. This only sets
|
386
|
+
* functional fixtures. By default, the delay is 200ms.
|
387
|
+
* @codestart
|
388
|
+
* steal.plugins('jquery/dom/fixtures').then(function(){
|
389
|
+
* $.fixture.delay = 1000;
|
390
|
+
* })
|
391
|
+
* @codeend
|
392
|
+
*/
|
393
|
+
$.fixture.delay = 200
|
394
|
+
$.fixture["-handleFunction"] = function( settings ) {
|
395
|
+
if ( typeof settings.fixture == "string" && $.fixture[settings.fixture] ) {
|
396
|
+
settings.fixture = $.fixture[settings.fixture]
|
397
|
+
}
|
398
|
+
if ( typeof settings.fixture == "function" ) {
|
399
|
+
setTimeout(function() {
|
400
|
+
if ( settings.success ) {
|
401
|
+
settings.success.apply(null, settings.fixture(settings, "success"))
|
402
|
+
}
|
403
|
+
if ( settings.complete ) {
|
404
|
+
settings.complete.apply(null, settings.fixture(settings, "complete"))
|
405
|
+
}
|
406
|
+
}, $.fixture.delay);
|
407
|
+
return true;
|
408
|
+
}
|
409
|
+
return false;
|
410
|
+
}
|
411
|
+
|
412
|
+
/**
|
413
|
+
* @add jQuery
|
414
|
+
*/
|
415
|
+
// break
|
416
|
+
$.
|
417
|
+
/**
|
418
|
+
* Adds the fixture option to settings. If present, loads from fixture location instead
|
419
|
+
* of provided url. This is useful for simulating ajax responses before the server is done.
|
420
|
+
* @param {Object} settings
|
421
|
+
*/
|
422
|
+
ajax = function( settings ) {
|
423
|
+
var func = $.fixture
|
424
|
+
if (!settings.fixture ) {
|
425
|
+
return ajax.apply($, arguments);
|
426
|
+
}
|
427
|
+
if ( $.fixture["-handleFunction"](settings) ) {
|
428
|
+
return;
|
429
|
+
}
|
430
|
+
if ( typeof settings.fixture == "string" ) {
|
431
|
+
var url = settings.fixture;
|
432
|
+
if (/^\/\//.test(url) ) {
|
433
|
+
url = steal.root.join(settings.fixture.substr(2))
|
434
|
+
}
|
435
|
+
//@steal-remove-start
|
436
|
+
steal.dev.log("looking for fixture in " + url)
|
437
|
+
//@steal-remove-end
|
438
|
+
settings.url = url
|
439
|
+
settings.data = null;
|
440
|
+
settings.type = "GET"
|
441
|
+
if (!settings.error ) {
|
442
|
+
settings.error = function( xhr, error, message ) {
|
443
|
+
throw "fixtures.js Error " + error + " " + message;
|
444
|
+
}
|
445
|
+
}
|
446
|
+
return ajax(settings);
|
447
|
+
|
448
|
+
}
|
449
|
+
var settings = jQuery.extend(true, settings, jQuery.extend(true, {}, jQuery.ajaxSettings, settings));
|
450
|
+
|
451
|
+
settings.url = steal.root.join('test/fixtures/' + func(settings)); // convert settings
|
452
|
+
settings.data = null;
|
453
|
+
settings.type = 'GET';
|
454
|
+
return ajax(settings);
|
455
|
+
}
|
456
|
+
|
457
|
+
$.extend($.ajax, ajax)
|
458
|
+
|
459
|
+
$.
|
460
|
+
/**
|
461
|
+
* Adds a fixture param.
|
462
|
+
* @param {Object} url
|
463
|
+
* @param {Object} data
|
464
|
+
* @param {Object} callback
|
465
|
+
* @param {Object} type
|
466
|
+
* @param {Object} fixture
|
467
|
+
*/
|
468
|
+
get = function( url, data, callback, type, fixture ) {
|
469
|
+
// shift arguments if data argument was ommited
|
470
|
+
if ( jQuery.isFunction(data) ) {
|
471
|
+
fixture = type;
|
472
|
+
type = callback;
|
473
|
+
callback = data;
|
474
|
+
data = null;
|
475
|
+
}
|
476
|
+
|
477
|
+
return jQuery.ajax({
|
478
|
+
type: "GET",
|
479
|
+
url: url,
|
480
|
+
data: data,
|
481
|
+
success: callback,
|
482
|
+
dataType: type,
|
483
|
+
fixture: fixture
|
484
|
+
});
|
485
|
+
}
|
486
|
+
|
487
|
+
$.
|
488
|
+
/**
|
489
|
+
* Adds a fixture param.
|
490
|
+
* @param {Object} url
|
491
|
+
* @param {Object} data
|
492
|
+
* @param {Object} callback
|
493
|
+
* @param {Object} type
|
494
|
+
* @param {Object} fixture
|
495
|
+
*/
|
496
|
+
post = function( url, data, callback, type, fixture ) {
|
497
|
+
if ( jQuery.isFunction(data) ) {
|
498
|
+
fixture = type;
|
499
|
+
type = callback;
|
500
|
+
callback = data;
|
501
|
+
data = {};
|
502
|
+
}
|
503
|
+
|
504
|
+
return jQuery.ajax({
|
505
|
+
type: "POST",
|
506
|
+
url: url,
|
507
|
+
data: data,
|
508
|
+
success: callback,
|
509
|
+
dataType: type,
|
510
|
+
fixture: fixture
|
511
|
+
});
|
512
|
+
}
|
513
|
+
|
514
|
+
|
515
|
+
|
516
|
+
|
517
|
+
|
518
|
+
|
519
|
+
|
520
|
+
|
521
|
+
});
|