railscart 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -0
- data/License.txt +26 -0
- data/Manifest.txt +462 -0
- data/README.txt +1 -0
- data/Rakefile +4 -0
- data/bin/railscart +114 -0
- data/config/hoe.rb +78 -0
- data/config/requirements.rb +19 -0
- data/lib/railscart.rb +5 -0
- data/lib/railscart/version.rb +9 -0
- data/log/debug.log +0 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +74 -0
- data/setup.rb +1585 -0
- data/starter-app/README +182 -0
- data/starter-app/Rakefile +10 -0
- data/starter-app/app/controllers/application.rb +14 -0
- data/starter-app/app/helpers/application_helper.rb +3 -0
- data/starter-app/app/models/role.rb +3 -0
- data/starter-app/app/models/tag.rb +37 -0
- data/starter-app/app/models/tagging.rb +16 -0
- data/starter-app/app/models/user.rb +101 -0
- data/starter-app/app/views/layouts/application.rhtml +20 -0
- data/starter-app/config/boot.rb +45 -0
- data/starter-app/config/database.yml +23 -0
- data/starter-app/config/environment.rb +119 -0
- data/starter-app/config/environments/development.rb +21 -0
- data/starter-app/config/environments/production.rb +21 -0
- data/starter-app/config/environments/test.rb +19 -0
- data/starter-app/config/routes.rb +28 -0
- data/starter-app/db/migrate/001_add_sessions.rb +16 -0
- data/starter-app/db/migrate/002_create_tags_and_taggings.rb +28 -0
- data/starter-app/db/migrate/003_railscart_to_version_19.rb +9 -0
- data/starter-app/db/migrate/004_railscart_to_version_20.rb +9 -0
- data/starter-app/db/migrate/005_create_users.rb +17 -0
- data/starter-app/db/migrate/006_create_roles.rb +20 -0
- data/starter-app/db/sample/addresses.yml +29 -0
- data/starter-app/db/sample/categories.yml +35 -0
- data/starter-app/db/sample/countries.yml +4 -0
- data/starter-app/db/sample/line_items.yml +32 -0
- data/starter-app/db/sample/option_groups.yml +16 -0
- data/starter-app/db/sample/option_values.yml +13 -0
- data/starter-app/db/sample/options.yml +3 -0
- data/starter-app/db/sample/orders.yml +17 -0
- data/starter-app/db/sample/products.yml +70 -0
- data/starter-app/db/sample/roles.yml +3 -0
- data/starter-app/db/sample/skus.yml +35 -0
- data/starter-app/db/sample/states.yml +204 -0
- data/starter-app/db/sample/taggings.yml +16 -0
- data/starter-app/db/sample/tags.yml +6 -0
- data/starter-app/db/sample/txns.yml +13 -0
- data/starter-app/db/sample/users.yml +10 -0
- data/starter-app/db/sample/variations.yml +20 -0
- data/starter-app/doc/README_FOR_APP +2 -0
- data/starter-app/lib/authenticated_system.rb +116 -0
- data/starter-app/lib/authenticated_test_helper.rb +10 -0
- data/starter-app/lib/custom_fixtures.rb +7 -0
- data/starter-app/lib/hijacker.rb +78 -0
- data/starter-app/lib/role_requirement_system.rb +142 -0
- data/starter-app/lib/role_requirement_test_helper.rb +86 -0
- data/starter-app/lib/tagging_extensions.rb +104 -0
- data/starter-app/lib/tasks/rc_sample_data.rake +31 -0
- data/starter-app/lib/tasks/sample/images/ror_bag.jpg +0 -0
- data/starter-app/lib/tasks/sample/images/ror_baseball_jersey.jpg +0 -0
- data/starter-app/lib/tasks/sample/images/ror_jr_spaghetti.jpg +0 -0
- data/starter-app/lib/tasks/sample/images/ror_mug.jpg +0 -0
- data/starter-app/lib/tasks/sample/images/ror_ringer_tshirt.jpg +0 -0
- data/starter-app/lib/tasks/sample/images/ror_stein.jpg +0 -0
- data/starter-app/lib/tasks/sample/images/ror_tote.jpg +0 -0
- data/starter-app/public/.htaccess +40 -0
- data/starter-app/public/404.html +30 -0
- data/starter-app/public/500.html +30 -0
- data/starter-app/public/dispatch.cgi +10 -0
- data/starter-app/public/dispatch.fcgi +24 -0
- data/starter-app/public/dispatch.rb +10 -0
- data/starter-app/public/favicon.ico +0 -0
- data/starter-app/public/images/rails.png +0 -0
- data/starter-app/public/index.html +277 -0
- data/starter-app/public/javascripts/application.js +2 -0
- data/starter-app/public/javascripts/controls.js +833 -0
- data/starter-app/public/javascripts/dragdrop.js +942 -0
- data/starter-app/public/javascripts/effects.js +1088 -0
- data/starter-app/public/javascripts/prototype.js +4184 -0
- data/starter-app/public/robots.txt +1 -0
- data/starter-app/public/stylesheets/application.css +186 -0
- data/starter-app/public/stylesheets/cart/_controller.css +4 -0
- data/starter-app/public/stylesheets/checkout/_controller.css +13 -0
- data/starter-app/script/about +3 -0
- data/starter-app/script/breakpointer +3 -0
- data/starter-app/script/console +3 -0
- data/starter-app/script/destroy +3 -0
- data/starter-app/script/generate +3 -0
- data/starter-app/script/performance/benchmarker +3 -0
- data/starter-app/script/performance/profiler +3 -0
- data/starter-app/script/plugin +3 -0
- data/starter-app/script/process/inspector +3 -0
- data/starter-app/script/process/reaper +3 -0
- data/starter-app/script/process/spawner +3 -0
- data/starter-app/script/runner +3 -0
- data/starter-app/script/server +3 -0
- data/starter-app/test/fixtures/users.yml +7 -0
- data/starter-app/test/test_helper.rb +28 -0
- data/starter-app/test/unit/user_test.rb +8 -0
- data/starter-app/vendor/plugins/acts_as_list/README +23 -0
- data/starter-app/vendor/plugins/acts_as_list/init.rb +3 -0
- data/starter-app/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb +256 -0
- data/starter-app/vendor/plugins/acts_as_list/test/list_test.rb +332 -0
- data/starter-app/vendor/plugins/acts_as_tree/README +26 -0
- data/starter-app/vendor/plugins/acts_as_tree/Rakefile +22 -0
- data/starter-app/vendor/plugins/acts_as_tree/init.rb +1 -0
- data/starter-app/vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb +96 -0
- data/starter-app/vendor/plugins/acts_as_tree/test/abstract_unit.rb +0 -0
- data/starter-app/vendor/plugins/acts_as_tree/test/acts_as_tree_test.rb +219 -0
- data/starter-app/vendor/plugins/acts_as_tree/test/database.yml +0 -0
- data/starter-app/vendor/plugins/acts_as_tree/test/fixtures/mixin.rb +0 -0
- data/starter-app/vendor/plugins/acts_as_tree/test/fixtures/mixins.yml +0 -0
- data/starter-app/vendor/plugins/acts_as_tree/test/schema.rb +0 -0
- data/starter-app/vendor/plugins/calendar_date_select/CHANGELOG +170 -0
- data/starter-app/vendor/plugins/calendar_date_select/MIT-LICENSE +20 -0
- data/starter-app/vendor/plugins/calendar_date_select/README +10 -0
- data/starter-app/vendor/plugins/calendar_date_select/init.rb +15 -0
- data/starter-app/vendor/plugins/calendar_date_select/js_test/functional/.tmp_cds_test.html +306 -0
- data/starter-app/vendor/plugins/calendar_date_select/js_test/functional/cds_test.html +324 -0
- data/starter-app/vendor/plugins/calendar_date_select/js_test/prototype.js +4184 -0
- data/starter-app/vendor/plugins/calendar_date_select/js_test/test.css +40 -0
- data/starter-app/vendor/plugins/calendar_date_select/js_test/unit/cds_helper_methods.html +46 -0
- data/starter-app/vendor/plugins/calendar_date_select/js_test/unittest.js +564 -0
- data/starter-app/vendor/plugins/calendar_date_select/lib/calendar_date_select.rb +192 -0
- data/starter-app/vendor/plugins/calendar_date_select/lib/includes_helper.rb +22 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/images/calendar_date_select/calendar.gif +0 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/calendar_date_select.js +439 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_american.js +34 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_euro_24hr.js +7 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_finnish.js +24 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_hyphen_ampm.js +36 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_italian.js +24 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/locale/fi.js +10 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/blue.css +130 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/default.css +135 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/plain.css +128 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/red.css +135 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/silver.css +133 -0
- data/starter-app/vendor/plugins/calendar_date_select/test/functional/calendar_date_select_test.rb +95 -0
- data/starter-app/vendor/plugins/calendar_date_select/test/functional/helper_methods_test.rb +15 -0
- data/starter-app/vendor/plugins/calendar_date_select/test/test_helper.rb +26 -0
- data/starter-app/vendor/plugins/engines/CHANGELOG +258 -0
- data/starter-app/vendor/plugins/engines/MIT-LICENSE +21 -0
- data/starter-app/vendor/plugins/engines/README +63 -0
- data/starter-app/vendor/plugins/engines/Rakefile +32 -0
- data/starter-app/vendor/plugins/engines/about.yml +7 -0
- data/starter-app/vendor/plugins/engines/boot.rb +18 -0
- data/starter-app/vendor/plugins/engines/generators/plugin_migration/USAGE +45 -0
- data/starter-app/vendor/plugins/engines/generators/plugin_migration/plugin_migration_generator.rb +79 -0
- data/starter-app/vendor/plugins/engines/generators/plugin_migration/templates/plugin_migration.erb +13 -0
- data/starter-app/vendor/plugins/engines/init.rb +2 -0
- data/starter-app/vendor/plugins/engines/lib/engines.rb +169 -0
- data/starter-app/vendor/plugins/engines/lib/engines/assets.rb +38 -0
- data/starter-app/vendor/plugins/engines/lib/engines/plugin.rb +125 -0
- data/starter-app/vendor/plugins/engines/lib/engines/plugin/list.rb +30 -0
- data/starter-app/vendor/plugins/engines/lib/engines/plugin/loader.rb +18 -0
- data/starter-app/vendor/plugins/engines/lib/engines/plugin/locator.rb +11 -0
- data/starter-app/vendor/plugins/engines/lib/engines/plugin/migrator.rb +60 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/action_mailer.rb +85 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/active_record.rb +24 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/asset_helpers.rb +119 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/dependencies.rb +145 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/migrations.rb +161 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/rails.rb +11 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/routing.rb +84 -0
- data/starter-app/vendor/plugins/engines/lib/engines/testing.rb +87 -0
- data/starter-app/vendor/plugins/engines/tasks/engines.rake +148 -0
- data/starter-app/vendor/plugins/in_place_editing/README +14 -0
- data/starter-app/vendor/plugins/in_place_editing/Rakefile +22 -0
- data/starter-app/vendor/plugins/in_place_editing/init.rb +2 -0
- data/starter-app/vendor/plugins/in_place_editing/lib/in_place_editing.rb +25 -0
- data/starter-app/vendor/plugins/in_place_editing/lib/in_place_macros_helper.rb +71 -0
- data/starter-app/vendor/plugins/in_place_editing/test/in_place_editing_test.rb +69 -0
- data/starter-app/vendor/plugins/paginating_find/CHANGELOG +117 -0
- data/starter-app/vendor/plugins/paginating_find/README +89 -0
- data/starter-app/vendor/plugins/paginating_find/init.rb +2 -0
- data/starter-app/vendor/plugins/paginating_find/lib/paginating_find.rb +135 -0
- data/starter-app/vendor/plugins/paginating_find/lib/paging_enumerator.rb +158 -0
- data/starter-app/vendor/plugins/paginating_find/lib/paging_helper.rb +47 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/Rakefile +10 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/app/controllers/application.rb +2 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/config/boot.rb +44 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/config/database.yml +6 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/config/environment.rb +53 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/config/environments/test.rb +19 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/config/routes.rb +22 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/db/schema.rb +16 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/script/breakpointer +3 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/script/console +3 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/fixtures/articles.yml +19 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/fixtures/authors.yml +7 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/fixtures/edits.yml +11 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/fixtures/models.rb +18 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/test_helper.rb +33 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/unit/abstract_test.rb +7 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/unit/group_test.rb +40 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/unit/paginating_find_test.rb +194 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/unit/paging_enumerator_test.rb +143 -0
- data/starter-app/vendor/plugins/railscart/.rakeTasks +7 -0
- data/starter-app/vendor/plugins/railscart/CHANGELOG +1 -0
- data/starter-app/vendor/plugins/railscart/LICENSE +26 -0
- data/starter-app/vendor/plugins/railscart/README +2 -0
- data/starter-app/vendor/plugins/railscart/Rakefile +10 -0
- data/starter-app/vendor/plugins/railscart/VERSION +1 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/account_controller.rb +48 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/base_controller.rb +7 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/categories_controller.rb +107 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/option_groups_controller.rb +36 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/option_values_controller.rb +42 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/options_controller.rb +52 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/orders_controller.rb +194 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/overview_controller.rb +14 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/products_controller.rb +147 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/reports_controller.rb +53 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/users_controller.rb +45 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/variations_controller.rb +73 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/cart_controller.rb +45 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/checkout_controller.rb +179 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/rails_cart/base_controller.rb +41 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/store_controller.rb +20 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/account_helper.rb +2 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/admin/base_helper.rb +15 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/admin/categories_helper.rb +3 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/admin/option_groups_helper.rb +2 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/admin/option_values_helper.rb +2 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/admin/orders_helper.rb +11 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/admin/overview_helper.rb +12 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/admin/users_helper.rb +2 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/admin/variations_helper.rb +2 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/cart_helper.rb +6 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/checkout_helper.rb +17 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/rails_cart/base_helper.rb +67 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/search_helper.rb +10 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/store_helper.rb +3 -0
- data/starter-app/vendor/plugins/railscart/app/models/address.rb +17 -0
- data/starter-app/vendor/plugins/railscart/app/models/cart.rb +37 -0
- data/starter-app/vendor/plugins/railscart/app/models/cart_item.rb +28 -0
- data/starter-app/vendor/plugins/railscart/app/models/category.rb +66 -0
- data/starter-app/vendor/plugins/railscart/app/models/country.rb +3 -0
- data/starter-app/vendor/plugins/railscart/app/models/line_item.rb +24 -0
- data/starter-app/vendor/plugins/railscart/app/models/option.rb +4 -0
- data/starter-app/vendor/plugins/railscart/app/models/option_group.rb +6 -0
- data/starter-app/vendor/plugins/railscart/app/models/option_value.rb +4 -0
- data/starter-app/vendor/plugins/railscart/app/models/order.rb +86 -0
- data/starter-app/vendor/plugins/railscart/app/models/order_mailer.rb +20 -0
- data/starter-app/vendor/plugins/railscart/app/models/payment.rb +49 -0
- data/starter-app/vendor/plugins/railscart/app/models/product.rb +76 -0
- data/starter-app/vendor/plugins/railscart/app/models/search_criteria.rb +27 -0
- data/starter-app/vendor/plugins/railscart/app/models/sku.rb +7 -0
- data/starter-app/vendor/plugins/railscart/app/models/state.rb +3 -0
- data/starter-app/vendor/plugins/railscart/app/models/tax_treatment.rb +2 -0
- data/starter-app/vendor/plugins/railscart/app/models/txn.rb +7 -0
- data/starter-app/vendor/plugins/railscart/app/models/variation.rb +5 -0
- data/starter-app/vendor/plugins/railscart/app/views/account/index.rhtml +3 -0
- data/starter-app/vendor/plugins/railscart/app/views/account/login.rhtml +12 -0
- data/starter-app/vendor/plugins/railscart/app/views/account/signup.rhtml +16 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/categories/_form.rhtml +27 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/categories/edit.rhtml +9 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/categories/list.rhtml +47 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/categories/new.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/option_groups/_form.rhtml +19 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/option_groups/new.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/option_values/_form.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/option_values/edit.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/option_values/list.rhtml +22 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/option_values/new.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/options/_form.rhtml +7 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/options/edit.rhtml +26 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/options/list.rhtml +23 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/options/new.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/orders/_address.rhtml +37 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/orders/index.rhtml +99 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/orders/show.rhtml +43 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/overview/index.rhtml +0 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/products/_form.rhtml +55 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/products/_menu.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/products/_new_variation.rhtml +0 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/products/edit.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/products/index.rhtml +66 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/products/new.rhtml +13 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/products/show.rhtml +26 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/reports/index.rhtml +29 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/reports/sales_total.rhtml +28 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/users/_form.rhtml +29 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/users/_menu.rhtml +5 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/users/edit.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/users/index.rhtml +26 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/users/new.rhtml +6 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/users/show.rhtml +9 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/variations/_form.rhtml +33 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/variations/_option_values.rhtml +5 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/variations/list.rhtml +23 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/variations/new.rhtml +14 -0
- data/starter-app/vendor/plugins/railscart/app/views/cart/index.rhtml +49 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/_address.rhtml +51 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/_address_ro.rhtml +18 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/_cart_item.rhtml +5 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/_extra.rhtml +1 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/addresses.rhtml +49 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/cvv.rhtml +15 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/empty_cart.rhtml +4 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/final_confirmation.rhtml +92 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/incomplete.rhtml +7 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/thank_you.rhtml +11 -0
- data/starter-app/vendor/plugins/railscart/app/views/layouts/admin.rhtml +69 -0
- data/starter-app/vendor/plugins/railscart/app/views/layouts/products.rhtml +20 -0
- data/starter-app/vendor/plugins/railscart/app/views/layouts/simple.rhtml +37 -0
- data/starter-app/vendor/plugins/railscart/app/views/order_mailer/cancel.rhtml +15 -0
- data/starter-app/vendor/plugins/railscart/app/views/order_mailer/confirm.rhtml +18 -0
- data/starter-app/vendor/plugins/railscart/app/views/shared/_order_details.rhtml +35 -0
- data/starter-app/vendor/plugins/railscart/app/views/shared/_paginate.rhtml +34 -0
- data/starter-app/vendor/plugins/railscart/app/views/shared/_report_criteria.rhtml +32 -0
- data/starter-app/vendor/plugins/railscart/app/views/shared/_tax_treatments.rhtml +12 -0
- data/starter-app/vendor/plugins/railscart/app/views/shared/_variations.rhtml +60 -0
- data/starter-app/vendor/plugins/railscart/app/views/store/_menu.rhtml +7 -0
- data/starter-app/vendor/plugins/railscart/app/views/store/_products.rhtml +10 -0
- data/starter-app/vendor/plugins/railscart/app/views/store/list.rhtml +16 -0
- data/starter-app/vendor/plugins/railscart/app/views/store/show.rhtml +71 -0
- data/starter-app/vendor/plugins/railscart/assets/.htaccess +40 -0
- data/starter-app/vendor/plugins/railscart/assets/404.html +30 -0
- data/starter-app/vendor/plugins/railscart/assets/500.html +30 -0
- data/starter-app/vendor/plugins/railscart/assets/dispatch.cgi +10 -0
- data/starter-app/vendor/plugins/railscart/assets/dispatch.fcgi +24 -0
- data/starter-app/vendor/plugins/railscart/assets/dispatch.rb +10 -0
- data/starter-app/vendor/plugins/railscart/assets/favicon.ico +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/amex_cid.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/creditcard.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/discover_cid.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/master_cid.jpg +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/products/ror_bag.jpg +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/products/ror_baseball_jersey.jpg +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/products/ror_jr_spaghetti.jpg +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/products/ror_mug.jpg +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/products/ror_ringer_tshirt.jpg +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/products/ror_stein.jpg +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/products/ror_tote.jpg +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/rails.png +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/railscart/progress.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/railscart/railscart_logo142x65.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/railscart/railscart_logo245x112.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/railscart/spinner.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/spinner.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/visa_cid.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/javascripts/application.js +2 -0
- data/starter-app/vendor/plugins/railscart/assets/javascripts/controls.js +833 -0
- data/starter-app/vendor/plugins/railscart/assets/javascripts/dragdrop.js +942 -0
- data/starter-app/vendor/plugins/railscart/assets/javascripts/effects.js +1088 -0
- data/starter-app/vendor/plugins/railscart/assets/javascripts/lowpro.js +307 -0
- data/starter-app/vendor/plugins/railscart/assets/javascripts/prototype.js +2515 -0
- data/starter-app/vendor/plugins/railscart/assets/robots.txt +1 -0
- data/starter-app/vendor/plugins/railscart/assets/stylesheets/cart/_controller.css +71 -0
- data/starter-app/vendor/plugins/railscart/assets/stylesheets/checkout/_controller.css +31 -0
- data/starter-app/vendor/plugins/railscart/assets/stylesheets/fullscreen.css +63 -0
- data/starter-app/vendor/plugins/railscart/assets/stylesheets/orders/_controller.css +3 -0
- data/starter-app/vendor/plugins/railscart/assets/stylesheets/products/_controller.css +13 -0
- data/starter-app/vendor/plugins/railscart/assets/stylesheets/railscart-admin.css +295 -0
- data/starter-app/vendor/plugins/railscart/assets/stylesheets/railscart.css +66 -0
- data/starter-app/vendor/plugins/railscart/assets/stylesheets/store/_controller.css +23 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/001_create_addresses.rb +22 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/002_create_cart_items.rb +14 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/003_create_carts.rb +12 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/004_create_categories.rb +15 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/005_create_categories_products.rb +12 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/006_create_line_items.rb +17 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/007_create_option_groups.rb +12 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/008_create_option_values.rb +11 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/009_create_options.rb +11 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/010_create_orders.rb +24 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/011_create_products.rb +22 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/012_ignore_users.rb +9 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/013_create_txns.rb +21 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/014_ignore_roles.rb +9 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/015_create_variations.rb +14 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/016_create_tax_treatments.rb +23 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/017_create_skus.rb +13 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/018_create_countries.rb +11 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/019_create_states.rb +13 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/020_modify_users.rb +9 -0
- data/starter-app/vendor/plugins/railscart/init.rb +16 -0
- data/starter-app/vendor/plugins/railscart/install.rb +3 -0
- data/starter-app/vendor/plugins/railscart/lib/constants/enumerable_constants.rb +207 -0
- data/starter-app/vendor/plugins/railscart/lib/format.rb +12 -0
- data/starter-app/vendor/plugins/railscart/lib/gateway/bogus_gateway.rb +63 -0
- data/starter-app/vendor/plugins/railscart/lib/shipping/flat_rate.rb +10 -0
- data/starter-app/vendor/plugins/railscart/lib/tasks/rc_bootstrap.rake +24 -0
- data/starter-app/vendor/plugins/railscart/lib/tax/sales_tax.rb +26 -0
- data/starter-app/vendor/plugins/railscart/routes.rb +3 -0
- data/starter-app/vendor/plugins/railscart/script/about +3 -0
- data/starter-app/vendor/plugins/railscart/script/breakpointer +3 -0
- data/starter-app/vendor/plugins/railscart/script/console +3 -0
- data/starter-app/vendor/plugins/railscart/script/destroy +3 -0
- data/starter-app/vendor/plugins/railscart/script/generate +3 -0
- data/starter-app/vendor/plugins/railscart/script/performance/benchmarker +3 -0
- data/starter-app/vendor/plugins/railscart/script/performance/profiler +3 -0
- data/starter-app/vendor/plugins/railscart/script/plugin +3 -0
- data/starter-app/vendor/plugins/railscart/script/process/inspector +3 -0
- data/starter-app/vendor/plugins/railscart/script/process/reaper +3 -0
- data/starter-app/vendor/plugins/railscart/script/process/spawner +3 -0
- data/starter-app/vendor/plugins/railscart/script/runner +3 -0
- data/starter-app/vendor/plugins/railscart/script/server +3 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/addresses.yml +29 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/categories.yml +40 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/line_items.yml +32 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/orders.yml +17 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/products.yml +63 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/products_tags.yml +10 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/roles.yml +6 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/roles_users.yml +3 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/skus.yml +5 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/tags.yml +7 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/tax_treatments.yml +7 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/txns.yml +13 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/users.yml +40 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/variations.yml +16 -0
- data/starter-app/vendor/plugins/railscart/test/functional/account_controller_test.rb +129 -0
- data/starter-app/vendor/plugins/railscart/test/functional/admin/base_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/railscart/test/functional/admin/option_groups_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/railscart/test/functional/admin/option_values_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/railscart/test/functional/admin/orders_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/railscart/test/functional/admin/overview_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/railscart/test/functional/admin/products_controller_test.rb +125 -0
- data/starter-app/vendor/plugins/railscart/test/functional/admin/users_controller_test.rb +58 -0
- data/starter-app/vendor/plugins/railscart/test/functional/admin/variations_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/railscart/test/functional/application_controller_test.rb +30 -0
- data/starter-app/vendor/plugins/railscart/test/functional/cart_controller_test.rb +76 -0
- data/starter-app/vendor/plugins/railscart/test/functional/checkout_controller_test.rb +20 -0
- data/starter-app/vendor/plugins/railscart/test/integration/authentication_test.rb +53 -0
- data/starter-app/vendor/plugins/railscart/test/integration/product_admin_test.rb +135 -0
- data/starter-app/vendor/plugins/railscart/test/integration/user_stories_test.rb +59 -0
- data/starter-app/vendor/plugins/railscart/test/integration/variations_test.rb +24 -0
- data/starter-app/vendor/plugins/railscart/test/test_helper.rb +45 -0
- data/starter-app/vendor/plugins/railscart/test/unit/address_test.rb +10 -0
- data/starter-app/vendor/plugins/railscart/test/unit/cart_item_test.rb +55 -0
- data/starter-app/vendor/plugins/railscart/test/unit/cart_test.rb +35 -0
- data/starter-app/vendor/plugins/railscart/test/unit/category_test.rb +52 -0
- data/starter-app/vendor/plugins/railscart/test/unit/line_item_test.rb +61 -0
- data/starter-app/vendor/plugins/railscart/test/unit/option_group_test.rb +12 -0
- data/starter-app/vendor/plugins/railscart/test/unit/order_test.rb +49 -0
- data/starter-app/vendor/plugins/railscart/test/unit/product_test.rb +107 -0
- data/starter-app/vendor/plugins/railscart/test/unit/role_test.rb +10 -0
- data/starter-app/vendor/plugins/railscart/test/unit/sales_tax_test.rb +46 -0
- data/starter-app/vendor/plugins/railscart/test/unit/sku_test.rb +10 -0
- data/starter-app/vendor/plugins/railscart/test/unit/tag_test.rb +9 -0
- data/starter-app/vendor/plugins/railscart/test/unit/tax_treatment_test.rb +10 -0
- data/starter-app/vendor/plugins/railscart/test/unit/txn_test.rb +10 -0
- data/starter-app/vendor/plugins/railscart/test/unit/variation_test.rb +9 -0
- data/starter-app/vendor/plugins/railscart/uninstall.rb +1 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/environment.rake +7 -0
- data/tasks/website.rake +17 -0
- data/test/test_helper.rb +2 -0
- data/test/test_railscart.rb +11 -0
- data/website/index.html +93 -0
- data/website/index.txt +39 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/screen.css +138 -0
- data/website/template.rhtml +48 -0
- metadata +557 -0
@@ -0,0 +1,306 @@
|
|
1
|
+
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<title>Calendar Date Select Test Cases</title>
|
7
|
+
<script src="../prototype.js" type="text/javascript"></script>
|
8
|
+
<script src="../unittest.js" type="text/javascript"></script>
|
9
|
+
<!-- other JavaScript includes -->
|
10
|
+
<script src="../../public/javascripts/calendar_date_select/calendar_date_select.js" type="text/javascript"></script>
|
11
|
+
|
12
|
+
<link rel="stylesheet" href="../../public/stylesheets/calendar_date_select/red.css" type="text/css" />
|
13
|
+
<link rel="stylesheet" href="../test.css" type="text/css" />
|
14
|
+
</head>
|
15
|
+
<body>
|
16
|
+
|
17
|
+
<!-- Log output -->
|
18
|
+
<div id="testlog"> </div>
|
19
|
+
|
20
|
+
<!-- here go any elements you do the testing on -->
|
21
|
+
<div id="cds_test_div">
|
22
|
+
<input type="text" id="cds_test" />
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<!-- Tests -->
|
26
|
+
<script type="text/javascript" language="javascript">
|
27
|
+
// <![CDATA[
|
28
|
+
new Test.Unit.Runner({
|
29
|
+
setup: function() { with(this){
|
30
|
+
$("cds_test").value="";
|
31
|
+
$("cds_test").disabled = false;
|
32
|
+
$("cds_test").readOnly = false;
|
33
|
+
}},
|
34
|
+
teardown: function() { with(this){
|
35
|
+
if (typeof(cds)!="undefined")
|
36
|
+
assert(cds.closed,"all tests should close their calendar control");
|
37
|
+
}},
|
38
|
+
testMixedTime_feedDateWithAndWithoutTime_shouldSetAccordingly: function() { with(this) {
|
39
|
+
$A(["January 2, 2007 5:00 pm", "January 2, 2007 0:00 pm"]).each(function(d) {
|
40
|
+
$("cds_test").value=d;
|
41
|
+
cds = new CalendarDateSelect($("cds_test"), {time: "mixed"});
|
42
|
+
assertEqual(true, cds.use_time);
|
43
|
+
cds.close();
|
44
|
+
})
|
45
|
+
|
46
|
+
$("cds_test").value="January 2, 2007";
|
47
|
+
cds = new CalendarDateSelect($("cds_test"), {time: "mixed"});
|
48
|
+
assertEqual(false, cds.use_time);
|
49
|
+
cds.close();
|
50
|
+
}},
|
51
|
+
testTodayNowButton_mixedMode_shouldSetUseTimeAccordingly: function() { with(this){
|
52
|
+
cds = new CalendarDateSelect($("cds_test"), {time: "mixed"});
|
53
|
+
today_now = $$(".cds_buttons a[href=#]");
|
54
|
+
today_now[0].onclick();
|
55
|
+
assertEqual(false, cds.use_time, "when clicking today link");
|
56
|
+
|
57
|
+
today_now[1].onclick();
|
58
|
+
assertEqual(true, cds.use_time, "should have been true when clicking now link");
|
59
|
+
cds.close();
|
60
|
+
}},
|
61
|
+
test__selectMar_23_2008__shouldSelectCorrectDate: function() { with(this){
|
62
|
+
$("cds_test").value = "Mar 1, 2008"
|
63
|
+
cds = new CalendarDateSelect($("cds_test"), {time: "true"});
|
64
|
+
cds.updateSelectedDate({month: 2 /*+1*/, day: 23, year: 2008})
|
65
|
+
|
66
|
+
assertEqual("23", $$('td.selected div').first().innerHTML);
|
67
|
+
cds.close();
|
68
|
+
}},
|
69
|
+
test_updateSelectedDate: function() { with(this){
|
70
|
+
$("cds_test").value = "January 1, 2007"
|
71
|
+
cds = new CalendarDateSelect($("cds_test"), {time: "mixed"});
|
72
|
+
|
73
|
+
cds.use_time=true;
|
74
|
+
cds.updateSelectedDate({hour: ""})
|
75
|
+
assertEqual(false, cds.use_time, "when setting hour to ''");
|
76
|
+
|
77
|
+
cds.use_time=true;
|
78
|
+
cds.updateSelectedDate({minute: ""})
|
79
|
+
assertEqual(false, cds.use_time, "when setting minute to ''");
|
80
|
+
|
81
|
+
cds.use_time=false;
|
82
|
+
cds.updateSelectedDate({hour: 0})
|
83
|
+
assertEqual(true, cds.use_time, "when setting hour to 0");
|
84
|
+
|
85
|
+
cds.use_time=false;
|
86
|
+
cds.updateSelectedDate({minute: 0})
|
87
|
+
assertEqual(true, cds.use_time, "when setting minute to 0");
|
88
|
+
|
89
|
+
cds.close();
|
90
|
+
}},
|
91
|
+
test_navYear: function() { with(this){
|
92
|
+
$("cds_test").value = "January 1, 2007";
|
93
|
+
cds = new CalendarDateSelect($("cds_test"), {time: "mixed"});
|
94
|
+
cds.navYear(1870);
|
95
|
+
assertEqual(2007, cds.selected_date.getFullYear());
|
96
|
+
assertEqual(1870, cds.date.getFullYear());
|
97
|
+
cds.close();
|
98
|
+
}},
|
99
|
+
test_navMonth: function() { with(this){
|
100
|
+
$("cds_test").value = "January 1, 2007";
|
101
|
+
cds = new CalendarDateSelect($("cds_test"), {time: "mixed"});
|
102
|
+
cds.navMonth(5);
|
103
|
+
assertEqual(0, cds.selected_date.getMonth());
|
104
|
+
assertEqual(5, cds.date.getMonth())
|
105
|
+
cds.close();
|
106
|
+
}},
|
107
|
+
test_callBacks: function() { with(this){
|
108
|
+
$("cds_test").up().build("div", {id: "global"});
|
109
|
+
cds = new CalendarDateSelect($("cds_test"), {time: "mixed",
|
110
|
+
before_show: function() { $("global").before_show_called = true},
|
111
|
+
after_show: function() { $("global").after_show_called = true},
|
112
|
+
before_close: function() { $("global").before_close_called = true},
|
113
|
+
after_close: function() { $("global").after_close_called = true},
|
114
|
+
after_navigate: function() { $("global").after_navigate_called = true},
|
115
|
+
onchange: function() { $("global").onchange_called = true},
|
116
|
+
});
|
117
|
+
cds.navMonth(1);
|
118
|
+
cds.navMonth(10);
|
119
|
+
cds.updateSelectedDate({month: 1, day: 3, year: 2007});
|
120
|
+
cds.close();
|
121
|
+
assert($('global').before_show_called, "before_show wasnt called");
|
122
|
+
assert($('global').after_show_called, "after_show wasnt called");
|
123
|
+
assert($('global').before_close_called, "before_close wasnt called");
|
124
|
+
assert($('global').after_close_called, "after_close wasnt called");
|
125
|
+
assert($('global').after_navigate_called, "after_navigate wasnt called");
|
126
|
+
assert($('global').onchange_called, "onchange wasnt called");
|
127
|
+
$("global").remove();
|
128
|
+
}},
|
129
|
+
test_disabledElement_cantUpdate: function() {with(this){
|
130
|
+
$("cds_test").value = "May 10, 2007";
|
131
|
+
$("cds_test").disabled = true;
|
132
|
+
cds = new CalendarDateSelect($("cds_test"));
|
133
|
+
|
134
|
+
runTest = function() {
|
135
|
+
cds.updateSelectedDate({day: 1, month:0, year: 2007});
|
136
|
+
assertEqual(10, cds.selected_date.getDate())
|
137
|
+
}
|
138
|
+
runTest();
|
139
|
+
$("cds_test").disabled = false;
|
140
|
+
$("cds_test").readOnly = true;
|
141
|
+
runTest();
|
142
|
+
|
143
|
+
$("cds_test").readOnly = false;
|
144
|
+
cds.close();
|
145
|
+
}},
|
146
|
+
test_readOnlyElement_forcePopup_shouldUpdate: function() {with(this){
|
147
|
+
$("cds_test").value = "May 10, 2007";
|
148
|
+
$("cds_test").readOnly = true;
|
149
|
+
cds = new CalendarDateSelect($("cds_test"), {popup: "force"});
|
150
|
+
|
151
|
+
cds.updateSelectedDate({day: 1, month:0, year: 2007});
|
152
|
+
assertEqual(1, cds.selected_date.getDate())
|
153
|
+
|
154
|
+
$("cds_test").readOnly = false;
|
155
|
+
cds.close();
|
156
|
+
}},
|
157
|
+
test_timePassed_notUsingTime_shouldIgnore: function() {with(this) {
|
158
|
+
$("cds_test").value = "May 10, 2007 5:00 pm";
|
159
|
+
cds = new CalendarDateSelect($("cds_test"), {time:false});
|
160
|
+
assert(cds.options.get("close_on_click"), "should set close_on_click to true when not using time")
|
161
|
+
assertEqual(false, cds.use_time, "When parsing time");
|
162
|
+
cds.today();
|
163
|
+
assert(cds.closed, "should close when clicking today");
|
164
|
+
assert(!cds.use_time, "Should not use time when calling today");
|
165
|
+
|
166
|
+
cds = new CalendarDateSelect($("cds_test"), {time:false});
|
167
|
+
cds.updateSelectedDate({hours: 5, minutes:30}) // this will close the control
|
168
|
+
assertEqual(false, cds.use_time, "When setting hour/minute");
|
169
|
+
assert(cds.closed);
|
170
|
+
}},
|
171
|
+
test_setUseTime_true_notUsingTime_shouldIgnore: function() {with(this) {
|
172
|
+
$("cds_test").value = "May 10, 2007 5:00 pm";
|
173
|
+
cds = new CalendarDateSelect($("cds_test"), {time:false});
|
174
|
+
assertEqual(false, cds.use_time, "When parsing time");
|
175
|
+
cds.setUseTime(true); // this will close the control
|
176
|
+
assert(! cds.use_time, "After calling setUseTime(true)");
|
177
|
+
cds.close();
|
178
|
+
}},
|
179
|
+
test_setMinute_notOnInterval_usesFloor: function() {with(this){
|
180
|
+
$("cds_test").value = "May 10, 2007 5:25 pm";
|
181
|
+
cds = new CalendarDateSelect($("cds_test"), {time:true});
|
182
|
+
cds.updateSelectedDate({hour: 1, minute: 4});
|
183
|
+
assertEqual(0, cds.selected_date.getMinutes());
|
184
|
+
assertEqual(1, cds.selected_date.getHours());
|
185
|
+
|
186
|
+
cds.close();
|
187
|
+
}},
|
188
|
+
// this checks for a safari 2 bug where safari parses "" as a date back in 1969
|
189
|
+
test_parseDate_blankInput_interpretsAsNotSelected: function() {with(this){
|
190
|
+
$("cds_test").value = " ";
|
191
|
+
cds = new CalendarDateSelect($("cds_test"), {time:true});
|
192
|
+
assertEqual(new Date().getFullYear(), cds.selected_date.getFullYear());
|
193
|
+
assertEqual(new Date().getFullYear(), cds.date.getFullYear());
|
194
|
+
assert(! cds.selection_made)
|
195
|
+
cds.close();
|
196
|
+
}},
|
197
|
+
test_parseDate_timeTrue_noTimePassed_useTimeSetToTrueAnyway: function() {with(this){
|
198
|
+
$("cds_test").value = "December 1, 2007 ";
|
199
|
+
cds = new CalendarDateSelect($("cds_test"), {time:true});
|
200
|
+
assert(cds.use_time)
|
201
|
+
cds.close();
|
202
|
+
}},
|
203
|
+
test_passDivElement__shouldUseChildInputForTargetElement: function() {with(this){
|
204
|
+
cds = new CalendarDateSelect($("cds_test_div"), {time:true});
|
205
|
+
assertEqual("INPUT", cds.target_element.nodeName)
|
206
|
+
cds.close();
|
207
|
+
}},
|
208
|
+
test__flexibleYearRange__datePassedWayBackWhen__shouldInitYearSelectAroundDate: function() {with(this){
|
209
|
+
$("cds_test").value = "July 4, 1776";
|
210
|
+
cds = new CalendarDateSelect($("cds_test_div"), {time:true});
|
211
|
+
assert(cds.flexibleYearRange(), " should have had a flexibleYearRange");
|
212
|
+
assert(cds.year_select.setValue(1776), "Should have allowed me to select 1776");
|
213
|
+
cds.close();
|
214
|
+
}},
|
215
|
+
test__nonflexibleYearRange__dateRangeAtEnds__shouldntAllowNavigationPassedBoundary: function() {with(this){
|
216
|
+
$("cds_test").value = "January 1, 2007";
|
217
|
+
cds = new CalendarDateSelect($("cds_test_div"), {time:true, year_range: [2007, 2007]});
|
218
|
+
|
219
|
+
assert(! cds.navYear(2006), "should not allow year navigation outside of boundary");
|
220
|
+
assert(! cds.navYear(2008), "should not allow year navigation outside of boundary");
|
221
|
+
assert(! cds.navMonth(-1), "shouldnt allow me to go beyond boundary");
|
222
|
+
assert(! cds.navMonth(13), "shouldnt allow me to go beyond boundary");
|
223
|
+
assert(cds.navMonth(1), "should allow me to be in boundary");
|
224
|
+
assert(cds.navYear(2007), "should allow me to be in boundary");
|
225
|
+
cds.close();
|
226
|
+
}},
|
227
|
+
test__nonflexibleYearRange__shouldPopulateRange: function() {with(this){
|
228
|
+
$("cds_test").value = "January 1, 2007";
|
229
|
+
cds = new CalendarDateSelect($("cds_test_div"), {time:true, year_range: [2007, 2007]});
|
230
|
+
assert(cds.year_select.setValue(2007), "should allow me to select 2007");
|
231
|
+
cds.close();
|
232
|
+
}},
|
233
|
+
test__nonflexibleYearRange__initializedWithDateOutsideOfRange__shouldShowNavDateAsClosestToOutsideYear: function() {with(this){
|
234
|
+
$("cds_test").value = "January 1, 1900";
|
235
|
+
cds = new CalendarDateSelect($("cds_test_div"), {time:true, year_range: [1997, 2007]});
|
236
|
+
assertEqual(1997, cds.date.getFullYear(), "When going lesser than year_range");
|
237
|
+
cds.close();
|
238
|
+
|
239
|
+
$("cds_test").value = "January 1, 2010";
|
240
|
+
cds = new CalendarDateSelect($("cds_test_div"), {time:true, year_range: [1997, 2007]});
|
241
|
+
assertEqual(2007, cds.date.getFullYear(), "When going greater than year_range");
|
242
|
+
|
243
|
+
cds.close();
|
244
|
+
}},
|
245
|
+
test__nonflexibleYearRange__initializedWithDateInsideOfRange__shouldShowNavDateAsYear: function() {with(this){
|
246
|
+
$("cds_test").value = "January 1, 2005";
|
247
|
+
cds = new CalendarDateSelect($("cds_test_div"), {year_range: [1997, 2007]});
|
248
|
+
assertEqual(2005, cds.date.getFullYear(), "When going lesser than year_range");
|
249
|
+
cds.close();
|
250
|
+
}},
|
251
|
+
test__flexibleYearRange__goToBoundary__shouldRefreshRange: function() {with(this){
|
252
|
+
$("cds_test").value = "January 1, 2007";
|
253
|
+
cds = new CalendarDateSelect($("cds_test_div"), {year_range: 10});
|
254
|
+
cds.navYear(1997);
|
255
|
+
assert(cds.year_select.setValue(1987), "should have refreshed with 1997 as the center");
|
256
|
+
cds.navYear(2017);
|
257
|
+
assert(cds.year_select.setValue(2027), "should have refreshed with 2027 as the center");
|
258
|
+
cds.close();
|
259
|
+
}},
|
260
|
+
test__should_show_iframe_only_in_ie: function() {with(this){
|
261
|
+
cds = new CalendarDateSelect($("cds_test_div"));
|
262
|
+
|
263
|
+
if (navigator.appName=="Microsoft Internet Explorer")
|
264
|
+
assertEqual(1, $$('iframe.ie6_blocker').length)
|
265
|
+
else
|
266
|
+
assertEqual(0, $$('iframe.ie6_blocker').length)
|
267
|
+
|
268
|
+
cds.close();
|
269
|
+
}},
|
270
|
+
test__should_populate_minute_box_according_to_minute_interval: function() {with(this){
|
271
|
+
cds = new CalendarDateSelect($("cds_test_div"), {time: true, minute_interval: 10});
|
272
|
+
assert(cds.minute_select.setValue(0), "should allow me to select 0 minutes" );
|
273
|
+
assert(!cds.minute_select.setValue(5), "should NOT allow me to select 5 minutes");
|
274
|
+
assert(cds.minute_select.setValue(10), "should allow me to select 10 minutes" );
|
275
|
+
cds.close();
|
276
|
+
}},
|
277
|
+
test__shouldnt_leak_variables: function() {with (this) {
|
278
|
+
var vars = $w("padded2 compare_date str minute hour value e above e_dim e_top e_left matched e_bottom e_height c_pos c_left c_top c_height left_px top_px top_div header_div body_div buttons_div footer_div bottom_div days_tbody row_number cell_index weekday that pre_days use_time m y hover_date x d o")
|
279
|
+
vars.each(function(v) {eval(v + " = -100");});
|
280
|
+
|
281
|
+
cds = new CalendarDateSelect($("cds_test_div"), {time: true});
|
282
|
+
cds.navMonth(1);
|
283
|
+
cds.navYear(2);
|
284
|
+
cds.dayHover($$('.cds_body td').first());
|
285
|
+
cds.updateSelectedDate({day:1, month:1, year:2007});
|
286
|
+
cds.close();
|
287
|
+
|
288
|
+
vars.each(function(v) {
|
289
|
+
assert(-100 == eval(v), "Variable " + v + " was leaked");
|
290
|
+
});
|
291
|
+
}},
|
292
|
+
test__valid_date__shouldnt_allow_selection_of_invalid_dates_and_should_apply_css: function() {with (this) {
|
293
|
+
$('cds_test').value = "December 11, 2007";
|
294
|
+
cds = new CalendarDateSelect($("cds_test_div"), {valid_date_check: function(date) { date < new Date("December 13, 2007")}});
|
295
|
+
cds.updateSelectedDate({day:13, month:12-1, year:2007});
|
296
|
+
cds.close();
|
297
|
+
|
298
|
+
vars.each(function(v) {
|
299
|
+
assert(-100 == eval(v), "Variable " + v + " was leaked");
|
300
|
+
});
|
301
|
+
}}
|
302
|
+
});
|
303
|
+
// ]]>
|
304
|
+
</script>
|
305
|
+
</body>
|
306
|
+
</html>
|
@@ -0,0 +1,324 @@
|
|
1
|
+
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<title>Calendar Date Select Test Cases</title>
|
7
|
+
<script src="../prototype.js" type="text/javascript"></script>
|
8
|
+
<script src="../unittest.js" type="text/javascript"></script>
|
9
|
+
<!-- other JavaScript includes -->
|
10
|
+
<script src="../../public/javascripts/calendar_date_select/calendar_date_select.js" type="text/javascript"></script>
|
11
|
+
|
12
|
+
<link rel="stylesheet" href="../../public/stylesheets/calendar_date_select/red.css" type="text/css" />
|
13
|
+
<link rel="stylesheet" href="../test.css" type="text/css" />
|
14
|
+
</head>
|
15
|
+
<body>
|
16
|
+
|
17
|
+
<!-- Log output -->
|
18
|
+
<div id="testlog"> </div>
|
19
|
+
|
20
|
+
<!-- here go any elements you do the testing on -->
|
21
|
+
<div id="cds_test_div">
|
22
|
+
<input type="text" id="cds_test" />
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<!-- Tests -->
|
26
|
+
<script type="text/javascript" language="javascript">
|
27
|
+
// <![CDATA[
|
28
|
+
new Test.Unit.Runner({
|
29
|
+
setup: function() { with(this){
|
30
|
+
$("cds_test").value="";
|
31
|
+
$("cds_test").disabled = false;
|
32
|
+
$("cds_test").readOnly = false;
|
33
|
+
}},
|
34
|
+
teardown: function() { with(this){
|
35
|
+
if (typeof(cds)!="undefined")
|
36
|
+
assert(cds.closed,"all tests should close their calendar control");
|
37
|
+
}},
|
38
|
+
testMixedTime_feedDateWithAndWithoutTime_shouldSetAccordingly: function() { with(this) {
|
39
|
+
$A(["January 2, 2007 5:00 pm", "January 2, 2007 0:00 pm"]).each(function(d) {
|
40
|
+
$("cds_test").value=d;
|
41
|
+
cds = new CalendarDateSelect($("cds_test"), {time: "mixed"});
|
42
|
+
assertEqual(true, cds.use_time);
|
43
|
+
cds.close();
|
44
|
+
})
|
45
|
+
|
46
|
+
$("cds_test").value="January 2, 2007";
|
47
|
+
cds = new CalendarDateSelect($("cds_test"), {time: "mixed"});
|
48
|
+
assertEqual(false, cds.use_time);
|
49
|
+
cds.close();
|
50
|
+
}},
|
51
|
+
testTodayNowButton_mixedMode_shouldSetUseTimeAccordingly: function() { with(this){
|
52
|
+
cds = new CalendarDateSelect($("cds_test"), {time: "mixed"});
|
53
|
+
today_now = $$(".cds_buttons a[href=#]");
|
54
|
+
today_now[0].onclick();
|
55
|
+
assertEqual(false, cds.use_time, "when clicking today link");
|
56
|
+
|
57
|
+
today_now[1].onclick();
|
58
|
+
assertEqual(true, cds.use_time, "should have been true when clicking now link");
|
59
|
+
cds.close();
|
60
|
+
}},
|
61
|
+
test__selectMar_23_2008__shouldSelectCorrectDate: function() { with(this){
|
62
|
+
$("cds_test").value = "Mar 1, 2008"
|
63
|
+
cds = new CalendarDateSelect($("cds_test"), {time: "true"});
|
64
|
+
cds.updateSelectedDate({month: 2 /*+1*/, day: 23, year: 2008})
|
65
|
+
|
66
|
+
assertEqual("23", $$('td.selected div').first().innerHTML);
|
67
|
+
cds.close();
|
68
|
+
}},
|
69
|
+
test_updateSelectedDate: function() { with(this){
|
70
|
+
$("cds_test").value = "January 1, 2007"
|
71
|
+
cds = new CalendarDateSelect($("cds_test"), {time: "mixed"});
|
72
|
+
|
73
|
+
cds.use_time=true;
|
74
|
+
cds.updateSelectedDate({hour: ""})
|
75
|
+
assertEqual(false, cds.use_time, "when setting hour to ''");
|
76
|
+
|
77
|
+
cds.use_time=true;
|
78
|
+
cds.updateSelectedDate({minute: ""})
|
79
|
+
assertEqual(false, cds.use_time, "when setting minute to ''");
|
80
|
+
|
81
|
+
cds.use_time=false;
|
82
|
+
cds.updateSelectedDate({hour: 0})
|
83
|
+
assertEqual(true, cds.use_time, "when setting hour to 0");
|
84
|
+
|
85
|
+
cds.use_time=false;
|
86
|
+
cds.updateSelectedDate({minute: 0})
|
87
|
+
assertEqual(true, cds.use_time, "when setting minute to 0");
|
88
|
+
|
89
|
+
cds.close();
|
90
|
+
}},
|
91
|
+
test_navYear: function() { with(this){
|
92
|
+
$("cds_test").value = "January 1, 2007";
|
93
|
+
cds = new CalendarDateSelect($("cds_test"), {time: "mixed"});
|
94
|
+
cds.navYear(1870);
|
95
|
+
assertEqual(2007, cds.selected_date.getFullYear());
|
96
|
+
assertEqual(1870, cds.date.getFullYear());
|
97
|
+
cds.close();
|
98
|
+
}},
|
99
|
+
test_navMonth: function() { with(this){
|
100
|
+
$("cds_test").value = "January 1, 2007";
|
101
|
+
cds = new CalendarDateSelect($("cds_test"), {time: "mixed"});
|
102
|
+
cds.navMonth(5);
|
103
|
+
assertEqual(0, cds.selected_date.getMonth());
|
104
|
+
assertEqual(5, cds.date.getMonth())
|
105
|
+
cds.close();
|
106
|
+
}},
|
107
|
+
test_callBacks: function() { with(this){
|
108
|
+
$("cds_test").up().build("div", {id: "global"});
|
109
|
+
cds = new CalendarDateSelect($("cds_test"), {time: "mixed",
|
110
|
+
before_show: function() { $("global").before_show_called = true},
|
111
|
+
after_show: function() { $("global").after_show_called = true},
|
112
|
+
before_close: function() { $("global").before_close_called = true},
|
113
|
+
after_close: function() { $("global").after_close_called = true},
|
114
|
+
after_navigate: function() { $("global").after_navigate_called = true},
|
115
|
+
onchange: function() { $("global").onchange_called = true},
|
116
|
+
});
|
117
|
+
cds.navMonth(1);
|
118
|
+
cds.navMonth(10);
|
119
|
+
cds.updateSelectedDate({month: 1, day: 3, year: 2007});
|
120
|
+
cds.close();
|
121
|
+
assert($('global').before_show_called, "before_show wasnt called");
|
122
|
+
assert($('global').after_show_called, "after_show wasnt called");
|
123
|
+
assert($('global').before_close_called, "before_close wasnt called");
|
124
|
+
assert($('global').after_close_called, "after_close wasnt called");
|
125
|
+
assert($('global').after_navigate_called, "after_navigate wasnt called");
|
126
|
+
assert($('global').onchange_called, "onchange wasnt called");
|
127
|
+
$("global").remove();
|
128
|
+
}},
|
129
|
+
test_disabledElement_cantUpdate: function() {with(this){
|
130
|
+
$("cds_test").value = "May 10, 2007";
|
131
|
+
$("cds_test").disabled = true;
|
132
|
+
cds = new CalendarDateSelect($("cds_test"));
|
133
|
+
|
134
|
+
runTest = function() {
|
135
|
+
cds.updateSelectedDate({day: 1, month:0, year: 2007});
|
136
|
+
assertEqual(10, cds.selected_date.getDate())
|
137
|
+
}
|
138
|
+
runTest();
|
139
|
+
$("cds_test").disabled = false;
|
140
|
+
$("cds_test").readOnly = true;
|
141
|
+
runTest();
|
142
|
+
|
143
|
+
$("cds_test").readOnly = false;
|
144
|
+
cds.close();
|
145
|
+
}},
|
146
|
+
test_readOnlyElement_forcePopup_shouldUpdate: function() {with(this){
|
147
|
+
$("cds_test").value = "May 10, 2007";
|
148
|
+
$("cds_test").readOnly = true;
|
149
|
+
cds = new CalendarDateSelect($("cds_test"), {popup: "force"});
|
150
|
+
|
151
|
+
cds.updateSelectedDate({day: 1, month:0, year: 2007});
|
152
|
+
assertEqual(1, cds.selected_date.getDate())
|
153
|
+
|
154
|
+
$("cds_test").readOnly = false;
|
155
|
+
cds.close();
|
156
|
+
}},
|
157
|
+
test_timePassed_notUsingTime_shouldIgnore: function() {with(this) {
|
158
|
+
$("cds_test").value = "May 10, 2007 5:00 pm";
|
159
|
+
cds = new CalendarDateSelect($("cds_test"), {time:false});
|
160
|
+
assert(cds.options.get("close_on_click"), "should set close_on_click to true when not using time")
|
161
|
+
assertEqual(false, cds.use_time, "When parsing time");
|
162
|
+
cds.today();
|
163
|
+
assert(cds.closed, "should close when clicking today");
|
164
|
+
assert(!cds.use_time, "Should not use time when calling today");
|
165
|
+
|
166
|
+
cds = new CalendarDateSelect($("cds_test"), {time:false});
|
167
|
+
cds.updateSelectedDate({hours: 5, minutes:30}) // this will close the control
|
168
|
+
assertEqual(false, cds.use_time, "When setting hour/minute");
|
169
|
+
assert(cds.closed);
|
170
|
+
}},
|
171
|
+
test_setUseTime_true_notUsingTime_shouldIgnore: function() {with(this) {
|
172
|
+
$("cds_test").value = "May 10, 2007 5:00 pm";
|
173
|
+
cds = new CalendarDateSelect($("cds_test"), {time:false});
|
174
|
+
assertEqual(false, cds.use_time, "When parsing time");
|
175
|
+
cds.setUseTime(true); // this will close the control
|
176
|
+
assert(! cds.use_time, "After calling setUseTime(true)");
|
177
|
+
cds.close();
|
178
|
+
}},
|
179
|
+
test_setMinute_notOnInterval_usesFloor: function() {with(this){
|
180
|
+
$("cds_test").value = "May 10, 2007 5:25 pm";
|
181
|
+
cds = new CalendarDateSelect($("cds_test"), {time:true});
|
182
|
+
cds.updateSelectedDate({hour: 1, minute: 4});
|
183
|
+
assertEqual(0, cds.selected_date.getMinutes());
|
184
|
+
assertEqual(1, cds.selected_date.getHours());
|
185
|
+
|
186
|
+
cds.close();
|
187
|
+
}},
|
188
|
+
// this checks for a safari 2 bug where safari parses "" as a date back in 1969
|
189
|
+
test_parseDate_blankInput_interpretsAsNotSelected: function() {with(this){
|
190
|
+
$("cds_test").value = " ";
|
191
|
+
cds = new CalendarDateSelect($("cds_test"), {time:true});
|
192
|
+
assertEqual(new Date().getFullYear(), cds.selected_date.getFullYear());
|
193
|
+
assertEqual(new Date().getFullYear(), cds.date.getFullYear());
|
194
|
+
assert(! cds.selection_made)
|
195
|
+
cds.close();
|
196
|
+
}},
|
197
|
+
test_parseDate_timeTrue_noTimePassed_useTimeSetToTrueAnyway: function() {with(this){
|
198
|
+
$("cds_test").value = "December 1, 2007 ";
|
199
|
+
cds = new CalendarDateSelect($("cds_test"), {time:true});
|
200
|
+
assert(cds.use_time)
|
201
|
+
cds.close();
|
202
|
+
}},
|
203
|
+
test_passDivElement__shouldUseChildInputForTargetElement: function() {with(this){
|
204
|
+
cds = new CalendarDateSelect($("cds_test_div"), {time:true});
|
205
|
+
assertEqual("INPUT", cds.target_element.nodeName)
|
206
|
+
cds.close();
|
207
|
+
}},
|
208
|
+
test__flexibleYearRange__datePassedWayBackWhen__shouldInitYearSelectAroundDate: function() {with(this){
|
209
|
+
$("cds_test").value = "July 4, 1776";
|
210
|
+
cds = new CalendarDateSelect($("cds_test_div"), {time:true});
|
211
|
+
assert(cds.flexibleYearRange(), " should have had a flexibleYearRange");
|
212
|
+
assert(cds.year_select.setValue(1776), "Should have allowed me to select 1776");
|
213
|
+
cds.close();
|
214
|
+
}},
|
215
|
+
test__nonflexibleYearRange__dateRangeAtEnds__shouldntAllowNavigationPassedBoundary: function() {with(this){
|
216
|
+
$("cds_test").value = "January 1, 2007";
|
217
|
+
cds = new CalendarDateSelect($("cds_test"), {time:true, year_range: [2007, 2007]});
|
218
|
+
|
219
|
+
assert(! cds.navYear(2006), "should not allow year navigation outside of boundary");
|
220
|
+
assert(! cds.navYear(2008), "should not allow year navigation outside of boundary");
|
221
|
+
assert(! cds.navMonth(-1), "shouldnt allow me to go beyond boundary");
|
222
|
+
assert(! cds.navMonth(13), "shouldnt allow me to go beyond boundary");
|
223
|
+
assert(cds.navMonth(1), "should allow me to be in boundary");
|
224
|
+
assert(cds.navYear(2007), "should allow me to be in boundary");
|
225
|
+
cds.close();
|
226
|
+
}},
|
227
|
+
test__nonflexibleYearRange__shouldPopulateRange: function() {with(this){
|
228
|
+
$("cds_test").value = "January 1, 2007";
|
229
|
+
cds = new CalendarDateSelect($("cds_test"), {time:true, year_range: [2007, 2007]});
|
230
|
+
assert(cds.year_select.setValue(2007), "should allow me to select 2007");
|
231
|
+
cds.close();
|
232
|
+
}},
|
233
|
+
test__nonflexibleYearRange__initializedWithDateOutsideOfRange__shouldShowNavDateAsClosestToOutsideYear: function() {with(this){
|
234
|
+
$("cds_test").value = "January 1, 1900";
|
235
|
+
cds = new CalendarDateSelect($("cds_test"), {time:true, year_range: [1997, 2007]});
|
236
|
+
assertEqual(1997, cds.date.getFullYear(), "When going lesser than year_range");
|
237
|
+
cds.close();
|
238
|
+
|
239
|
+
$("cds_test").value = "January 1, 2010";
|
240
|
+
cds = new CalendarDateSelect($("cds_test"), {time:true, year_range: [1997, 2007]});
|
241
|
+
assertEqual(2007, cds.date.getFullYear(), "When going greater than year_range");
|
242
|
+
|
243
|
+
cds.close();
|
244
|
+
}},
|
245
|
+
test__nonflexibleYearRange__initializedWithDateInsideOfRange__shouldShowNavDateAsYear: function() {with(this){
|
246
|
+
$("cds_test").value = "January 1, 2005";
|
247
|
+
cds = new CalendarDateSelect($("cds_test"), {year_range: [1997, 2007]});
|
248
|
+
assertEqual(2005, cds.date.getFullYear(), "When going lesser than year_range");
|
249
|
+
cds.close();
|
250
|
+
}},
|
251
|
+
test__flexibleYearRange__goToBoundary__shouldRefreshRange: function() {with(this){
|
252
|
+
$("cds_test").value = "January 1, 2007";
|
253
|
+
cds = new CalendarDateSelect($("cds_test"), {year_range: 10});
|
254
|
+
cds.navYear(1997);
|
255
|
+
assert(cds.year_select.setValue(1987), "should have refreshed with 1997 as the center");
|
256
|
+
cds.navYear(2017);
|
257
|
+
assert(cds.year_select.setValue(2027), "should have refreshed with 2027 as the center");
|
258
|
+
cds.close();
|
259
|
+
}},
|
260
|
+
test__should_show_iframe_only_in_ie: function() {with(this){
|
261
|
+
cds = new CalendarDateSelect($("cds_test"));
|
262
|
+
|
263
|
+
if (navigator.appName=="Microsoft Internet Explorer")
|
264
|
+
assertEqual(1, $$('iframe.ie6_blocker').length)
|
265
|
+
else
|
266
|
+
assertEqual(0, $$('iframe.ie6_blocker').length)
|
267
|
+
|
268
|
+
cds.close();
|
269
|
+
}},
|
270
|
+
test__should_populate_minute_box_according_to_minute_interval: function() {with(this){
|
271
|
+
cds = new CalendarDateSelect($("cds_test"), {time: true, minute_interval: 10});
|
272
|
+
assert(cds.minute_select.setValue(0), "should allow me to select 0 minutes" );
|
273
|
+
assert(!cds.minute_select.setValue(5), "should NOT allow me to select 5 minutes");
|
274
|
+
assert(cds.minute_select.setValue(10), "should allow me to select 10 minutes" );
|
275
|
+
cds.close();
|
276
|
+
}},
|
277
|
+
test__shouldnt_leak_variables: function() {with (this) {
|
278
|
+
var vars = $w("padded2 compare_date str minute hour value e above e_dim e_top e_left matched e_bottom e_height c_pos c_left c_top c_height left_px top_px top_div header_div body_div buttons_div footer_div bottom_div days_tbody row_number cell_index weekday that pre_days use_time m y hover_date x d o")
|
279
|
+
vars.each(function(v) {eval(v + " = -100");});
|
280
|
+
|
281
|
+
cds = new CalendarDateSelect($("cds_test"), {time: true});
|
282
|
+
cds.navMonth(1);
|
283
|
+
cds.navYear(2);
|
284
|
+
cds.dayHover($$('.cds_body td').first());
|
285
|
+
cds.updateSelectedDate({day:1, month:1, year:2007});
|
286
|
+
cds.close();
|
287
|
+
|
288
|
+
vars.each(function(v) {
|
289
|
+
assert(-100 == eval(v), "Variable " + v + " was leaked");
|
290
|
+
});
|
291
|
+
}},
|
292
|
+
test__valid_date__shouldnt_allow_selection_of_invalid_dates_and_should_apply_css: function() {with (this) {
|
293
|
+
$('cds_test').value = "December 11, 2007";
|
294
|
+
cds = new CalendarDateSelect($("cds_test"), {valid_date_check: function(date) { return date < new Date("December 13, 2007")}, time: "mixed"});
|
295
|
+
assertEqual("December 11, 2007", $F('cds_test'));
|
296
|
+
cds.updateSelectedDate({day:13, month:12-1, year:2007});
|
297
|
+
assertEqual("December 11, 2007", $F('cds_test'), "Date should not have been allowed to be selected");
|
298
|
+
cds.updateSelectedDate({day:10, month:12-1, year:2007});
|
299
|
+
assertEqual("December 10, 2007", $F('cds_test'), "Date should not have been allowed to be selected");
|
300
|
+
|
301
|
+
day_12_element = $$('.calendar_date_select td')[17];
|
302
|
+
day_13_element = $$('.calendar_date_select td')[18];
|
303
|
+
assertEqual(12, day_12_element.day); // make sure we have th right one
|
304
|
+
assertEqual(13, day_13_element.day); // make sure we have th right one
|
305
|
+
assert( ! day_12_element.hasClassName("disabled"), "Day 12 shouldnt be disabled");
|
306
|
+
assert(day_13_element.hasClassName("disabled"), "Day 13 should be disabled");
|
307
|
+
|
308
|
+
cds.close();
|
309
|
+
}},
|
310
|
+
test__valid_date_check_is_nil__should_show_all_cells_as_enabled: function() {with (this) {
|
311
|
+
$('cds_test').value = "December 11, 2007";
|
312
|
+
cds = new CalendarDateSelect($("cds_test"));
|
313
|
+
|
314
|
+
$$('.calendar_date_select td').each(function(e){
|
315
|
+
assert( ! e.hasClassName("disabled"));
|
316
|
+
});
|
317
|
+
|
318
|
+
cds.close();
|
319
|
+
}}
|
320
|
+
});
|
321
|
+
// ]]>
|
322
|
+
</script>
|
323
|
+
</body>
|
324
|
+
</html>
|