middleman-core 3.2.2 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/features/cli_init.feature +18 -8
- data/features/helpers_select_tag.feature +1 -1
- data/features/layouts_dir.feature +8 -0
- data/features/markdown_redcarpet.feature +2 -2
- data/fixtures/asciidoc-app/source/layouts/default.erb +0 -1
- data/fixtures/capture-html-app/source/capture_html_haml.html.haml +1 -1
- data/fixtures/content-for-app/source/content_for_haml.html.haml +1 -1
- data/fixtures/frontmatter-settings-app/source/layouts/override.erb +1 -2
- data/fixtures/frontmatter-settings-neighbor-app/source/layouts/override.erb +1 -2
- data/fixtures/layouts-dir-app/source/ambiguous.html.erb +5 -0
- data/fixtures/layouts-dir-app/source/layouts/other.erb +3 -0
- data/fixtures/layouts-dir-app/source/other.erb +3 -0
- data/fixtures/link-to-app/source/link_to_haml.html.haml +1 -1
- data/fixtures/link-to-app/source/link_to_slim.html.slim +1 -1
- data/fixtures/nested-layout-app/source/layouts/inner_haml.haml +1 -1
- data/fixtures/nested-layout-app/source/layouts/inner_slim.slim +1 -1
- data/fixtures/nested-layout-app/source/layouts/outer_haml.haml +1 -1
- data/fixtures/nested-layout-app/source/layouts/outer_slim.slim +1 -1
- data/lib/middleman-core/application.rb +12 -3
- data/lib/middleman-core/cli/build.rb +5 -3
- data/lib/middleman-core/cli/console.rb +1 -1
- data/lib/middleman-core/cli/init.rb +1 -1
- data/lib/middleman-core/core_extensions.rb +0 -1
- data/lib/middleman-core/core_extensions/file_watcher.rb +11 -11
- data/lib/middleman-core/core_extensions/rendering.rb +40 -66
- data/lib/middleman-core/extension.rb +167 -0
- data/lib/middleman-core/extensions.rb +2 -151
- data/lib/middleman-core/logger.rb +2 -2
- data/lib/middleman-core/meta_pages/assets/config.css +13 -0
- data/lib/middleman-core/meta_pages/assets/meta.css +19 -3
- data/lib/middleman-core/meta_pages/assets/sitemap.css +18 -1
- data/lib/middleman-core/meta_pages/config_setting.rb +7 -9
- data/lib/middleman-core/meta_pages/sitemap_resource.rb +24 -15
- data/lib/middleman-core/meta_pages/sitemap_tree.rb +5 -1
- data/lib/middleman-core/meta_pages/templates/config.html.erb +2 -2
- data/lib/middleman-core/meta_pages/templates/index.html.erb +18 -8
- data/lib/middleman-core/meta_pages/templates/sitemap.html.erb +4 -5
- data/lib/middleman-core/preview_server.rb +6 -3
- data/lib/middleman-core/renderers/erb.rb +12 -14
- data/lib/middleman-core/renderers/haml.rb +10 -0
- data/lib/middleman-core/renderers/markdown.rb +5 -1
- data/lib/middleman-core/renderers/sass.rb +0 -4
- data/lib/middleman-core/renderers/slim.rb +16 -3
- data/lib/middleman-core/sitemap/resource.rb +1 -1
- data/lib/middleman-core/step_definitions.rb +2 -1
- data/lib/middleman-core/templates.rb +3 -1
- data/lib/middleman-core/templates/shared/Gemfile.tt +4 -1
- data/lib/middleman-core/templates/shared/config.tt +3 -1
- data/lib/middleman-core/templates/shared/gitignore +2 -1
- data/lib/middleman-core/util.rb +22 -16
- data/lib/middleman-core/version.rb +1 -1
- data/lib/middleman-more/core_extensions/compass.rb +3 -3
- data/lib/middleman-more/core_extensions/default_helpers.rb +18 -15
- data/lib/middleman-more/extensions/asset_hash.rb +1 -0
- data/middleman-core.gemspec +9 -6
- metadata +69 -227
- data/features/sass_cache_path.feature +0 -22
- data/fixtures/sass-cache-path-custom-app/config.rb +0 -3
- data/fixtures/sass-cache-path-custom-app/source/stylesheets/plain.css.sass +0 -4
- data/fixtures/sass-cache-path-default-app/config.rb +0 -3
- data/fixtures/sass-cache-path-default-app/source/stylesheets/plain.css.sass +0 -4
- data/lib/vendored-middleman-deps/hooks-0.2.0/CHANGES.textile +0 -9
- data/lib/vendored-middleman-deps/hooks-0.2.0/Gemfile +0 -3
- data/lib/vendored-middleman-deps/hooks-0.2.0/README.rdoc +0 -107
- data/lib/vendored-middleman-deps/hooks-0.2.0/Rakefile +0 -12
- data/lib/vendored-middleman-deps/hooks-0.2.0/hooks.gemspec +0 -22
- data/lib/vendored-middleman-deps/hooks-0.2.0/lib/hooks.rb +0 -109
- data/lib/vendored-middleman-deps/hooks-0.2.0/lib/hooks/inheritable_attribute.rb +0 -33
- data/lib/vendored-middleman-deps/hooks-0.2.0/test/hooks_test.rb +0 -141
- data/lib/vendored-middleman-deps/hooks-0.2.0/test/inheritable_attribute_test.rb +0 -55
- data/lib/vendored-middleman-deps/hooks-0.2.0/test/test_helper.rb +0 -10
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/.document +0 -5
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/.gitignore +0 -22
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/.yardopts +0 -1
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/LICENSE.txt +0 -20
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/README.rdoc +0 -294
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/Rakefile +0 -5
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/bin/padrino +0 -9
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core.rb +0 -200
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/application.rb +0 -297
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/application/flash.rb +0 -229
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/application/rendering.rb +0 -317
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/application/rendering/extensions/erubis.rb +0 -64
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/application/rendering/extensions/haml.rb +0 -28
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/application/rendering/extensions/slim.rb +0 -14
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/application/routing.rb +0 -1077
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/application/showexceptions.rb +0 -21
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/caller.rb +0 -53
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/cli/adapter.rb +0 -24
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/cli/base.rb +0 -159
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/cli/console.rb +0 -20
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/cli/rake.rb +0 -47
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/cli/rake_tasks.rb +0 -52
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/command.rb +0 -38
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/images/404.png +0 -0
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/images/500.png +0 -0
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/loader.rb +0 -224
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/cs.yml +0 -33
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/da.yml +0 -33
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/de.yml +0 -33
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/en.yml +0 -33
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/es.yml +0 -33
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/fr.yml +0 -33
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/hu.yml +0 -33
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/it.yml +0 -39
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/ja.yml +0 -33
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/lv.yml +0 -33
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/nl.yml +0 -33
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/no.yml +0 -33
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/pl.yml +0 -33
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/pt_br.yml +0 -39
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/ro.yml +0 -33
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/ru.yml +0 -34
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/sv.yml +0 -33
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/tr.yml +0 -33
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/uk.yml +0 -33
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/zh_cn.yml +0 -33
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/zh_tw.yml +0 -33
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/logger.rb +0 -438
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/module.rb +0 -58
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/mounter.rb +0 -234
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/reloader.rb +0 -341
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/router.rb +0 -95
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/server.rb +0 -77
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/support_lite.rb +0 -260
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/tasks.rb +0 -21
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/version.rb +0 -20
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/padrino-core.gemspec +0 -43
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/app_gem/Gemfile +0 -4
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/app_gem/app/app.rb +0 -3
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/app_gem/app_gem.gemspec +0 -17
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/app_gem/lib/app_gem.rb +0 -7
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/app_gem/lib/app_gem/version.rb +0 -3
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/apps/.components +0 -6
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/apps/.gitignore +0 -7
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/apps/complex.rb +0 -32
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/apps/simple.rb +0 -33
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/dependencies/a.rb +0 -9
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/dependencies/b.rb +0 -4
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/dependencies/c.rb +0 -1
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/dependencies/circular/e.rb +0 -13
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/dependencies/circular/f.rb +0 -2
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/dependencies/circular/g.rb +0 -2
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/dependencies/d.rb +0 -4
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/helper.rb +0 -83
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/mini_shoulda.rb +0 -45
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_application.rb +0 -125
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_core.rb +0 -77
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_csrf_protection.rb +0 -80
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_dependencies.rb +0 -44
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_filters.rb +0 -348
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_flash.rb +0 -168
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_locale.rb +0 -21
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_logger.rb +0 -210
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_mounter.rb +0 -199
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_reloader_complex.rb +0 -75
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_reloader_simple.rb +0 -98
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_rendering.rb +0 -545
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_rendering_extensions.rb +0 -14
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_restful_routing.rb +0 -33
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_router.rb +0 -146
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_routing.rb +0 -1927
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_support_lite.rb +0 -56
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/.document +0 -5
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/.gitignore +0 -21
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/.yardopts +0 -1
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/LICENSE.txt +0 -20
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/README.rdoc +0 -239
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/Rakefile +0 -5
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers.rb +0 -57
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/asset_tag_helpers.rb +0 -401
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/breadcrumb_helpers.rb +0 -183
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/form_builder/abstract_form_builder.rb +0 -317
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/form_builder/standard_form_builder.rb +0 -40
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/form_helpers.rb +0 -919
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/format_helpers.rb +0 -372
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/cs.yml +0 -103
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/da.yml +0 -91
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/de.yml +0 -81
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/en.yml +0 -103
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/es.yml +0 -103
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/fr.yml +0 -79
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/hu.yml +0 -103
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/it.yml +0 -89
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/ja.yml +0 -103
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/lv.yml +0 -103
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/nl.yml +0 -82
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/no.yml +0 -91
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/pl.yml +0 -95
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/pt_br.yml +0 -103
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/ro.yml +0 -103
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/ru.yml +0 -103
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/sv.yml +0 -103
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/tr.yml +0 -103
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/uk.yml +0 -103
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/zh_cn.yml +0 -103
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/zh_tw.yml +0 -103
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/number_helpers.rb +0 -283
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/output_helpers.rb +0 -207
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/output_helpers/abstract_handler.rb +0 -96
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/output_helpers/erb_handler.rb +0 -78
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/output_helpers/haml_handler.rb +0 -63
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/output_helpers/slim_handler.rb +0 -78
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/render_helpers.rb +0 -59
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/tag_helpers.rb +0 -292
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/translation_helpers.rb +0 -36
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/padrino-helpers.gemspec +0 -27
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/app.rb +0 -84
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/button_to.erb +0 -8
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/button_to.haml +0 -5
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/button_to.slim +0 -6
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/capture_concat.erb +0 -14
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/capture_concat.haml +0 -12
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/capture_concat.slim +0 -12
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/content_for.erb +0 -14
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/content_for.haml +0 -12
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/content_for.slim +0 -12
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/content_tag.erb +0 -11
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/content_tag.haml +0 -9
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/content_tag.slim +0 -9
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/current_engine.erb +0 -5
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/current_engine.haml +0 -5
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/current_engine.slim +0 -5
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/fields_for.erb +0 -20
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/fields_for.haml +0 -15
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/fields_for.slim +0 -15
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/form_for.erb +0 -72
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/form_for.haml +0 -59
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/form_for.slim +0 -59
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/form_tag.erb +0 -95
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/form_tag.haml +0 -78
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/form_tag.slim +0 -79
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/link_to.erb +0 -5
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/link_to.haml +0 -4
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/link_to.slim +0 -4
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/mail_to.erb +0 -3
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/mail_to.haml +0 -3
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/mail_to.slim +0 -3
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/meta_tag.erb +0 -3
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/meta_tag.haml +0 -3
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/meta_tag.slim +0 -3
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/partials/_erb.erb +0 -1
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/partials/_haml.haml +0 -1
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/partials/_slim.slim +0 -1
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/simple_partial.erb +0 -1
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/simple_partial.haml +0 -1
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/simple_partial.slim +0 -1
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/app.rb +0 -58
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/views/current_engine.haml +0 -5
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/views/current_engines/_erb.erb +0 -1
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/views/current_engines/_haml.haml +0 -1
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/views/current_engines/_slim.slim +0 -1
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/views/double_capture_erb.erb +0 -3
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/views/double_capture_haml.haml +0 -2
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/views/double_capture_slim.slim +0 -2
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/views/erb/test.erb +0 -1
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/views/explicit_engine.haml +0 -5
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/views/haml/test.haml +0 -1
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/views/template/_user.haml +0 -7
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/views/template/haml_template.haml +0 -1
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/views/template/some_template.haml +0 -2
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/helper.rb +0 -67
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/test_asset_tag_helpers.rb +0 -359
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/test_breadcrumb_helpers.rb +0 -134
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/test_form_builder.rb +0 -1178
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/test_form_helpers.rb +0 -1030
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/test_format_helpers.rb +0 -241
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/test_locale.rb +0 -20
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/test_number_helpers.rb +0 -143
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/test_output_helpers.rb +0 -154
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/test_render_helpers.rb +0 -94
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/test_tag_helpers.rb +0 -117
|
@@ -1,1030 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/helper')
|
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + '/fixtures/markup_app/app')
|
|
3
|
-
|
|
4
|
-
describe "FormHelpers" do
|
|
5
|
-
include Padrino::Helpers::FormHelpers
|
|
6
|
-
|
|
7
|
-
def app
|
|
8
|
-
MarkupDemo
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
class UnprotectedApp
|
|
12
|
-
def protect_from_csrf; false; end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
context 'for #form_tag method' do
|
|
16
|
-
should "display correct forms in ruby" do
|
|
17
|
-
actual_html = form_tag('/register', :"accept-charset" => "UTF-8", :class => 'test', :method => "post") { "Demo" }
|
|
18
|
-
assert_has_tag(:form, :"accept-charset" => "UTF-8", :class => "test") { actual_html }
|
|
19
|
-
assert_has_tag('form input', :type => 'hidden', :name => '_method', :count => 0) { actual_html }
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
should "display correct text inputs within form_tag" do
|
|
23
|
-
actual_html = form_tag('/register', :"accept-charset" => "UTF-8", :class => 'test') { text_field_tag(:username) }
|
|
24
|
-
assert_has_tag('form input', :type => 'text', :name => "username") { actual_html }
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
should "display correct form with remote" do
|
|
28
|
-
actual_html = form_tag('/update', :"accept-charset" => "UTF-8", :class => 'put-form', :remote => true) { "Demo" }
|
|
29
|
-
assert_has_tag(:form, :class => "put-form", :"accept-charset" => "UTF-8", :"data-remote" => 'true') { actual_html }
|
|
30
|
-
assert_has_no_tag(:form, "data-method" => 'post') { actual_html }
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
should "display correct form with remote and method is put" do
|
|
34
|
-
actual_html = form_tag('/update', :"accept-charset" => "UTF-8", :method => 'put', :remote => true) { "Demo" }
|
|
35
|
-
assert_has_tag(:form, "data-remote" => 'true', :"accept-charset" => "UTF-8") { actual_html }
|
|
36
|
-
assert_has_tag('form input', :type => 'hidden', :name => "_method", :value => 'put') { actual_html }
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
should "display correct form with method :put" do
|
|
40
|
-
actual_html = form_tag('/update', :"accept-charset" => "UTF-8", :class => 'put-form', :method => "put") { "Demo" }
|
|
41
|
-
assert_has_tag(:form, :class => "put-form", :"accept-charset" => "UTF-8", :method => 'post') { actual_html }
|
|
42
|
-
assert_has_tag('form input', :type => 'hidden', :name => "_method", :value => 'put') { actual_html }
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
should "display correct form with method :delete and charset" do
|
|
46
|
-
actual_html = form_tag('/remove', :"accept-charset" => "UTF-8", :class => 'delete-form', :method => "delete") { "Demo" }
|
|
47
|
-
assert_has_tag(:form, :class => "delete-form", :"accept-charset" => "UTF-8", :method => 'post') { actual_html }
|
|
48
|
-
assert_has_tag('form input', :type => 'hidden', :name => "_method", :value => 'delete') { actual_html }
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
should "display correct form with charset" do
|
|
52
|
-
actual_html = form_tag('/charset', :"accept-charset" => "UTF-8", :class => 'charset-form') { "Demo" }
|
|
53
|
-
assert_has_tag(:form, :class => "charset-form", :"accept-charset" => "UTF-8", :method => 'post') { actual_html }
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
should "display correct form with multipart encoding" do
|
|
57
|
-
actual_html = form_tag('/remove', :"accept-charset" => "UTF-8", :multipart => true) { "Demo" }
|
|
58
|
-
assert_has_tag(:form, :enctype => "multipart/form-data") { actual_html }
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
should "have an authenticity_token for method :post, :put or :delete" do
|
|
62
|
-
%w(post put delete).each do |method|
|
|
63
|
-
actual_html = form_tag('/modify', :method => method) { "Demo" }
|
|
64
|
-
assert_has_tag(:input, :name => 'authenticity_token') { actual_html }
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
should "not have an authenticity_token if method: :get" do
|
|
69
|
-
actual_html = form_tag('/get', :method => :get) { "Demo" }
|
|
70
|
-
assert_has_no_tag(:input, :name => 'authenticity_token') { actual_html }
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
should "have an authenticity_token by default" do
|
|
74
|
-
actual_html = form_tag('/superadmindelete') { "Demo" }
|
|
75
|
-
assert_has_tag(:input, :name => 'authenticity_token') { actual_html }
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
should "create csrf meta tags with token and param - #csrf_meta_tags" do
|
|
79
|
-
actual_html = csrf_meta_tags
|
|
80
|
-
assert_has_tag(:meta, :name => 'csrf-param') { actual_html }
|
|
81
|
-
assert_has_tag(:meta, :name => 'csrf-token') { actual_html }
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
should "have an authenticity_token by default" do
|
|
85
|
-
actual_html = form_tag('/superadmindelete') { "Demo" }
|
|
86
|
-
assert_has_tag(:input, :name => 'authenticity_token') { actual_html }
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
should "not have an authenticity_token if passing protect_from_csrf: false" do
|
|
90
|
-
actual_html = form_tag('/superadmindelete', :protect_from_csrf => false) { "Demo" }
|
|
91
|
-
assert_has_no_tag(:input, :name => 'authenticity_token') { actual_html }
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
should "not have an authenticity_token if protect_from_csrf is false on app settings" do
|
|
95
|
-
self.expects(:settings).returns(UnprotectedApp.new)
|
|
96
|
-
actual_html = form_tag('/superadmindelete') { "Demo" }
|
|
97
|
-
assert_has_no_tag(:input, :name => 'authenticity_token') { actual_html }
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
should "display correct forms in erb" do
|
|
101
|
-
visit '/erb/form_tag'
|
|
102
|
-
assert_have_selector 'form.simple-form', :action => '/simple'
|
|
103
|
-
assert_have_selector 'form.advanced-form', :action => '/advanced', :id => 'advanced', :method => 'get'
|
|
104
|
-
assert_have_selector 'form.simple-form input', :name => 'authenticity_token'
|
|
105
|
-
assert_have_no_selector 'form.no-protection input', :name => 'authenticity_token'
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
should "display correct forms in haml" do
|
|
109
|
-
visit '/haml/form_tag'
|
|
110
|
-
assert_have_selector 'form.simple-form', :action => '/simple'
|
|
111
|
-
assert_have_selector 'form.advanced-form', :action => '/advanced', :id => 'advanced', :method => 'get'
|
|
112
|
-
assert_have_selector 'form.simple-form input', :name => 'authenticity_token'
|
|
113
|
-
assert_have_no_selector 'form.no-protection input', :name => 'authenticity_token'
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
should "display correct forms in slim" do
|
|
117
|
-
visit '/slim/form_tag'
|
|
118
|
-
assert_have_selector 'form.simple-form', :action => '/simple'
|
|
119
|
-
assert_have_selector 'form.advanced-form', :action => '/advanced', :id => 'advanced', :method => 'get'
|
|
120
|
-
assert_have_selector 'form.simple-form input', :name => 'authenticity_token'
|
|
121
|
-
assert_have_no_selector 'form.no-protection input', :name => 'authenticity_token'
|
|
122
|
-
end
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
context 'for #field_set_tag method' do
|
|
126
|
-
should "display correct field_sets in ruby" do
|
|
127
|
-
actual_html = field_set_tag("Basic", :class => 'basic') { "Demo" }
|
|
128
|
-
assert_has_tag(:fieldset, :class => 'basic') { actual_html }
|
|
129
|
-
assert_has_tag('fieldset legend', :content => "Basic") { actual_html }
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
should "display correct field_sets in erb" do
|
|
133
|
-
visit '/erb/form_tag'
|
|
134
|
-
assert_have_selector 'form.simple-form fieldset', :count => 1
|
|
135
|
-
assert_have_no_selector 'form.simple-form fieldset legend'
|
|
136
|
-
assert_have_selector 'form.advanced-form fieldset', :count => 1, :class => 'advanced-field-set'
|
|
137
|
-
assert_have_selector 'form.advanced-form fieldset legend', :content => "Advanced"
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
should "display correct field_sets in haml" do
|
|
141
|
-
visit '/haml/form_tag'
|
|
142
|
-
assert_have_selector 'form.simple-form fieldset', :count => 1
|
|
143
|
-
assert_have_no_selector 'form.simple-form fieldset legend'
|
|
144
|
-
assert_have_selector 'form.advanced-form fieldset', :count => 1, :class => 'advanced-field-set'
|
|
145
|
-
assert_have_selector 'form.advanced-form fieldset legend', :content => "Advanced"
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
should "display correct field_sets in slim" do
|
|
149
|
-
visit '/slim/form_tag'
|
|
150
|
-
assert_have_selector 'form.simple-form fieldset', :count => 1
|
|
151
|
-
assert_have_no_selector 'form.simple-form fieldset legend'
|
|
152
|
-
assert_have_selector 'form.advanced-form fieldset', :count => 1, :class => 'advanced-field-set'
|
|
153
|
-
assert_have_selector 'form.advanced-form fieldset legend', :content => "Advanced"
|
|
154
|
-
end
|
|
155
|
-
end
|
|
156
|
-
|
|
157
|
-
context 'for #error_messages_for method' do
|
|
158
|
-
should "display correct error messages list in ruby" do
|
|
159
|
-
user = mock_model("User", :errors => { :a => "1", :b => "2" }, :blank? => false)
|
|
160
|
-
actual_html = error_messages_for(user)
|
|
161
|
-
assert_has_tag('div.field-errors') { actual_html }
|
|
162
|
-
assert_has_tag('div.field-errors h2', :content => "2 errors prohibited this User from being saved") { actual_html }
|
|
163
|
-
assert_has_tag('div.field-errors p', :content => "There were problems with the following fields:") { actual_html }
|
|
164
|
-
assert_has_tag('div.field-errors ul') { actual_html }
|
|
165
|
-
assert_has_tag('div.field-errors ul li', :count => 2) { actual_html }
|
|
166
|
-
end
|
|
167
|
-
|
|
168
|
-
should "display correct error messages list in erb" do
|
|
169
|
-
visit '/erb/form_tag'
|
|
170
|
-
assert_have_no_selector 'form.simple-form .field-errors'
|
|
171
|
-
assert_have_selector 'form.advanced-form .field-errors'
|
|
172
|
-
assert_have_selector 'form.advanced-form .field-errors h2', :content => "There are problems with saving user!"
|
|
173
|
-
assert_have_selector 'form.advanced-form .field-errors p', :content => "There were problems with the following fields:"
|
|
174
|
-
assert_have_selector 'form.advanced-form .field-errors ul'
|
|
175
|
-
assert_have_selector 'form.advanced-form .field-errors ul li', :count => 4
|
|
176
|
-
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Email must be an email"
|
|
177
|
-
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Fake must be valid"
|
|
178
|
-
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Second must be present"
|
|
179
|
-
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Third must be a number"
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
should "display correct error messages list in haml" do
|
|
183
|
-
visit '/haml/form_tag'
|
|
184
|
-
assert_have_no_selector 'form.simple-form .field-errors'
|
|
185
|
-
assert_have_selector 'form.advanced-form .field-errors'
|
|
186
|
-
assert_have_selector 'form.advanced-form .field-errors h2', :content => "There are problems with saving user!"
|
|
187
|
-
assert_have_selector 'form.advanced-form .field-errors p', :content => "There were problems with the following fields:"
|
|
188
|
-
assert_have_selector 'form.advanced-form .field-errors ul'
|
|
189
|
-
assert_have_selector 'form.advanced-form .field-errors ul li', :count => 4
|
|
190
|
-
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Email must be an email"
|
|
191
|
-
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Fake must be valid"
|
|
192
|
-
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Second must be present"
|
|
193
|
-
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Third must be a number"
|
|
194
|
-
end
|
|
195
|
-
|
|
196
|
-
should "display correct error messages list in slim" do
|
|
197
|
-
visit '/slim/form_tag'
|
|
198
|
-
assert_have_no_selector 'form.simple-form .field-errors'
|
|
199
|
-
assert_have_selector 'form.advanced-form .field-errors'
|
|
200
|
-
assert_have_selector 'form.advanced-form .field-errors h2', :content => "There are problems with saving user!"
|
|
201
|
-
assert_have_selector 'form.advanced-form .field-errors p', :content => "There were problems with the following fields:"
|
|
202
|
-
assert_have_selector 'form.advanced-form .field-errors ul'
|
|
203
|
-
assert_have_selector 'form.advanced-form .field-errors ul li', :count => 4
|
|
204
|
-
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Email must be an email"
|
|
205
|
-
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Fake must be valid"
|
|
206
|
-
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Second must be present"
|
|
207
|
-
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Third must be a number"
|
|
208
|
-
end
|
|
209
|
-
end
|
|
210
|
-
|
|
211
|
-
context 'for #error_message_on method' do
|
|
212
|
-
should "display correct error message on specified model name in ruby" do
|
|
213
|
-
@user = mock_model("User", :errors => { :a => "1", :b => "2" }, :blank? => false)
|
|
214
|
-
actual_html = error_message_on(:user, :a, :prepend => "foo", :append => "bar")
|
|
215
|
-
assert_has_tag('span.error', :content => "foo 1 bar") { actual_html }
|
|
216
|
-
end
|
|
217
|
-
|
|
218
|
-
should "display correct error message on specified object in ruby" do
|
|
219
|
-
@bob = mock_model("User", :errors => { :a => "1", :b => "2" }, :blank? => false)
|
|
220
|
-
actual_html = error_message_on(@bob, :a, :prepend => "foo", :append => "bar")
|
|
221
|
-
assert_has_tag('span.error', :content => "foo 1 bar") { actual_html }
|
|
222
|
-
end
|
|
223
|
-
|
|
224
|
-
should "display no message when error isn't present" do
|
|
225
|
-
@user = mock_model("User", :errors => { :a => "1", :b => "2" }, :blank? => false)
|
|
226
|
-
actual_html = error_message_on(:user, :fake, :prepend => "foo", :append => "bar")
|
|
227
|
-
assert actual_html.blank?
|
|
228
|
-
end
|
|
229
|
-
|
|
230
|
-
should "display no message when error isn't present in an Array" do
|
|
231
|
-
@user = mock_model("User", :errors => { :a => [], :b => "2" }, :blank? => false)
|
|
232
|
-
actual_html = error_message_on(:user, :a, :prepend => "foo", :append => "bar")
|
|
233
|
-
assert actual_html.blank?
|
|
234
|
-
end
|
|
235
|
-
end
|
|
236
|
-
|
|
237
|
-
context 'for #label_tag method' do
|
|
238
|
-
should "display label tag in ruby" do
|
|
239
|
-
actual_html = label_tag(:username, :class => 'long-label', :caption => "Nickname")
|
|
240
|
-
assert_has_tag(:label, :for => 'username', :class => 'long-label', :content => "Nickname") { actual_html }
|
|
241
|
-
end
|
|
242
|
-
|
|
243
|
-
should "display label tag in ruby with required" do
|
|
244
|
-
actual_html = label_tag(:username, :caption => "Nickname", :required => true)
|
|
245
|
-
assert_has_tag(:label, :for => 'username', :content => 'Nickname') { actual_html }
|
|
246
|
-
assert_has_tag('label[for=username] span.required', :content => "*") { actual_html }
|
|
247
|
-
end
|
|
248
|
-
|
|
249
|
-
should "display label tag in ruby with a block" do
|
|
250
|
-
actual_html = label_tag(:admin, :class => 'long-label') { input_tag :checkbox }
|
|
251
|
-
assert_has_tag(:label, :for => 'admin', :class => 'long-label', :content => "Admin") { actual_html }
|
|
252
|
-
assert_has_tag('label input[type=checkbox]') { actual_html }
|
|
253
|
-
end
|
|
254
|
-
|
|
255
|
-
should "display label tag in erb for simple form" do
|
|
256
|
-
visit '/erb/form_tag'
|
|
257
|
-
assert_have_selector 'form.simple-form label', :count => 9
|
|
258
|
-
assert_have_selector 'form.simple-form label', :content => "Username", :for => 'username'
|
|
259
|
-
assert_have_selector 'form.simple-form label', :content => "Password", :for => 'password'
|
|
260
|
-
assert_have_selector 'form.simple-form label', :content => "Gender", :for => 'gender'
|
|
261
|
-
end
|
|
262
|
-
|
|
263
|
-
should "display label tag in erb for advanced form" do
|
|
264
|
-
visit '/erb/form_tag'
|
|
265
|
-
assert_have_selector 'form.advanced-form label', :count => 11
|
|
266
|
-
assert_have_selector 'form.advanced-form label.first', :content => "Nickname", :for => 'username'
|
|
267
|
-
assert_have_selector 'form.advanced-form label.first', :content => "Password", :for => 'password'
|
|
268
|
-
assert_have_selector 'form.advanced-form label.about', :content => "About Me", :for => 'about'
|
|
269
|
-
assert_have_selector 'form.advanced-form label.photo', :content => "Photo" , :for => 'photo'
|
|
270
|
-
assert_have_selector 'form.advanced-form label.gender', :content => "Gender" , :for => 'gender'
|
|
271
|
-
end
|
|
272
|
-
|
|
273
|
-
should "display label tag in haml for simple form" do
|
|
274
|
-
visit '/haml/form_tag'
|
|
275
|
-
assert_have_selector 'form.simple-form label', :count => 9
|
|
276
|
-
assert_have_selector 'form.simple-form label', :content => "Username", :for => 'username'
|
|
277
|
-
assert_have_selector 'form.simple-form label', :content => "Password", :for => 'password'
|
|
278
|
-
assert_have_selector 'form.simple-form label', :content => "Gender", :for => 'gender'
|
|
279
|
-
end
|
|
280
|
-
|
|
281
|
-
should "display label tag in haml for advanced form" do
|
|
282
|
-
visit '/haml/form_tag'
|
|
283
|
-
assert_have_selector 'form.advanced-form label', :count => 11
|
|
284
|
-
assert_have_selector 'form.advanced-form label.first', :content => "Nickname", :for => 'username'
|
|
285
|
-
assert_have_selector 'form.advanced-form label.first', :content => "Password", :for => 'password'
|
|
286
|
-
assert_have_selector 'form.advanced-form label.about', :content => "About Me", :for => 'about'
|
|
287
|
-
assert_have_selector 'form.advanced-form label.photo', :content => "Photo" , :for => 'photo'
|
|
288
|
-
assert_have_selector 'form.advanced-form label.gender', :content => "Gender" , :for => 'gender'
|
|
289
|
-
end
|
|
290
|
-
|
|
291
|
-
should "display label tag in slim for simple form" do
|
|
292
|
-
visit '/slim/form_tag'
|
|
293
|
-
assert_have_selector 'form.simple-form label', :count => 9
|
|
294
|
-
assert_have_selector 'form.simple-form label', :content => "Username", :for => 'username'
|
|
295
|
-
assert_have_selector 'form.simple-form label', :content => "Password", :for => 'password'
|
|
296
|
-
assert_have_selector 'form.simple-form label', :content => "Gender", :for => 'gender'
|
|
297
|
-
end
|
|
298
|
-
|
|
299
|
-
should "display label tag in slim for advanced form" do
|
|
300
|
-
visit '/slim/form_tag'
|
|
301
|
-
assert_have_selector 'form.advanced-form label', :count => 11
|
|
302
|
-
assert_have_selector 'form.advanced-form label.first', :content => "Nickname", :for => 'username'
|
|
303
|
-
assert_have_selector 'form.advanced-form label.first', :content => "Password", :for => 'password'
|
|
304
|
-
assert_have_selector 'form.advanced-form label.about', :content => "About Me", :for => 'about'
|
|
305
|
-
assert_have_selector 'form.advanced-form label.photo', :content => "Photo" , :for => 'photo'
|
|
306
|
-
assert_have_selector 'form.advanced-form label.gender', :content => "Gender" , :for => 'gender'
|
|
307
|
-
end
|
|
308
|
-
end
|
|
309
|
-
|
|
310
|
-
context 'for #hidden_field_tag method' do
|
|
311
|
-
should "display hidden field in ruby" do
|
|
312
|
-
actual_html = hidden_field_tag(:session_key, :id => 'session_id', :value => '56768')
|
|
313
|
-
assert_has_tag(:input, :type => 'hidden', :id => "session_id", :name => 'session_key', :value => '56768') { actual_html }
|
|
314
|
-
end
|
|
315
|
-
|
|
316
|
-
should "display hidden field in erb" do
|
|
317
|
-
visit '/erb/form_tag'
|
|
318
|
-
assert_have_selector 'form.simple-form input[type=hidden]', :count => 1, :name => 'session_id', :value => "__secret__"
|
|
319
|
-
assert_have_selector 'form.advanced-form input[type=hidden]', :count => 1, :name => 'session_id', :value => "__secret__"
|
|
320
|
-
end
|
|
321
|
-
|
|
322
|
-
should "display hidden field in haml" do
|
|
323
|
-
visit '/haml/form_tag'
|
|
324
|
-
assert_have_selector 'form.simple-form input[type=hidden]', :count => 1, :name => 'session_id', :value => "__secret__"
|
|
325
|
-
assert_have_selector 'form.advanced-form input[type=hidden]', :count => 1, :name => 'session_id', :value => "__secret__"
|
|
326
|
-
end
|
|
327
|
-
|
|
328
|
-
should "display hidden field in slim" do
|
|
329
|
-
visit '/slim/form_tag'
|
|
330
|
-
assert_have_selector 'form.simple-form input[type=hidden]', :count => 1, :name => 'session_id', :value => "__secret__"
|
|
331
|
-
assert_have_selector 'form.advanced-form input[type=hidden]', :count => 1, :name => 'session_id', :value => "__secret__"
|
|
332
|
-
end
|
|
333
|
-
end
|
|
334
|
-
|
|
335
|
-
context 'for #text_field_tag method' do
|
|
336
|
-
should "display text field in ruby" do
|
|
337
|
-
actual_html = text_field_tag(:username, :class => 'long')
|
|
338
|
-
assert_has_tag(:input, :type => 'text', :class => "long", :name => 'username') { actual_html }
|
|
339
|
-
end
|
|
340
|
-
|
|
341
|
-
should "display text field in erb" do
|
|
342
|
-
visit '/erb/form_tag'
|
|
343
|
-
assert_have_selector 'form.simple-form input[type=text]', :count => 1, :name => 'username'
|
|
344
|
-
assert_have_selector 'form.advanced-form fieldset input[type=text]', :count => 1, :name => 'username', :id => 'the_username'
|
|
345
|
-
end
|
|
346
|
-
|
|
347
|
-
should "display text field in haml" do
|
|
348
|
-
visit '/haml/form_tag'
|
|
349
|
-
assert_have_selector 'form.simple-form input[type=text]', :count => 1, :name => 'username'
|
|
350
|
-
assert_have_selector 'form.advanced-form fieldset input[type=text]', :count => 1, :name => 'username', :id => 'the_username'
|
|
351
|
-
end
|
|
352
|
-
|
|
353
|
-
should "display text field in slim" do
|
|
354
|
-
visit '/slim/form_tag'
|
|
355
|
-
assert_have_selector 'form.simple-form input[type=text]', :count => 1, :name => 'username'
|
|
356
|
-
assert_have_selector 'form.advanced-form fieldset input[type=text]', :count => 1, :name => 'username', :id => 'the_username'
|
|
357
|
-
end
|
|
358
|
-
end
|
|
359
|
-
|
|
360
|
-
context 'for #number_field_tag method' do
|
|
361
|
-
should "display number field in ruby" do
|
|
362
|
-
actual_html = number_field_tag(:age, :class => 'numeric')
|
|
363
|
-
assert_has_tag(:input, :type => 'number', :class => 'numeric', :name => 'age') { actual_html }
|
|
364
|
-
end
|
|
365
|
-
|
|
366
|
-
should "display number field in erb" do
|
|
367
|
-
visit '/erb/form_tag'
|
|
368
|
-
assert_have_selector 'form.simple-form input[type=number]', :count => 1, :name => 'age'
|
|
369
|
-
assert_have_selector 'form.advanced-form fieldset input[type=number]', :count => 1, :name => 'age', :class => 'numeric'
|
|
370
|
-
end
|
|
371
|
-
|
|
372
|
-
should "display number field in haml" do
|
|
373
|
-
visit '/haml/form_tag'
|
|
374
|
-
assert_have_selector 'form.simple-form input[type=number]', :count => 1, :name => 'age'
|
|
375
|
-
assert_have_selector 'form.advanced-form fieldset input[type=number]', :count => 1, :name => 'age', :class => 'numeric'
|
|
376
|
-
end
|
|
377
|
-
|
|
378
|
-
should "display number field in slim" do
|
|
379
|
-
visit '/slim/form_tag'
|
|
380
|
-
assert_have_selector 'form.simple-form input[type=number]', :count => 1, :name => 'age'
|
|
381
|
-
assert_have_selector 'form.advanced-form fieldset input[type=number]', :count => 1, :name => 'age', :class => 'numeric'
|
|
382
|
-
end
|
|
383
|
-
end
|
|
384
|
-
|
|
385
|
-
context 'for #telephone_field_tag method' do
|
|
386
|
-
should "display number field in ruby" do
|
|
387
|
-
actual_html = telephone_field_tag(:telephone, :class => 'numeric')
|
|
388
|
-
assert_has_tag(:input, :type => 'tel', :class => 'numeric', :name => 'telephone') { actual_html }
|
|
389
|
-
end
|
|
390
|
-
|
|
391
|
-
should "display telephone field in erb" do
|
|
392
|
-
visit '/erb/form_tag'
|
|
393
|
-
assert_have_selector 'form.simple-form input[type=tel]', :count => 1, :name => 'telephone'
|
|
394
|
-
assert_have_selector 'form.advanced-form fieldset input[type=tel]', :count => 1, :name => 'telephone', :class => 'numeric'
|
|
395
|
-
end
|
|
396
|
-
|
|
397
|
-
should "display telephone field in haml" do
|
|
398
|
-
visit '/haml/form_tag'
|
|
399
|
-
assert_have_selector 'form.simple-form input[type=tel]', :count => 1, :name => 'telephone'
|
|
400
|
-
assert_have_selector 'form.advanced-form fieldset input[type=tel]', :count => 1, :name => 'telephone', :class => 'numeric'
|
|
401
|
-
end
|
|
402
|
-
|
|
403
|
-
should "display telephone field in slim" do
|
|
404
|
-
visit '/slim/form_tag'
|
|
405
|
-
assert_have_selector 'form.simple-form input[type=tel]', :count => 1, :name => 'telephone'
|
|
406
|
-
assert_have_selector 'form.advanced-form fieldset input[type=tel]', :count => 1, :name => 'telephone', :class => 'numeric'
|
|
407
|
-
end
|
|
408
|
-
end
|
|
409
|
-
|
|
410
|
-
context 'for #search_field_tag method' do
|
|
411
|
-
should "display search field in ruby" do
|
|
412
|
-
actual_html = search_field_tag(:search, :class => 'string')
|
|
413
|
-
assert_has_tag(:input, :type => 'search', :class => 'string', :name => 'search') { actual_html }
|
|
414
|
-
end
|
|
415
|
-
|
|
416
|
-
should "display search field in erb" do
|
|
417
|
-
visit '/erb/form_tag'
|
|
418
|
-
assert_have_selector 'form.simple-form input[type=search]', :count => 1, :name => 'search'
|
|
419
|
-
assert_have_selector 'form.advanced-form fieldset input[type=search]', :count => 1, :name => 'search', :class => 'string'
|
|
420
|
-
end
|
|
421
|
-
|
|
422
|
-
should "display search field in haml" do
|
|
423
|
-
visit '/haml/form_tag'
|
|
424
|
-
assert_have_selector 'form.simple-form input[type=search]', :count => 1, :name => 'search'
|
|
425
|
-
assert_have_selector 'form.advanced-form fieldset input[type=search]', :count => 1, :name => 'search', :class => 'string'
|
|
426
|
-
end
|
|
427
|
-
|
|
428
|
-
should "display search field in slim" do
|
|
429
|
-
visit '/slim/form_tag'
|
|
430
|
-
assert_have_selector 'form.simple-form input[type=search]', :count => 1, :name => 'search'
|
|
431
|
-
assert_have_selector 'form.advanced-form fieldset input[type=search]', :count => 1, :name => 'search', :class => 'string'
|
|
432
|
-
end
|
|
433
|
-
end
|
|
434
|
-
|
|
435
|
-
context 'for #email_field_tag method' do
|
|
436
|
-
should "display email field in ruby" do
|
|
437
|
-
actual_html = email_field_tag(:email, :class => 'string')
|
|
438
|
-
assert_has_tag(:input, :type => 'email', :class => 'string', :name => 'email') { actual_html }
|
|
439
|
-
end
|
|
440
|
-
|
|
441
|
-
should "display email field in erb" do
|
|
442
|
-
visit '/erb/form_tag'
|
|
443
|
-
assert_have_selector 'form.simple-form input[type=email]', :count => 1, :name => 'email'
|
|
444
|
-
assert_have_selector 'form.advanced-form fieldset input[type=email]', :count => 1, :name => 'email', :class => 'string'
|
|
445
|
-
end
|
|
446
|
-
|
|
447
|
-
should "display email field in haml" do
|
|
448
|
-
visit '/haml/form_tag'
|
|
449
|
-
assert_have_selector 'form.simple-form input[type=email]', :count => 1, :name => 'email'
|
|
450
|
-
assert_have_selector 'form.advanced-form fieldset input[type=email]', :count => 1, :name => 'email', :class => 'string'
|
|
451
|
-
end
|
|
452
|
-
|
|
453
|
-
should "display email field in slim" do
|
|
454
|
-
visit '/slim/form_tag'
|
|
455
|
-
assert_have_selector 'form.simple-form input[type=email]', :count => 1, :name => 'email'
|
|
456
|
-
assert_have_selector 'form.advanced-form fieldset input[type=email]', :count => 1, :name => 'email', :class => 'string'
|
|
457
|
-
end
|
|
458
|
-
end
|
|
459
|
-
|
|
460
|
-
context 'for #url_field_tag method' do
|
|
461
|
-
should "display url field in ruby" do
|
|
462
|
-
actual_html = url_field_tag(:webpage, :class => 'string')
|
|
463
|
-
assert_has_tag(:input, :type => 'url', :class => 'string', :name => 'webpage') { actual_html }
|
|
464
|
-
end
|
|
465
|
-
|
|
466
|
-
should "display url field in erb" do
|
|
467
|
-
visit '/erb/form_tag'
|
|
468
|
-
assert_have_selector 'form.simple-form input[type=url]', :count => 1, :name => 'webpage'
|
|
469
|
-
assert_have_selector 'form.advanced-form fieldset input[type=url]', :count => 1, :name => 'webpage', :class => 'string'
|
|
470
|
-
end
|
|
471
|
-
|
|
472
|
-
should "display url field in haml" do
|
|
473
|
-
visit '/haml/form_tag'
|
|
474
|
-
assert_have_selector 'form.simple-form input[type=url]', :count => 1, :name => 'webpage'
|
|
475
|
-
assert_have_selector 'form.advanced-form fieldset input[type=url]', :count => 1, :name => 'webpage', :class => 'string'
|
|
476
|
-
end
|
|
477
|
-
|
|
478
|
-
should "display url field in slim" do
|
|
479
|
-
visit '/slim/form_tag'
|
|
480
|
-
assert_have_selector 'form.simple-form input[type=url]', :count => 1, :name => 'webpage'
|
|
481
|
-
assert_have_selector 'form.advanced-form fieldset input[type=url]', :count => 1, :name => 'webpage', :class => 'string'
|
|
482
|
-
end
|
|
483
|
-
end
|
|
484
|
-
|
|
485
|
-
context 'for #text_area_tag method' do
|
|
486
|
-
should "display text area in ruby" do
|
|
487
|
-
actual_html = text_area_tag(:about, :class => 'long')
|
|
488
|
-
assert_has_tag(:textarea, :class => "long", :name => 'about') { actual_html }
|
|
489
|
-
end
|
|
490
|
-
|
|
491
|
-
should "display text area in ruby with specified content" do
|
|
492
|
-
actual_html = text_area_tag(:about, :value => "a test", :rows => 5, :cols => 6)
|
|
493
|
-
assert_has_tag(:textarea, :content => "a test", :name => 'about', :rows => "5", :cols => "6") { actual_html }
|
|
494
|
-
end
|
|
495
|
-
|
|
496
|
-
should "display text area in erb" do
|
|
497
|
-
visit '/erb/form_tag'
|
|
498
|
-
assert_have_selector 'form.advanced-form textarea', :count => 1, :name => 'about', :class => 'large'
|
|
499
|
-
end
|
|
500
|
-
|
|
501
|
-
should "display text area in haml" do
|
|
502
|
-
visit '/haml/form_tag'
|
|
503
|
-
assert_have_selector 'form.advanced-form textarea', :count => 1, :name => 'about', :class => 'large'
|
|
504
|
-
end
|
|
505
|
-
|
|
506
|
-
should "display text area in slim" do
|
|
507
|
-
visit '/slim/form_tag'
|
|
508
|
-
assert_have_selector 'form.advanced-form textarea', :count => 1, :name => 'about', :class => 'large'
|
|
509
|
-
end
|
|
510
|
-
end
|
|
511
|
-
|
|
512
|
-
context 'for #password_field_tag method' do
|
|
513
|
-
should "display password field in ruby" do
|
|
514
|
-
actual_html = password_field_tag(:password, :class => 'long')
|
|
515
|
-
assert_has_tag(:input, :type => 'password', :class => "long", :name => 'password') { actual_html }
|
|
516
|
-
end
|
|
517
|
-
|
|
518
|
-
should "display password field in erb" do
|
|
519
|
-
visit '/erb/form_tag'
|
|
520
|
-
assert_have_selector 'form.simple-form input[type=password]', :count => 1, :name => 'password'
|
|
521
|
-
assert_have_selector 'form.advanced-form input[type=password]', :count => 1, :name => 'password'
|
|
522
|
-
end
|
|
523
|
-
|
|
524
|
-
should "display password field in haml" do
|
|
525
|
-
visit '/haml/form_tag'
|
|
526
|
-
assert_have_selector 'form.simple-form input[type=password]', :count => 1, :name => 'password'
|
|
527
|
-
assert_have_selector 'form.advanced-form input[type=password]', :count => 1, :name => 'password'
|
|
528
|
-
end
|
|
529
|
-
|
|
530
|
-
should "display password field in slim" do
|
|
531
|
-
visit '/slim/form_tag'
|
|
532
|
-
assert_have_selector 'form.simple-form input[type=password]', :count => 1, :name => 'password'
|
|
533
|
-
assert_have_selector 'form.advanced-form input[type=password]', :count => 1, :name => 'password'
|
|
534
|
-
end
|
|
535
|
-
end
|
|
536
|
-
|
|
537
|
-
context 'for #file_field_tag method' do
|
|
538
|
-
should "display file field in ruby" do
|
|
539
|
-
actual_html = file_field_tag(:photo, :class => 'photo')
|
|
540
|
-
assert_has_tag(:input, :type => 'file', :class => "photo", :name => 'photo') { actual_html }
|
|
541
|
-
end
|
|
542
|
-
|
|
543
|
-
should "have an array name with multiple option" do
|
|
544
|
-
actual_html = file_field_tag(:photos, :multiple => true)
|
|
545
|
-
assert_has_tag(:input, :name => 'photos[]') { actual_html }
|
|
546
|
-
end
|
|
547
|
-
|
|
548
|
-
should "display file field in erb" do
|
|
549
|
-
visit '/erb/form_tag'
|
|
550
|
-
assert_have_selector 'form.advanced-form input[type=file]', :count => 1, :name => 'photo', :class => 'upload'
|
|
551
|
-
end
|
|
552
|
-
|
|
553
|
-
should "display file field in haml" do
|
|
554
|
-
visit '/haml/form_tag'
|
|
555
|
-
assert_have_selector 'form.advanced-form input[type=file]', :count => 1, :name => 'photo', :class => 'upload'
|
|
556
|
-
end
|
|
557
|
-
|
|
558
|
-
should "display file field in slim" do
|
|
559
|
-
visit '/slim/form_tag'
|
|
560
|
-
assert_have_selector 'form.advanced-form input[type=file]', :count => 1, :name => 'photo', :class => 'upload'
|
|
561
|
-
end
|
|
562
|
-
end
|
|
563
|
-
|
|
564
|
-
context "for #check_box_tag method" do
|
|
565
|
-
should "display check_box tag in ruby" do
|
|
566
|
-
actual_html = check_box_tag("clear_session")
|
|
567
|
-
assert_has_tag(:input, :type => 'checkbox', :value => '1', :name => 'clear_session') { actual_html }
|
|
568
|
-
assert_has_no_tag(:input, :type => 'hidden') { actual_html }
|
|
569
|
-
end
|
|
570
|
-
|
|
571
|
-
should "display check_box tag in ruby with extended attributes" do
|
|
572
|
-
actual_html = check_box_tag("clear_session", :disabled => true, :checked => true)
|
|
573
|
-
assert_has_tag(:input, :type => 'checkbox', :disabled => 'disabled', :checked => 'checked') { actual_html }
|
|
574
|
-
end
|
|
575
|
-
|
|
576
|
-
should "display check_box tag in erb" do
|
|
577
|
-
visit '/erb/form_tag'
|
|
578
|
-
assert_have_selector 'form.simple-form input[type=checkbox]', :count => 1
|
|
579
|
-
assert_have_selector 'form.advanced-form input[type=checkbox]', :value => "1", :checked => 'checked'
|
|
580
|
-
end
|
|
581
|
-
|
|
582
|
-
should "display check_box tag in haml" do
|
|
583
|
-
visit '/haml/form_tag'
|
|
584
|
-
assert_have_selector 'form.simple-form input[type=checkbox]', :count => 1
|
|
585
|
-
assert_have_selector 'form.advanced-form input[type=checkbox]', :value => "1", :checked => 'checked'
|
|
586
|
-
end
|
|
587
|
-
|
|
588
|
-
should "display check_box tag in slim" do
|
|
589
|
-
visit '/slim/form_tag'
|
|
590
|
-
assert_have_selector 'form.simple-form input[type=checkbox]', :count => 1
|
|
591
|
-
assert_have_selector 'form.advanced-form input[type=checkbox]', :value => "1", :checked => 'checked'
|
|
592
|
-
end
|
|
593
|
-
end
|
|
594
|
-
|
|
595
|
-
context "for #radio_button_tag method" do
|
|
596
|
-
should "display radio_button tag in ruby" do
|
|
597
|
-
actual_html = radio_button_tag("gender", :value => 'male')
|
|
598
|
-
assert_has_tag(:input, :type => 'radio', :value => 'male', :name => 'gender') { actual_html }
|
|
599
|
-
end
|
|
600
|
-
|
|
601
|
-
should "display radio_button tag in ruby with extended attributes" do
|
|
602
|
-
actual_html = radio_button_tag("gender", :disabled => true, :checked => true)
|
|
603
|
-
assert_has_tag(:input, :type => 'radio', :disabled => 'disabled', :checked => 'checked') { actual_html }
|
|
604
|
-
end
|
|
605
|
-
|
|
606
|
-
should "display radio_button tag in erb" do
|
|
607
|
-
visit '/erb/form_tag'
|
|
608
|
-
assert_have_selector 'form.simple-form input[type=radio]', :count => 1, :value => 'male'
|
|
609
|
-
assert_have_selector 'form.simple-form input[type=radio]', :count => 1, :value => 'female'
|
|
610
|
-
assert_have_selector 'form.advanced-form input[type=radio]', :value => "male", :checked => 'checked'
|
|
611
|
-
assert_have_selector 'form.advanced-form input[type=radio]', :value => "female"
|
|
612
|
-
end
|
|
613
|
-
|
|
614
|
-
should "display radio_button tag in haml" do
|
|
615
|
-
visit '/haml/form_tag'
|
|
616
|
-
assert_have_selector 'form.simple-form input[type=radio]', :count => 1, :value => 'male'
|
|
617
|
-
assert_have_selector 'form.simple-form input[type=radio]', :count => 1, :value => 'female'
|
|
618
|
-
assert_have_selector 'form.advanced-form input[type=radio]', :value => "male", :checked => 'checked'
|
|
619
|
-
assert_have_selector 'form.advanced-form input[type=radio]', :value => "female"
|
|
620
|
-
end
|
|
621
|
-
|
|
622
|
-
should "display radio_button tag in slim" do
|
|
623
|
-
visit '/slim/form_tag'
|
|
624
|
-
assert_have_selector 'form.simple-form input[type=radio]', :count => 1, :value => 'male'
|
|
625
|
-
assert_have_selector 'form.simple-form input[type=radio]', :count => 1, :value => 'female'
|
|
626
|
-
assert_have_selector 'form.advanced-form input[type=radio]', :value => "male", :checked => 'checked'
|
|
627
|
-
assert_have_selector 'form.advanced-form input[type=radio]', :value => "female"
|
|
628
|
-
end
|
|
629
|
-
end
|
|
630
|
-
|
|
631
|
-
context "for #select_tag method" do
|
|
632
|
-
should "display select tag in ruby" do
|
|
633
|
-
actual_html = select_tag(:favorite_color, :options => ['green', 'blue', 'black'], :include_blank => true)
|
|
634
|
-
assert_has_tag(:select, :name => 'favorite_color') { actual_html }
|
|
635
|
-
assert_has_tag('select option:first-child', :content => '') { actual_html }
|
|
636
|
-
assert_has_tag('select option', :content => 'green', :value => 'green') { actual_html }
|
|
637
|
-
assert_has_tag('select option', :content => 'blue', :value => 'blue') { actual_html }
|
|
638
|
-
assert_has_tag('select option', :content => 'black', :value => 'black') { actual_html }
|
|
639
|
-
end
|
|
640
|
-
|
|
641
|
-
should "display select tag in ruby with extended attributes" do
|
|
642
|
-
actual_html = select_tag(:favorite_color, :disabled => true, :options => ['only', 'option'])
|
|
643
|
-
assert_has_tag(:select, :disabled => 'disabled') { actual_html }
|
|
644
|
-
end
|
|
645
|
-
|
|
646
|
-
should "take a range as a collection for options" do
|
|
647
|
-
actual_html = select_tag(:favorite_color, :options => (1..3))
|
|
648
|
-
assert_has_tag(:select) { actual_html }
|
|
649
|
-
assert_has_tag('select option', :value => '1') { actual_html }
|
|
650
|
-
assert_has_tag('select option', :value => '2') { actual_html }
|
|
651
|
-
assert_has_tag('select option', :value => '3') { actual_html }
|
|
652
|
-
end
|
|
653
|
-
|
|
654
|
-
should "include blank for grouped options" do
|
|
655
|
-
opts = { "Red" => ["Rose","Fire"], "Blue" => ["Sky","Sea"] }
|
|
656
|
-
actual_html = select_tag( 'color', :grouped_options => opts, :include_blank => true )
|
|
657
|
-
assert_has_tag('select option:first-child', :value => "", :content => "") { actual_html }
|
|
658
|
-
end
|
|
659
|
-
|
|
660
|
-
should "display select tag with grouped options for a nested array" do
|
|
661
|
-
opts = [
|
|
662
|
-
["Friends",["Yoda",["Obiwan",2]]],
|
|
663
|
-
["Enemies", ["Palpatine",['Darth Vader',3]]]
|
|
664
|
-
]
|
|
665
|
-
actual_html = select_tag( 'name', :grouped_options => opts )
|
|
666
|
-
assert_has_tag(:select, :name => "name") { actual_html }
|
|
667
|
-
assert_has_tag(:optgroup, :label => "Friends") { actual_html }
|
|
668
|
-
assert_has_tag(:option, :value => "Yoda", :content => "Yoda") { actual_html }
|
|
669
|
-
assert_has_tag(:option, :value => "2", :content => "Obiwan") { actual_html }
|
|
670
|
-
assert_has_tag(:optgroup, :label => "Enemies") { actual_html }
|
|
671
|
-
assert_has_tag(:option, :value => "Palpatine", :content => "Palpatine") { actual_html }
|
|
672
|
-
assert_has_tag(:option, :value => "3", :content => "Darth Vader") { actual_html }
|
|
673
|
-
end
|
|
674
|
-
|
|
675
|
-
should "display select tag with grouped options for a nested array and accept disabled groups" do
|
|
676
|
-
opts = [
|
|
677
|
-
["Friends",["Yoda",["Obiwan",2]]],
|
|
678
|
-
["Enemies", ["Palpatine",['Darth Vader',3]], true]
|
|
679
|
-
]
|
|
680
|
-
actual_html = select_tag( 'name', :grouped_options => opts )
|
|
681
|
-
assert_has_tag(:select, :name => "name") { actual_html }
|
|
682
|
-
assert_has_tag(:option, :disabled => 'disabled', :count => 0) { actual_html }
|
|
683
|
-
assert_has_tag(:optgroup, :disabled => 'disabled', :count => 1) { actual_html }
|
|
684
|
-
assert_has_tag(:optgroup, :label => "Enemies", :disabled => 'disabled') { actual_html }
|
|
685
|
-
end
|
|
686
|
-
|
|
687
|
-
should "display select tag with grouped options for a nested array and accept disabled groups and/or with disabled options" do
|
|
688
|
-
opts = [
|
|
689
|
-
["Friends",["Yoda",["Obiwan",2, true]]],
|
|
690
|
-
["Enemies", [["Palpatine", "Palpatine", true],['Darth Vader',3]], true]
|
|
691
|
-
]
|
|
692
|
-
actual_html = select_tag( 'name', :grouped_options => opts )
|
|
693
|
-
assert_has_tag(:select, :name => "name") { actual_html }
|
|
694
|
-
assert_has_tag(:option, :disabled => 'disabled', :count => 2) { actual_html }
|
|
695
|
-
assert_has_tag(:optgroup, :disabled => 'disabled', :count => 1) { actual_html }
|
|
696
|
-
assert_has_tag(:option, :content => "Obiwan", :disabled => 'disabled') { actual_html }
|
|
697
|
-
assert_has_tag(:optgroup, :label => "Enemies", :disabled => 'disabled') { actual_html }
|
|
698
|
-
assert_has_tag(:option, :value => "Palpatine", :content => "Palpatine", :disabled => 'disabled') { actual_html }
|
|
699
|
-
end
|
|
700
|
-
|
|
701
|
-
should "display select tag with grouped options for a hash" do
|
|
702
|
-
opts = {
|
|
703
|
-
"Friends" => ["Yoda",["Obiwan",2]],
|
|
704
|
-
"Enemies" => ["Palpatine",['Darth Vader',3]]
|
|
705
|
-
}
|
|
706
|
-
actual_html = select_tag( 'name', :grouped_options => opts )
|
|
707
|
-
assert_has_tag(:select, :name => "name") { actual_html }
|
|
708
|
-
assert_has_tag(:optgroup, :label => "Friends") { actual_html }
|
|
709
|
-
assert_has_tag(:option, :value => "Yoda", :content => "Yoda") { actual_html }
|
|
710
|
-
assert_has_tag(:option, :value => "2", :content => "Obiwan") { actual_html }
|
|
711
|
-
assert_has_tag(:optgroup, :label => "Enemies") { actual_html }
|
|
712
|
-
assert_has_tag(:option, :value => "Palpatine", :content => "Palpatine") { actual_html }
|
|
713
|
-
assert_has_tag(:option, :value => "3", :content => "Darth Vader") { actual_html }
|
|
714
|
-
end
|
|
715
|
-
|
|
716
|
-
should "display select tag with grouped options for a hash and accept disabled groups" do
|
|
717
|
-
opts = {
|
|
718
|
-
"Friends" => ["Yoda",["Obiwan",2]],
|
|
719
|
-
"Enemies" => ["Palpatine",['Darth Vader',3], {:disabled => true}]
|
|
720
|
-
}
|
|
721
|
-
actual_html = select_tag( 'name', :grouped_options => opts )
|
|
722
|
-
assert_has_tag(:select, :name => "name") { actual_html }
|
|
723
|
-
assert_has_tag(:option, :disabled => 'disabled', :count => 0) { actual_html }
|
|
724
|
-
assert_has_tag(:optgroup, :disabled => 'disabled', :count => 1) { actual_html }
|
|
725
|
-
assert_has_tag(:optgroup, :label => "Enemies", :disabled => 'disabled') { actual_html }
|
|
726
|
-
end
|
|
727
|
-
|
|
728
|
-
should "display select tag with grouped options for a hash and accept disabled groups and/or with disabled options" do
|
|
729
|
-
opts = {
|
|
730
|
-
"Friends" => ["Yoda",["Obiwan",2,true]],
|
|
731
|
-
"Enemies" => [["Palpatine","Palpatine",true],["Darth Vader",3], {:disabled => true}]
|
|
732
|
-
}
|
|
733
|
-
actual_html = select_tag( 'name', :grouped_options => opts )
|
|
734
|
-
assert_has_tag(:select, :name => "name") { actual_html }
|
|
735
|
-
assert_has_tag(:option, :disabled => 'disabled', :count => 2) { actual_html }
|
|
736
|
-
assert_has_tag(:optgroup, :disabled => 'disabled', :count => 1) { actual_html }
|
|
737
|
-
assert_has_tag(:option, :content => "Obiwan", :disabled => 'disabled') { actual_html }
|
|
738
|
-
assert_has_tag(:optgroup, :label => "Enemies", :disabled => 'disabled') { actual_html }
|
|
739
|
-
assert_has_tag(:option, :value => "Palpatine", :content => "Palpatine", :disabled => 'disabled') { actual_html }
|
|
740
|
-
end
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
should "display select tag in ruby with multiple attribute" do
|
|
744
|
-
actual_html = select_tag(:favorite_color, :multiple => true, :options => ['only', 'option'])
|
|
745
|
-
assert_has_tag(:select, :multiple => 'multiple', :name => 'favorite_color[]') { actual_html }
|
|
746
|
-
end
|
|
747
|
-
|
|
748
|
-
should "display options with values and single selected" do
|
|
749
|
-
options = [['Green', 'green1'], ['Blue', 'blue1'], ['Black', "black1"]]
|
|
750
|
-
actual_html = select_tag(:favorite_color, :options => options, :selected => 'green1')
|
|
751
|
-
assert_has_tag(:select, :name => 'favorite_color') { actual_html }
|
|
752
|
-
assert_has_tag('select option', :selected => 'selected', :count => 1) { actual_html }
|
|
753
|
-
assert_has_tag('select option', :content => 'Green', :value => 'green1', :selected => 'selected') { actual_html }
|
|
754
|
-
assert_has_tag('select option', :content => 'Blue', :value => 'blue1') { actual_html }
|
|
755
|
-
assert_has_tag('select option', :content => 'Black', :value => 'black1') { actual_html }
|
|
756
|
-
end
|
|
757
|
-
|
|
758
|
-
should "display options with values and accept disabled options" do
|
|
759
|
-
options = [['Green', 'green1', true], ['Blue', 'blue1'], ['Black', "black1"]]
|
|
760
|
-
actual_html = select_tag(:favorite_color, :options => options)
|
|
761
|
-
assert_has_tag(:select, :name => 'favorite_color') { actual_html }
|
|
762
|
-
assert_has_tag('select option', :disabled => 'disabled', :count => 1) { actual_html }
|
|
763
|
-
assert_has_tag('select option', :content => 'Green', :value => 'green1', :disabled => 'disabled') { actual_html }
|
|
764
|
-
assert_has_tag('select option', :content => 'Blue', :value => 'blue1') { actual_html }
|
|
765
|
-
assert_has_tag('select option', :content => 'Black', :value => 'black1') { actual_html }
|
|
766
|
-
end
|
|
767
|
-
|
|
768
|
-
should "display option with values and multiple selected" do
|
|
769
|
-
options = [['Green', 'green1'], ['Blue', 'blue1'], ['Black', "black1"]]
|
|
770
|
-
actual_html = select_tag(:favorite_color, :options => options, :selected => ['green1', 'Black'])
|
|
771
|
-
assert_has_tag(:select, :name => 'favorite_color') { actual_html }
|
|
772
|
-
assert_has_tag('select option', :selected => 'selected', :count => 2) { actual_html }
|
|
773
|
-
assert_has_tag('select option', :content => 'Green', :value => 'green1', :selected => 'selected') { actual_html }
|
|
774
|
-
assert_has_tag('select option', :content => 'Blue', :value => 'blue1') { actual_html }
|
|
775
|
-
assert_has_tag('select option', :content => 'Black', :value => 'black1', :selected => 'selected') { actual_html }
|
|
776
|
-
end
|
|
777
|
-
|
|
778
|
-
should "display options selected only for exact match" do
|
|
779
|
-
options = [['One', '1'], ['1', '10'], ['Two', "-1"]]
|
|
780
|
-
actual_html = select_tag(:range, :options => options, :selected => '-1')
|
|
781
|
-
assert_has_tag(:select, :name => 'range') { actual_html }
|
|
782
|
-
assert_has_tag('select option', :selected => 'selected', :count => 1) { actual_html }
|
|
783
|
-
assert_has_tag('select option', :content => 'Two', :value => '-1', :selected => 'selected') { actual_html }
|
|
784
|
-
end
|
|
785
|
-
|
|
786
|
-
should "display select tag in erb" do
|
|
787
|
-
visit '/erb/form_tag'
|
|
788
|
-
assert_have_selector 'form.simple-form select', :count => 1, :name => 'color'
|
|
789
|
-
assert_have_selector('select option', :content => 'green', :value => 'green')
|
|
790
|
-
assert_have_selector('select option', :content => 'orange', :value => 'orange')
|
|
791
|
-
assert_have_selector('select option', :content => 'purple', :value => 'purple')
|
|
792
|
-
assert_have_selector('form.advanced-form select', :name => 'fav_color')
|
|
793
|
-
assert_have_selector('select option', :content => 'green', :value => '1')
|
|
794
|
-
assert_have_selector('select option', :content => 'orange', :value => '2', :selected => 'selected')
|
|
795
|
-
assert_have_selector('select option', :content => 'purple', :value => '3')
|
|
796
|
-
assert_have_selector('select optgroup', :label => 'foo')
|
|
797
|
-
assert_have_selector('select optgroup', :label => 'bar')
|
|
798
|
-
assert_have_selector('select optgroup option', :content => 'foo', :value => 'foo')
|
|
799
|
-
assert_have_selector('select optgroup option', :content => 'bar', :value => 'bar')
|
|
800
|
-
assert_have_selector('select optgroup', :label => 'Friends')
|
|
801
|
-
assert_have_selector('select optgroup', :label => 'Enemies')
|
|
802
|
-
assert_have_selector('select optgroup option', :content => 'Yoda', :value => 'Yoda')
|
|
803
|
-
assert_have_selector('select optgroup option', :content => 'Obiwan', :value => '1')
|
|
804
|
-
assert_have_selector('select optgroup option', :content => 'Palpatine', :value => 'Palpatine')
|
|
805
|
-
assert_have_selector('select optgroup option', :content => 'Darth Vader', :value => '3')
|
|
806
|
-
end
|
|
807
|
-
|
|
808
|
-
should "display select tag in haml" do
|
|
809
|
-
visit '/haml/form_tag'
|
|
810
|
-
assert_have_selector 'form.simple-form select', :count => 1, :name => 'color'
|
|
811
|
-
assert_have_selector('select option', :content => 'green', :value => 'green')
|
|
812
|
-
assert_have_selector('select option', :content => 'orange', :value => 'orange')
|
|
813
|
-
assert_have_selector('select option', :content => 'purple', :value => 'purple')
|
|
814
|
-
assert_have_selector('form.advanced-form select', :name => 'fav_color')
|
|
815
|
-
assert_have_selector('select option', :content => 'green', :value => '1')
|
|
816
|
-
assert_have_selector('select option', :content => 'orange', :value => '2', :selected => 'selected')
|
|
817
|
-
assert_have_selector('select option', :content => 'purple', :value => '3')
|
|
818
|
-
assert_have_selector('select optgroup', :label => 'foo')
|
|
819
|
-
assert_have_selector('select optgroup', :label => 'bar')
|
|
820
|
-
assert_have_selector('select optgroup option', :content => 'foo', :value => 'foo')
|
|
821
|
-
assert_have_selector('select optgroup option', :content => 'bar', :value => 'bar')
|
|
822
|
-
assert_have_selector('select optgroup', :label => 'Friends')
|
|
823
|
-
assert_have_selector('select optgroup', :label => 'Enemies')
|
|
824
|
-
assert_have_selector('select optgroup option', :content => 'Yoda', :value => 'Yoda')
|
|
825
|
-
assert_have_selector('select optgroup option', :content => 'Obiwan', :value => '1')
|
|
826
|
-
assert_have_selector('select optgroup option', :content => 'Palpatine', :value => 'Palpatine')
|
|
827
|
-
assert_have_selector('select optgroup option', :content => 'Darth Vader', :value => '3')
|
|
828
|
-
end
|
|
829
|
-
|
|
830
|
-
should "display select tag in slim" do
|
|
831
|
-
visit '/slim/form_tag'
|
|
832
|
-
assert_have_selector 'form.simple-form select', :count => 1, :name => 'color'
|
|
833
|
-
assert_have_selector('select option', :content => 'green', :value => 'green')
|
|
834
|
-
assert_have_selector('select option', :content => 'orange', :value => 'orange')
|
|
835
|
-
assert_have_selector('select option', :content => 'purple', :value => 'purple')
|
|
836
|
-
assert_have_selector('form.advanced-form select', :name => 'fav_color')
|
|
837
|
-
assert_have_selector('select option', :content => 'green', :value => '1')
|
|
838
|
-
assert_have_selector('select option', :content => 'orange', :value => '2', :selected => 'selected')
|
|
839
|
-
assert_have_selector('select option', :content => 'purple', :value => '3')
|
|
840
|
-
assert_have_selector('select optgroup', :label => 'foo')
|
|
841
|
-
assert_have_selector('select optgroup', :label => 'bar')
|
|
842
|
-
assert_have_selector('select optgroup option', :content => 'foo', :value => 'foo')
|
|
843
|
-
assert_have_selector('select optgroup option', :content => 'bar', :value => 'bar')
|
|
844
|
-
assert_have_selector('select optgroup', :label => 'Friends')
|
|
845
|
-
assert_have_selector('select optgroup', :label => 'Enemies')
|
|
846
|
-
assert_have_selector('select optgroup option', :content => 'Yoda', :value => 'Yoda')
|
|
847
|
-
assert_have_selector('select optgroup option', :content => 'Obiwan', :value => '1')
|
|
848
|
-
assert_have_selector('select optgroup option', :content => 'Palpatine', :value => 'Palpatine')
|
|
849
|
-
assert_have_selector('select optgroup option', :content => 'Darth Vader', :value => '3')
|
|
850
|
-
end
|
|
851
|
-
end
|
|
852
|
-
|
|
853
|
-
context 'for #submit_tag method' do
|
|
854
|
-
should "display submit tag in ruby" do
|
|
855
|
-
actual_html = submit_tag("Update", :class => 'success')
|
|
856
|
-
assert_has_tag(:input, :type => 'submit', :class => "success", :value => 'Update') { actual_html }
|
|
857
|
-
end
|
|
858
|
-
|
|
859
|
-
should "display submit tag in erb" do
|
|
860
|
-
visit '/erb/form_tag'
|
|
861
|
-
assert_have_selector 'form.simple-form input[type=submit]', :count => 1, :value => "Submit"
|
|
862
|
-
assert_have_selector 'form.advanced-form input[type=submit]', :count => 1, :value => "Login"
|
|
863
|
-
end
|
|
864
|
-
|
|
865
|
-
should "display submit tag in haml" do
|
|
866
|
-
visit '/haml/form_tag'
|
|
867
|
-
assert_have_selector 'form.simple-form input[type=submit]', :count => 1, :value => "Submit"
|
|
868
|
-
assert_have_selector 'form.advanced-form input[type=submit]', :count => 1, :value => "Login"
|
|
869
|
-
end
|
|
870
|
-
|
|
871
|
-
should "display submit tag in slim" do
|
|
872
|
-
visit '/slim/form_tag'
|
|
873
|
-
assert_have_selector 'form.simple-form input[type=submit]', :count => 1, :value => "Submit"
|
|
874
|
-
assert_have_selector 'form.advanced-form input[type=submit]', :count => 1, :value => "Login"
|
|
875
|
-
end
|
|
876
|
-
|
|
877
|
-
context 'for omitted args' do
|
|
878
|
-
should "display submit tag with default caption" do
|
|
879
|
-
actual_html = submit_tag()
|
|
880
|
-
assert_has_tag(:input, :type => 'submit', :value => 'Submit') { actual_html }
|
|
881
|
-
end
|
|
882
|
-
end
|
|
883
|
-
|
|
884
|
-
context 'for omitted caption arg' do
|
|
885
|
-
should "display submit tag with default caption" do
|
|
886
|
-
actual_html = submit_tag(:class => 'success')
|
|
887
|
-
assert_has_tag(:input, :type => 'submit', :class => 'success', :value => 'Submit') { actual_html }
|
|
888
|
-
end
|
|
889
|
-
|
|
890
|
-
should "display submit tag without caption value when nil" do
|
|
891
|
-
actual_html = submit_tag(nil, :class => 'success')
|
|
892
|
-
assert_has_tag(:input, :type => 'submit', :class => 'success') { actual_html }
|
|
893
|
-
assert_has_no_tag(:input, :type => 'submit', :class => 'success', :value => 'Submit') { actual_html }
|
|
894
|
-
end
|
|
895
|
-
end
|
|
896
|
-
end
|
|
897
|
-
|
|
898
|
-
context 'for #button_tag method' do
|
|
899
|
-
should "display submit tag in ruby" do
|
|
900
|
-
actual_html = button_tag("Cancel", :class => 'clear')
|
|
901
|
-
assert_has_tag(:input, :type => 'button', :class => "clear", :value => 'Cancel') { actual_html }
|
|
902
|
-
end
|
|
903
|
-
|
|
904
|
-
should "display submit tag in erb" do
|
|
905
|
-
visit '/erb/form_tag'
|
|
906
|
-
assert_have_selector 'form.advanced-form input[type=button]', :count => 1, :value => "Cancel"
|
|
907
|
-
end
|
|
908
|
-
|
|
909
|
-
should "display submit tag in haml" do
|
|
910
|
-
visit '/haml/form_tag'
|
|
911
|
-
assert_have_selector 'form.advanced-form input[type=button]', :count => 1, :value => "Cancel"
|
|
912
|
-
end
|
|
913
|
-
|
|
914
|
-
should "display submit tag in slim" do
|
|
915
|
-
visit '/slim/form_tag'
|
|
916
|
-
assert_have_selector 'form.advanced-form input[type=button]', :count => 1, :value => "Cancel"
|
|
917
|
-
end
|
|
918
|
-
end
|
|
919
|
-
|
|
920
|
-
context 'for #image_submit_tag method' do
|
|
921
|
-
setup do
|
|
922
|
-
@stamp = stop_time_for_test.to_i
|
|
923
|
-
end
|
|
924
|
-
|
|
925
|
-
should "display image submit tag in ruby with relative path" do
|
|
926
|
-
actual_html = image_submit_tag('buttons/ok.png', :class => 'success')
|
|
927
|
-
assert_has_tag(:input, :type => 'image', :class => "success", :src => "/images/buttons/ok.png?#{@stamp}") { actual_html }
|
|
928
|
-
end
|
|
929
|
-
|
|
930
|
-
should "display image submit tag in ruby with absolute path" do
|
|
931
|
-
actual_html = image_submit_tag('/system/ok.png', :class => 'success')
|
|
932
|
-
assert_has_tag(:input, :type => 'image', :class => "success", :src => "/system/ok.png") { actual_html }
|
|
933
|
-
end
|
|
934
|
-
|
|
935
|
-
should "display image submit tag in erb" do
|
|
936
|
-
visit '/erb/form_tag'
|
|
937
|
-
assert_have_selector 'form.advanced-form input[type=image]', :count => 1, :src => "/images/buttons/submit.png?#{@stamp}"
|
|
938
|
-
end
|
|
939
|
-
|
|
940
|
-
should "display image submit tag in haml" do
|
|
941
|
-
visit '/haml/form_tag'
|
|
942
|
-
assert_have_selector 'form.advanced-form input[type=image]', :count => 1, :src => "/images/buttons/submit.png?#{@stamp}"
|
|
943
|
-
end
|
|
944
|
-
|
|
945
|
-
should "display image submit tag in slim" do
|
|
946
|
-
visit '/slim/form_tag'
|
|
947
|
-
assert_have_selector 'form.advanced-form input[type=image]', :count => 1, :src => "/images/buttons/submit.png?#{@stamp}"
|
|
948
|
-
end
|
|
949
|
-
end
|
|
950
|
-
|
|
951
|
-
context 'for #button_to method' do
|
|
952
|
-
should "have a form and set the method properly" do
|
|
953
|
-
actual_html = button_to('Delete', '/users/1', :method => :delete)
|
|
954
|
-
assert_has_tag('form', :action => '/users/1') { actual_html }
|
|
955
|
-
assert_has_tag('form input', :type => 'hidden', :name => "_method", :value => 'delete') { actual_html }
|
|
956
|
-
assert_has_tag('form input', :type => 'hidden', :name => "authenticity_token") { actual_html }
|
|
957
|
-
end
|
|
958
|
-
|
|
959
|
-
should "add a submit button by default if no content is specified" do
|
|
960
|
-
actual_html = button_to('My Delete Button', '/users/1', :method => :delete)
|
|
961
|
-
assert_has_tag('form input', :type => 'submit', :value => 'My Delete Button') { actual_html }
|
|
962
|
-
end
|
|
963
|
-
|
|
964
|
-
should "set specific content inside the form if a block was sent" do
|
|
965
|
-
actual_html = button_to('My Delete Button', '/users/1', :method => :delete) do
|
|
966
|
-
content_tag :button, "My button's content", :type => :submit, :title => "My button"
|
|
967
|
-
end
|
|
968
|
-
assert_has_tag('form button', :type => 'submit', :content => "My button's content", :title => "My button") { actual_html }
|
|
969
|
-
end
|
|
970
|
-
|
|
971
|
-
should "pass options on submit button when submit_options are given" do
|
|
972
|
-
actual_html = button_to("Fancy button", '/users/1', :submit_options => { :class => :fancy })
|
|
973
|
-
assert_has_tag('form input', :type => 'submit', :value => 'Fancy button', :class => 'fancy') { actual_html }
|
|
974
|
-
end
|
|
975
|
-
|
|
976
|
-
should 'display correct button_to in erb' do
|
|
977
|
-
visit '/erb/button_to'
|
|
978
|
-
assert_have_selector('form', :action => '/foo')
|
|
979
|
-
assert_have_selector('form label', :for => 'username', :content => 'Username: ')
|
|
980
|
-
assert_have_selector('form', :action => '/bar')
|
|
981
|
-
assert_have_selector('#test-point ~ form > input[type=submit]', :value => 'Bar button')
|
|
982
|
-
end
|
|
983
|
-
|
|
984
|
-
should 'display correct button_to in haml' do
|
|
985
|
-
visit '/haml/button_to'
|
|
986
|
-
assert_have_selector('form', :action => '/foo')
|
|
987
|
-
assert_have_selector('form label', :for => 'username', :content => 'Username: ')
|
|
988
|
-
assert_have_selector('form', :action => '/bar')
|
|
989
|
-
assert_have_selector('#test-point ~ form > input[type=submit]', :value => 'Bar button')
|
|
990
|
-
end
|
|
991
|
-
|
|
992
|
-
should 'display correct button_to in slim' do
|
|
993
|
-
visit '/slim/button_to'
|
|
994
|
-
assert_have_selector('form', :action => '/foo')
|
|
995
|
-
assert_have_selector('form label', :for => 'username', :content => 'Username: ')
|
|
996
|
-
assert_have_selector('form', :action => '/bar')
|
|
997
|
-
assert_have_selector('#test-point ~ form > input[type=submit]', :value => 'Bar button')
|
|
998
|
-
end
|
|
999
|
-
end
|
|
1000
|
-
|
|
1001
|
-
context 'for #range_field_tag' do
|
|
1002
|
-
should "create an input tag with min and max options" do
|
|
1003
|
-
actual_html = range_field_tag('ranger', :min => 20, :max => 50)
|
|
1004
|
-
assert_has_tag('input', :type => 'range', :name => 'ranger', :min => '20', :max => '50') { actual_html }
|
|
1005
|
-
end
|
|
1006
|
-
|
|
1007
|
-
should "create an input tag with range" do
|
|
1008
|
-
actual_html = range_field_tag('ranger', :range => 1..20)
|
|
1009
|
-
assert_has_tag('input', :min => '1', :max => '20') { actual_html }
|
|
1010
|
-
end
|
|
1011
|
-
|
|
1012
|
-
should "display correct range_field_tag in erb" do
|
|
1013
|
-
visit '/erb/form_tag'
|
|
1014
|
-
assert_have_selector 'input', :type => 'range', :name => 'ranger_with_min_max', :min => '1', :max => '50', :count => 1
|
|
1015
|
-
assert_have_selector 'input', :type => 'range', :name => 'ranger_with_range', :min => '1', :max => '5', :count => 1
|
|
1016
|
-
end
|
|
1017
|
-
|
|
1018
|
-
should "display correct range_field_tag in haml" do
|
|
1019
|
-
visit '/haml/form_tag'
|
|
1020
|
-
assert_have_selector 'input', :type => 'range', :name => 'ranger_with_min_max', :min => '1', :max => '50', :count => 1
|
|
1021
|
-
assert_have_selector 'input', :type => 'range', :name => 'ranger_with_range', :min => '1', :max => '5', :count => 1
|
|
1022
|
-
end
|
|
1023
|
-
|
|
1024
|
-
should "display correct range_field_tag in slim" do
|
|
1025
|
-
visit '/slim/form_tag'
|
|
1026
|
-
assert_have_selector 'input', :type => 'range', :name => 'ranger_with_min_max', :min => '1', :max => '50', :count => 1
|
|
1027
|
-
assert_have_selector 'input', :type => 'range', :name => 'ranger_with_range', :min => '1', :max => '5', :count => 1
|
|
1028
|
-
end
|
|
1029
|
-
end
|
|
1030
|
-
end
|