middleman-core 3.2.0 → 3.2.1
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/.yardopts +10 -0
- data/features/helpers_auto_javascript_include_tag.feature +21 -0
- data/features/helpers_auto_stylesheet_link_tag.feature +21 -0
- data/features/i18n_builder.feature +23 -13
- data/features/i18n_preview.feature +9 -9
- data/features/markdown_kramdown.feature +1 -1
- data/fixtures/i18n-test-app/source/{layout.erb → layouts/layout.erb} +0 -0
- data/fixtures/i18n-test-app/source/{morning.en.html.erb → localizable/morning.en.html.erb} +0 -0
- data/fixtures/i18n-test-app/source/{morning.es.html.erb → localizable/morning.es.html.erb} +0 -0
- data/fixtures/i18n-test-app/source/{one.en.md → localizable/one.en.md} +0 -0
- data/fixtures/i18n-test-app/source/{one.es.md → localizable/one.es.md} +0 -0
- data/lib/middleman-core/application.rb +4 -0
- data/lib/middleman-core/cli/build.rb +14 -2
- data/lib/middleman-core/cli/init.rb +1 -0
- data/lib/middleman-core/core_extensions.rb +6 -1
- data/lib/middleman-core/core_extensions/file_watcher.rb +1 -0
- data/lib/middleman-core/core_extensions/request.rb +2 -4
- data/lib/middleman-core/extensions.rb +13 -5
- data/lib/middleman-core/meta_pages.rb +25 -11
- data/lib/middleman-core/meta_pages/sitemap_resource.rb +2 -2
- data/lib/middleman-core/meta_pages/templates/config.html.erb +7 -9
- data/lib/middleman-core/meta_pages/templates/index.html.erb +3 -3
- data/lib/middleman-core/meta_pages/templates/sitemap.html.erb +6 -6
- data/lib/middleman-core/sitemap/extensions/redirects.rb +1 -2
- data/lib/middleman-core/sitemap/extensions/request_endpoints.rb +2 -3
- data/lib/middleman-core/sitemap/resource.rb +7 -13
- data/lib/middleman-core/util.rb +2 -3
- data/lib/middleman-core/version.rb +1 -1
- data/lib/middleman-more/core_extensions/default_helpers.rb +9 -5
- data/lib/middleman-more/core_extensions/i18n.rb +17 -10
- data/lib/middleman-more/extensions/{automatic-alt-tags.rb → automatic_alt_tags.rb} +0 -0
- data/lib/middleman-more/extensions/gzip.rb +29 -6
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/.document +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/.gitignore +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/.yardopts +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/LICENSE.txt +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/README.rdoc +5 -5
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/Rakefile +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/bin/padrino +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core.rb +4 -10
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/application.rb +39 -35
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/application/flash.rb +7 -7
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/application/rendering.rb +317 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/application/rendering/extensions/erubis.rb +15 -6
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/application/rendering/extensions/haml.rb +2 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/application/rendering/extensions/slim.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/application/routing.rb +406 -368
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/application/showexceptions.rb +21 -0
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/caller.rb +53 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/cli/adapter.rb +4 -4
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/cli/base.rb +40 -39
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/cli/console.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/cli/rake.rb +2 -2
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/cli/rake_tasks.rb +2 -4
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/command.rb +2 -2
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/images/404.png +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/images/500.png +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/loader.rb +14 -15
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/locale/cs.yml +0 -1
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/locale/da.yml +0 -1
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/locale/de.yml +0 -1
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/locale/en.yml +0 -1
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/locale/es.yml +1 -2
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/locale/fr.yml +2 -3
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/locale/hu.yml +1 -2
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/locale/it.yml +0 -1
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/locale/ja.yml +1 -2
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/locale/lv.yml +0 -1
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/locale/nl.yml +0 -1
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/locale/no.yml +0 -2
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/locale/pl.yml +0 -1
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/locale/pt_br.yml +0 -1
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/locale/ro.yml +0 -1
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/locale/ru.yml +0 -1
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/locale/sv.yml +0 -1
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/locale/tr.yml +0 -1
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/locale/uk.yml +0 -1
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/locale/zh_cn.yml +0 -1
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/locale/zh_tw.yml +0 -1
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/logger.rb +30 -36
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/module.rb +3 -3
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/mounter.rb +59 -59
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/reloader.rb +23 -23
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/router.rb +10 -13
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/server.rb +17 -19
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/support_lite.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/tasks.rb +3 -3
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/lib/padrino-core/version.rb +1 -1
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/padrino-core.gemspec +2 -2
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/fixtures/app_gem/Gemfile +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/fixtures/app_gem/app/app.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/fixtures/app_gem/app_gem.gemspec +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/fixtures/app_gem/lib/app_gem.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/fixtures/app_gem/lib/app_gem/version.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/fixtures/apps/.components +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/fixtures/apps/.gitignore +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/fixtures/apps/complex.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/fixtures/apps/simple.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/fixtures/dependencies/a.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/fixtures/dependencies/b.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/fixtures/dependencies/c.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/fixtures/dependencies/circular/e.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/fixtures/dependencies/circular/f.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/fixtures/dependencies/circular/g.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/fixtures/dependencies/d.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/helper.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/mini_shoulda.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/test_application.rb +7 -7
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/test_core.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/test_csrf_protection.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/test_dependencies.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/test_filters.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/test_flash.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/test_locale.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/test_logger.rb +29 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/test_mounter.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/test_reloader_complex.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/test_reloader_simple.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/test_rendering.rb +15 -2
- data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_rendering_extensions.rb +14 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/test_restful_routing.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/test_router.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/test_routing.rb +69 -11
- data/lib/vendored-middleman-deps/{padrino-core-0.11.2 → padrino-core-0.11.4}/test/test_support_lite.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/.document +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/.gitignore +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/.yardopts +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/LICENSE.txt +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/README.rdoc +1 -1
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/Rakefile +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers.rb +3 -6
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/asset_tag_helpers.rb +34 -42
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/breadcrumb_helpers.rb +183 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/form_builder/abstract_form_builder.rb +126 -118
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/form_builder/standard_form_builder.rb +6 -9
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/form_helpers.rb +252 -195
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/format_helpers.rb +29 -42
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/locale/cs.yml +14 -14
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/locale/da.yml +1 -1
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/locale/de.yml +1 -1
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/locale/en.yml +16 -16
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/locale/es.yml +16 -16
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/locale/fr.yml +1 -2
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/locale/hu.yml +16 -16
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/locale/it.yml +2 -2
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/locale/ja.yml +16 -16
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/locale/lv.yml +16 -16
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/locale/nl.yml +1 -1
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/locale/no.yml +1 -1
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/locale/pl.yml +7 -7
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/locale/pt_br.yml +16 -16
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/locale/ro.yml +16 -16
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/locale/ru.yml +16 -16
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/locale/sv.yml +16 -16
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/locale/tr.yml +16 -16
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/locale/uk.yml +16 -16
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/locale/zh_cn.yml +16 -16
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/locale/zh_tw.yml +16 -16
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/number_helpers.rb +10 -15
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/output_helpers.rb +50 -58
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/output_helpers/abstract_handler.rb +16 -18
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/output_helpers/erb_handler.rb +11 -12
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/output_helpers/haml_handler.rb +9 -9
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/output_helpers/slim_handler.rb +11 -13
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/render_helpers.rb +5 -6
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/tag_helpers.rb +26 -22
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/lib/padrino-helpers/translation_helpers.rb +4 -6
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/padrino-helpers.gemspec +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/app.rb +7 -3
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/button_to.erb +8 -0
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/button_to.haml +5 -0
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/button_to.slim +6 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/capture_concat.erb +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/capture_concat.haml +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/capture_concat.slim +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/content_for.erb +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/content_for.haml +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/content_for.slim +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/content_tag.erb +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/content_tag.haml +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/content_tag.slim +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/current_engine.erb +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/current_engine.haml +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/current_engine.slim +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/fields_for.erb +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/fields_for.haml +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/fields_for.slim +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/form_for.erb +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/form_for.haml +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/form_for.slim +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/form_tag.erb +9 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/form_tag.haml +8 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/form_tag.slim +9 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/link_to.erb +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/link_to.haml +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/link_to.slim +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/mail_to.erb +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/mail_to.haml +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/mail_to.slim +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/meta_tag.erb +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/meta_tag.haml +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/meta_tag.slim +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/partials/_erb.erb +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/partials/_haml.haml +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/partials/_slim.slim +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/simple_partial.erb +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/simple_partial.haml +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/markup_app/views/simple_partial.slim +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/render_app/app.rb +1 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/render_app/views/current_engine.haml +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/render_app/views/current_engines/_erb.erb +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/render_app/views/current_engines/_haml.haml +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/render_app/views/current_engines/_slim.slim +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/render_app/views/double_capture_erb.erb +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/render_app/views/double_capture_haml.haml +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/render_app/views/double_capture_slim.slim +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/render_app/views/erb/test.erb +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/render_app/views/explicit_engine.haml +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/render_app/views/haml/test.haml +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/render_app/views/template/_user.haml +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/render_app/views/template/haml_template.haml +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/fixtures/render_app/views/template/some_template.haml +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/helper.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/test_asset_tag_helpers.rb +9 -3
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/test_breadcrumb_helpers.rb +134 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/test_form_builder.rb +38 -6
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/test_form_helpers.rb +230 -12
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/test_format_helpers.rb +3 -3
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/test_locale.rb +0 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/test_number_helpers.rb +4 -0
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/test_output_helpers.rb +1 -1
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/test_render_helpers.rb +1 -1
- data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/test_tag_helpers.rb +3 -3
- data/middleman-core.gemspec +7 -8
- data/spec/spec_helper.rb +1 -1
- metadata +220 -215
- data/lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/rendering.rb +0 -320
- data/lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/showexceptions.rb +0 -20
- data/lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/caller.rb +0 -53
- data/lib/vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers/breadcrumb_helpers.rb +0 -171
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
= search_field_tag :search
|
|
19
19
|
= label_tag :color
|
|
20
20
|
= select_tag :color, :options => ['green', 'orange', 'purple']
|
|
21
|
+
= select_tag :type, :grouped_options => { 'foo' => ['foo', 'bar'], 'bar' => ['foo', 'bar'] }
|
|
22
|
+
= select_tag :character, :grouped_options => [['Friends',['Yoda',['Obiwan',1]]],['Enemies',['Palpatine',['Darth Vader',3]]]]
|
|
21
23
|
= label_tag :gender
|
|
22
24
|
= radio_button_tag :gender, :value => 'male'
|
|
23
25
|
= radio_button_tag :gender, :value => 'female'
|
|
@@ -64,7 +66,13 @@
|
|
|
64
66
|
= select_tag :fav_color, :options => [ ['green', '1'], ['orange', '2'], ['purple', '3'] ], :selected => '2'
|
|
65
67
|
%p
|
|
66
68
|
= check_box_tag :remember_me, :value => "1", :checked => true
|
|
69
|
+
%p
|
|
70
|
+
= range_field_tag('ranger_with_min_max', :min => 1, :max => 50)
|
|
71
|
+
= range_field_tag('ranger_with_range', :range => 1..5)
|
|
67
72
|
- field_set_tag(:class => 'buttons') do
|
|
68
73
|
= submit_tag "Login"
|
|
69
74
|
= button_tag "Cancel"
|
|
70
75
|
= image_submit_tag "buttons/submit.png"
|
|
76
|
+
|
|
77
|
+
- form_tag '/dontprotect', :class => 'no-protection', :protect_from_csrf => false do
|
|
78
|
+
= submit_tag "Login"
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
= search_field_tag :search
|
|
19
19
|
= label_tag :color
|
|
20
20
|
= select_tag :color, :options => ['green', 'orange', 'purple']
|
|
21
|
+
= select_tag :type, :grouped_options => { 'foo' => ['foo', 'bar'], 'bar' => ['foo', 'bar'] }
|
|
22
|
+
= select_tag :character, :grouped_options => [['Friends',['Yoda',['Obiwan',1]]],['Enemies',['Palpatine',['Darth Vader',3]]]]
|
|
21
23
|
= label_tag :gender
|
|
22
24
|
= radio_button_tag :gender, :value => 'male'
|
|
23
25
|
= radio_button_tag :gender, :value => 'female'
|
|
@@ -64,7 +66,14 @@
|
|
|
64
66
|
= select_tag :fav_color, :options => [ ['green', '1'], ['orange', '2'], ['purple', '3'] ], :selected => '2'
|
|
65
67
|
p
|
|
66
68
|
= check_box_tag :remember_me, :value => "1", :checked => true
|
|
69
|
+
p
|
|
70
|
+
= range_field_tag('ranger_with_min_max', :min => 1, :max => 50)
|
|
71
|
+
= range_field_tag('ranger_with_range', :range => 1..5)
|
|
72
|
+
|
|
67
73
|
= field_set_tag(:class => 'buttons') do
|
|
68
74
|
= submit_tag "Login"
|
|
69
75
|
= button_tag "Cancel"
|
|
70
76
|
= image_submit_tag "buttons/submit.png"
|
|
77
|
+
|
|
78
|
+
= form_tag '/dontprotect', :class => 'no-protection', :protect_from_csrf => false do
|
|
79
|
+
= submit_tag "Login"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -16,6 +16,7 @@ class RenderDemo < Padrino::Application
|
|
|
16
16
|
configure do
|
|
17
17
|
set :logging, false
|
|
18
18
|
set :padrino_logging, false
|
|
19
|
+
set :environment, :test
|
|
19
20
|
set :erb, :engine_class => Padrino::Erubis::SafeBufferTemplate
|
|
20
21
|
set :haml, :escape_html => true
|
|
21
22
|
set :slim, :generator => Temple::Generators::RailsOutputBuffer
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/vendored-middleman-deps/{padrino-helpers-0.11.2 → padrino-helpers-0.11.4}/test/helper.rb
RENAMED
|
File without changes
|
|
@@ -5,7 +5,7 @@ describe "AssetTagHelpers" do
|
|
|
5
5
|
include Padrino::Helpers::AssetTagHelpers
|
|
6
6
|
|
|
7
7
|
def app
|
|
8
|
-
MarkupDemo
|
|
8
|
+
MarkupDemo
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def flash
|
|
@@ -71,9 +71,9 @@ describe "AssetTagHelpers" do
|
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
should "escape the link text" do
|
|
74
|
-
actual_link = link_to('/register', :class => 'first', :id => 'binky') { "
|
|
74
|
+
actual_link = link_to('/register', :class => 'first', :id => 'binky') { "<&>" }
|
|
75
75
|
assert_has_tag('a#binky.first', :href => '/register') { actual_link }
|
|
76
|
-
assert_match "<>", actual_link
|
|
76
|
+
assert_match "<&>", actual_link
|
|
77
77
|
end
|
|
78
78
|
|
|
79
79
|
should "not escape image_tag" do
|
|
@@ -119,6 +119,12 @@ describe "AssetTagHelpers" do
|
|
|
119
119
|
assert_match %r{subject\=demo\%20test}, actual_html
|
|
120
120
|
end
|
|
121
121
|
|
|
122
|
+
should "escape & with encoded string and & in HTML" do
|
|
123
|
+
actual_html = mail_to('test@demo.com', "My&Email", :subject => "this&that")
|
|
124
|
+
assert_match 'this%26that', actual_html
|
|
125
|
+
assert_match 'My&Email', actual_html
|
|
126
|
+
end
|
|
127
|
+
|
|
122
128
|
should "display mail link element in haml" do
|
|
123
129
|
visit '/haml/mail_to'
|
|
124
130
|
assert_have_selector 'p.simple a', :href => 'mailto:test@demo.com', :content => 'test@demo.com'
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/helper')
|
|
2
|
+
|
|
3
|
+
describe "BreadcrumbHelpers" do
|
|
4
|
+
include Padrino::Helpers::Breadcrumbs
|
|
5
|
+
|
|
6
|
+
def breadcrumb
|
|
7
|
+
@breadcrumb ||= Padrino::Helpers::Breadcrumb.new
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
before(:each) { breadcrumb.reset! }
|
|
11
|
+
|
|
12
|
+
context "for Breadcrumbs#breadcrumbs method" do
|
|
13
|
+
should "support breadcrumbs which is Padrino::Helpers::Breadcrumbs instance." do
|
|
14
|
+
breadcrumb.add "foo", "/foo", "foo link"
|
|
15
|
+
assert_has_tag(:a, :content => "Foo link", :href => "/foo") { breadcrumbs(breadcrumb) }
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
should "support bootstrap" do
|
|
19
|
+
breadcrumb.add "foo", "/foo", "foo link"
|
|
20
|
+
assert_has_tag(:span, :content => "/", :class => "divider") { breadcrumbs(breadcrumb, true) }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
should "support active" do
|
|
24
|
+
breadcrumb.add "foo", "/foo", "foo link"
|
|
25
|
+
assert_has_tag(:li, :class => "custom-active") { breadcrumbs(breadcrumb, nil, "custom-active") }
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
should "support options" do
|
|
29
|
+
assert_has_tag(:ul, :class => "breadcrumbs-class breadcrumb", :id => "breadcrumbs-id") do
|
|
30
|
+
breadcrumbs(breadcrumb, nil, nil, :id => "breadcrumbs-id", :class => "breadcrumbs-class")
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
context "for #add method" do
|
|
36
|
+
should "support name of string and symbol type" do
|
|
37
|
+
breadcrumb.add "foo", "/foo", "Foo Link"
|
|
38
|
+
breadcrumb.add :bar, "/bar", "Bar Link"
|
|
39
|
+
|
|
40
|
+
actual_html = breadcrumbs(breadcrumb)
|
|
41
|
+
assert_has_tag(:a, :content => "Foo link", :href => "/foo") { actual_html }
|
|
42
|
+
assert_has_tag(:a, :content => "Bar link", :href => "/bar") { actual_html }
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
should "support url" do
|
|
46
|
+
breadcrumb.add :foo, "/foo", "Foo Link"
|
|
47
|
+
assert_has_tag(:a, :href => "/foo") { breadcrumbs(breadcrumb) }
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
should "support caption" do
|
|
51
|
+
breadcrumb.add :foo, "/foo", "Foo Link"
|
|
52
|
+
assert_has_tag(:a, :content => "Foo link") { breadcrumbs(breadcrumb) }
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
should "support options" do
|
|
56
|
+
breadcrumb.add :foo, "/foo", "Foo Link", :id => "foo-id", :class => "foo-class"
|
|
57
|
+
breadcrumb.add :bar, "/bar", "Bar Link", :id => "bar-id", :class => "bar-class"
|
|
58
|
+
|
|
59
|
+
actual_html = breadcrumbs(breadcrumb)
|
|
60
|
+
assert_has_tag(:li, :class => "foo-class", :id => "foo-id") { actual_html }
|
|
61
|
+
assert_has_tag(:li, :class => "bar-class active", :id => "bar-id") { actual_html }
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
context "for #del method" do
|
|
66
|
+
should "support name of string type" do
|
|
67
|
+
breadcrumb.add "foo", "/foo", "Foo Link"
|
|
68
|
+
breadcrumb.add :bar, "/bar", "Bar Link"
|
|
69
|
+
|
|
70
|
+
breadcrumb.del "foo"
|
|
71
|
+
breadcrumb.del "bar"
|
|
72
|
+
|
|
73
|
+
actual_html = breadcrumbs(breadcrumb)
|
|
74
|
+
assert_has_no_tag(:a, :content => "Foo link", :href => "/foo") { actual_html }
|
|
75
|
+
assert_has_no_tag(:a, :content => "Bar link", :href => "/bar") { actual_html }
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
should "support name of symbol type" do
|
|
79
|
+
breadcrumb.add "foo", "/foo", "Foo Link"
|
|
80
|
+
breadcrumb.add :bar, "/bar", "Bar Link"
|
|
81
|
+
|
|
82
|
+
breadcrumb.del :foo
|
|
83
|
+
breadcrumb.del :bar
|
|
84
|
+
|
|
85
|
+
actual_html = breadcrumbs(breadcrumb)
|
|
86
|
+
assert_has_no_tag(:a, :content => "Foo link", :href => "/foo") { actual_html }
|
|
87
|
+
assert_has_no_tag(:a, :content => "Bar link", :href => "/bar") { actual_html }
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
context "for #set_home method" do
|
|
92
|
+
should "modified home item elements." do
|
|
93
|
+
breadcrumb.set_home("/custom", "Custom Home Page")
|
|
94
|
+
assert_has_tag(:a, :content => "Custom home page", :href => "/custom") { breadcrumbs(breadcrumb) }
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
should "support options" do
|
|
98
|
+
breadcrumb.set_home("/custom", "Custom Home Page", :id => "home-id")
|
|
99
|
+
|
|
100
|
+
actual_html = breadcrumbs(breadcrumb)
|
|
101
|
+
assert_has_tag(:li, :id => "home-id") { actual_html }
|
|
102
|
+
assert_has_tag(:a, :content => "Custom home page", :href => "/custom") { actual_html }
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
context "for #reset method" do
|
|
107
|
+
should "be #items which contains only home item." do
|
|
108
|
+
breadcrumb.set_home("/custom", "Custom Home Page")
|
|
109
|
+
breadcrumb.add "foo", "/foo", "Foo Link"
|
|
110
|
+
breadcrumb.add :bar, "/bar", "Bar Link"
|
|
111
|
+
|
|
112
|
+
breadcrumb.reset
|
|
113
|
+
|
|
114
|
+
actual_html = breadcrumbs(breadcrumb)
|
|
115
|
+
assert_has_tag(:a, :content => "Custom home page", :href => "/custom") { actual_html }
|
|
116
|
+
assert_has_no_tag(:a, :content => "Foo link", :href => "/foo") { actual_html }
|
|
117
|
+
assert_has_no_tag(:a, :content => "Bar link", :href => "/bar") { actual_html }
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
context "for #reset! method" do
|
|
122
|
+
should "be #items which contains only default home item." do
|
|
123
|
+
breadcrumb.add "foo", "/foo", "foo link"
|
|
124
|
+
breadcrumb.add :bar, "/bar", "Bar Link"
|
|
125
|
+
|
|
126
|
+
breadcrumb.reset!
|
|
127
|
+
|
|
128
|
+
actual_html = breadcrumbs(breadcrumb)
|
|
129
|
+
assert_has_tag(:a, :content => "Home Page", :href => "/") { actual_html }
|
|
130
|
+
assert_has_no_tag(:a, :content => "Foo link", :href => "/foo") { actual_html }
|
|
131
|
+
assert_has_no_tag(:a, :content => "Bar link", :href => "/bar") { actual_html }
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
end
|
|
@@ -4,6 +4,10 @@ require File.expand_path(File.dirname(__FILE__) + '/fixtures/markup_app/app')
|
|
|
4
4
|
describe "FormBuilder" do
|
|
5
5
|
include Padrino::Helpers::FormHelpers
|
|
6
6
|
|
|
7
|
+
def app
|
|
8
|
+
MarkupDemo
|
|
9
|
+
end
|
|
10
|
+
|
|
7
11
|
# Dummy form builder for testing
|
|
8
12
|
module Padrino::Helpers::FormBuilder
|
|
9
13
|
class FakeFormBuilder < AbstractFormBuilder
|
|
@@ -11,10 +15,6 @@ describe "FormBuilder" do
|
|
|
11
15
|
end
|
|
12
16
|
end
|
|
13
17
|
|
|
14
|
-
def app
|
|
15
|
-
MarkupDemo.tap { |app| app.set :environment, :test }
|
|
16
|
-
end
|
|
17
|
-
|
|
18
18
|
def setup
|
|
19
19
|
role_types = [mock_model('Role', :name => "Admin", :id => 1),
|
|
20
20
|
mock_model('Role', :name => 'Moderate', :id => 2), mock_model('Role', :name => 'Limited', :id => 3)]
|
|
@@ -49,8 +49,7 @@ describe "FormBuilder" do
|
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
should "display form specifying default builder setting" do
|
|
52
|
-
self.expects(:settings).returns(stub(:default_builder => 'FakeFormBuilder')).
|
|
53
|
-
actual_html = ""
|
|
52
|
+
self.expects(:settings).returns(stub(:default_builder => 'FakeFormBuilder', :protect_from_csrf => false)).at_least_once
|
|
54
53
|
actual_html = form_for(@user, '/register', :id => 'register', :"accept-charset" => "UTF-8", :method => 'post') { |f| f.foo_field }
|
|
55
54
|
assert_has_tag('form', :"accept-charset" => "UTF-8", :action => '/register', :method => 'post') { actual_html }
|
|
56
55
|
assert_has_tag('span', :content => "bar") { actual_html }
|
|
@@ -61,6 +60,16 @@ describe "FormBuilder" do
|
|
|
61
60
|
assert_has_tag('form', :"accept-charset" => "UTF-8", :action => '/update', :method => 'post', "data-remote" => 'true') { actual_html }
|
|
62
61
|
end
|
|
63
62
|
|
|
63
|
+
should "display correct form html with namespace option" do
|
|
64
|
+
actual_html = form_for(@user, '/update', :namespace => 'foo') do |f|
|
|
65
|
+
f.text_field(:first_name) << f.fields_for(:role_types) { |role| role.text_field(:name) }
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
assert_has_no_tag(:form, :namespace => 'foo') { actual_html }
|
|
69
|
+
assert_has_tag(:input, :type => 'text', :name => 'user[first_name]', :id => 'foo_user_first_name') { actual_html }
|
|
70
|
+
assert_has_tag(:input, :type => 'text', :name => 'user[role_types_attributes][0][name]', :id => 'foo_user_role_types_attributes_0_name') { actual_html }
|
|
71
|
+
end
|
|
72
|
+
|
|
64
73
|
should "display correct form html with remote option and method put" do
|
|
65
74
|
actual_html = form_for(@user, '/update', :"accept-charset" => "UTF-8", :remote => true, :method => 'put') { "Demo" }
|
|
66
75
|
assert_has_tag('form', :"accept-charset" => "UTF-8", :method => 'post', "data-remote" => 'true') { actual_html }
|
|
@@ -655,6 +664,17 @@ describe "FormBuilder" do
|
|
|
655
664
|
assert_have_selector '#demo input.user-photo', :type => 'file', :name => 'markup_user[photo]', :id => 'markup_user_photo'
|
|
656
665
|
assert_have_selector '#demo2 input.upload', :type => 'file', :name => 'markup_user[photo]', :id => 'markup_user_photo'
|
|
657
666
|
end
|
|
667
|
+
|
|
668
|
+
should "display correct form html with multipart, even if no 'multipart' option is specified" do
|
|
669
|
+
actual_html = form_for(@user, '/register', :"accept-charset" => "UTF-8") { |f| f.file_field :photo }
|
|
670
|
+
assert_has_tag('form', :"accept-charset" => "UTF-8", :action => '/register', :enctype => "multipart/form-data") { actual_html }
|
|
671
|
+
end
|
|
672
|
+
|
|
673
|
+
should "display correct form html without multipart, if 'multipart' option is specified 'false'" do
|
|
674
|
+
actual_html = form_for(@user, '/register', :"accept-charset" => "UTF-8", :multipart => false) { |f| f.file_field :photo }
|
|
675
|
+
assert_has_no_tag('form', :"accept-charset" => "UTF-8", :action => '/register', :enctype => "multipart/form-data") { actual_html }
|
|
676
|
+
end
|
|
677
|
+
|
|
658
678
|
end
|
|
659
679
|
|
|
660
680
|
context 'for #select method' do
|
|
@@ -742,6 +762,18 @@ describe "FormBuilder" do
|
|
|
742
762
|
assert_has_tag('input[type=submit]', :value => "Submit") { actual_html }
|
|
743
763
|
end
|
|
744
764
|
|
|
765
|
+
|
|
766
|
+
should "display correct submit button html with no caption" do
|
|
767
|
+
actual_html = standard_builder.submit(:class => 'btn')
|
|
768
|
+
assert_has_tag('input.btn[type=submit]', :value => "Submit") { actual_html }
|
|
769
|
+
end
|
|
770
|
+
|
|
771
|
+
should "display correct submit button html with nil caption" do
|
|
772
|
+
actual_html = standard_builder.submit(nil, :class => 'btn')
|
|
773
|
+
assert_has_tag('input.btn[type=submit]') { actual_html }
|
|
774
|
+
assert actual_html !~ %r{ value \* = }x
|
|
775
|
+
end
|
|
776
|
+
|
|
745
777
|
should "display correct submit button html" do
|
|
746
778
|
actual_html = standard_builder.submit("Commit", :class => 'large')
|
|
747
779
|
assert_has_tag('input.large[type=submit]', :value => "Commit") { actual_html }
|
|
@@ -5,7 +5,11 @@ describe "FormHelpers" do
|
|
|
5
5
|
include Padrino::Helpers::FormHelpers
|
|
6
6
|
|
|
7
7
|
def app
|
|
8
|
-
MarkupDemo
|
|
8
|
+
MarkupDemo
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
class UnprotectedApp
|
|
12
|
+
def protect_from_csrf; false; end
|
|
9
13
|
end
|
|
10
14
|
|
|
11
15
|
context 'for #form_tag method' do
|
|
@@ -54,25 +58,67 @@ describe "FormHelpers" do
|
|
|
54
58
|
assert_has_tag(:form, :enctype => "multipart/form-data") { actual_html }
|
|
55
59
|
end
|
|
56
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
|
+
|
|
57
100
|
should "display correct forms in erb" do
|
|
58
101
|
visit '/erb/form_tag'
|
|
59
102
|
assert_have_selector 'form.simple-form', :action => '/simple'
|
|
60
103
|
assert_have_selector 'form.advanced-form', :action => '/advanced', :id => 'advanced', :method => 'get'
|
|
61
|
-
assert_have_selector
|
|
104
|
+
assert_have_selector 'form.simple-form input', :name => 'authenticity_token'
|
|
105
|
+
assert_have_no_selector 'form.no-protection input', :name => 'authenticity_token'
|
|
62
106
|
end
|
|
63
107
|
|
|
64
108
|
should "display correct forms in haml" do
|
|
65
109
|
visit '/haml/form_tag'
|
|
66
110
|
assert_have_selector 'form.simple-form', :action => '/simple'
|
|
67
111
|
assert_have_selector 'form.advanced-form', :action => '/advanced', :id => 'advanced', :method => 'get'
|
|
68
|
-
assert_have_selector
|
|
112
|
+
assert_have_selector 'form.simple-form input', :name => 'authenticity_token'
|
|
113
|
+
assert_have_no_selector 'form.no-protection input', :name => 'authenticity_token'
|
|
69
114
|
end
|
|
70
115
|
|
|
71
116
|
should "display correct forms in slim" do
|
|
72
117
|
visit '/slim/form_tag'
|
|
73
118
|
assert_have_selector 'form.simple-form', :action => '/simple'
|
|
74
119
|
assert_have_selector 'form.advanced-form', :action => '/advanced', :id => 'advanced', :method => 'get'
|
|
75
|
-
assert_have_selector
|
|
120
|
+
assert_have_selector 'form.simple-form input', :name => 'authenticity_token'
|
|
121
|
+
assert_have_no_selector 'form.no-protection input', :name => 'authenticity_token'
|
|
76
122
|
end
|
|
77
123
|
end
|
|
78
124
|
|
|
@@ -127,7 +173,7 @@ describe "FormHelpers" do
|
|
|
127
173
|
assert_have_selector 'form.advanced-form .field-errors p', :content => "There were problems with the following fields:"
|
|
128
174
|
assert_have_selector 'form.advanced-form .field-errors ul'
|
|
129
175
|
assert_have_selector 'form.advanced-form .field-errors ul li', :count => 4
|
|
130
|
-
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Email must be
|
|
176
|
+
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Email must be an email"
|
|
131
177
|
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Fake must be valid"
|
|
132
178
|
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Second must be present"
|
|
133
179
|
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Third must be a number"
|
|
@@ -141,7 +187,7 @@ describe "FormHelpers" do
|
|
|
141
187
|
assert_have_selector 'form.advanced-form .field-errors p', :content => "There were problems with the following fields:"
|
|
142
188
|
assert_have_selector 'form.advanced-form .field-errors ul'
|
|
143
189
|
assert_have_selector 'form.advanced-form .field-errors ul li', :count => 4
|
|
144
|
-
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Email must be
|
|
190
|
+
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Email must be an email"
|
|
145
191
|
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Fake must be valid"
|
|
146
192
|
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Second must be present"
|
|
147
193
|
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Third must be a number"
|
|
@@ -155,7 +201,7 @@ describe "FormHelpers" do
|
|
|
155
201
|
assert_have_selector 'form.advanced-form .field-errors p', :content => "There were problems with the following fields:"
|
|
156
202
|
assert_have_selector 'form.advanced-form .field-errors ul'
|
|
157
203
|
assert_have_selector 'form.advanced-form .field-errors ul li', :count => 4
|
|
158
|
-
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Email must be
|
|
204
|
+
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Email must be an email"
|
|
159
205
|
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Fake must be valid"
|
|
160
206
|
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Second must be present"
|
|
161
207
|
assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Third must be a number"
|
|
@@ -611,7 +657,7 @@ describe "FormHelpers" do
|
|
|
611
657
|
assert_has_tag('select option:first-child', :value => "", :content => "") { actual_html }
|
|
612
658
|
end
|
|
613
659
|
|
|
614
|
-
should "
|
|
660
|
+
should "display select tag with grouped options for a nested array" do
|
|
615
661
|
opts = [
|
|
616
662
|
["Friends",["Yoda",["Obiwan",2]]],
|
|
617
663
|
["Enemies", ["Palpatine",['Darth Vader',3]]]
|
|
@@ -626,7 +672,33 @@ describe "FormHelpers" do
|
|
|
626
672
|
assert_has_tag(:option, :value => "3", :content => "Darth Vader") { actual_html }
|
|
627
673
|
end
|
|
628
674
|
|
|
629
|
-
should "
|
|
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
|
|
630
702
|
opts = {
|
|
631
703
|
"Friends" => ["Yoda",["Obiwan",2]],
|
|
632
704
|
"Enemies" => ["Palpatine",['Darth Vader',3]]
|
|
@@ -641,6 +713,33 @@ describe "FormHelpers" do
|
|
|
641
713
|
assert_has_tag(:option, :value => "3", :content => "Darth Vader") { actual_html }
|
|
642
714
|
end
|
|
643
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
|
+
|
|
644
743
|
should "display select tag in ruby with multiple attribute" do
|
|
645
744
|
actual_html = select_tag(:favorite_color, :multiple => true, :options => ['only', 'option'])
|
|
646
745
|
assert_has_tag(:select, :multiple => 'multiple', :name => 'favorite_color[]') { actual_html }
|
|
@@ -656,6 +755,16 @@ describe "FormHelpers" do
|
|
|
656
755
|
assert_has_tag('select option', :content => 'Black', :value => 'black1') { actual_html }
|
|
657
756
|
end
|
|
658
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
|
+
|
|
659
768
|
should "display option with values and multiple selected" do
|
|
660
769
|
options = [['Green', 'green1'], ['Blue', 'blue1'], ['Black', "black1"]]
|
|
661
770
|
actual_html = select_tag(:favorite_color, :options => options, :selected => ['green1', 'Black'])
|
|
@@ -680,10 +789,20 @@ describe "FormHelpers" do
|
|
|
680
789
|
assert_have_selector('select option', :content => 'green', :value => 'green')
|
|
681
790
|
assert_have_selector('select option', :content => 'orange', :value => 'orange')
|
|
682
791
|
assert_have_selector('select option', :content => 'purple', :value => 'purple')
|
|
683
|
-
assert_have_selector
|
|
792
|
+
assert_have_selector('form.advanced-form select', :name => 'fav_color')
|
|
684
793
|
assert_have_selector('select option', :content => 'green', :value => '1')
|
|
685
794
|
assert_have_selector('select option', :content => 'orange', :value => '2', :selected => 'selected')
|
|
686
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')
|
|
687
806
|
end
|
|
688
807
|
|
|
689
808
|
should "display select tag in haml" do
|
|
@@ -692,10 +811,20 @@ describe "FormHelpers" do
|
|
|
692
811
|
assert_have_selector('select option', :content => 'green', :value => 'green')
|
|
693
812
|
assert_have_selector('select option', :content => 'orange', :value => 'orange')
|
|
694
813
|
assert_have_selector('select option', :content => 'purple', :value => 'purple')
|
|
695
|
-
assert_have_selector
|
|
814
|
+
assert_have_selector('form.advanced-form select', :name => 'fav_color')
|
|
696
815
|
assert_have_selector('select option', :content => 'green', :value => '1')
|
|
697
816
|
assert_have_selector('select option', :content => 'orange', :value => '2', :selected => 'selected')
|
|
698
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')
|
|
699
828
|
end
|
|
700
829
|
|
|
701
830
|
should "display select tag in slim" do
|
|
@@ -704,10 +833,20 @@ describe "FormHelpers" do
|
|
|
704
833
|
assert_have_selector('select option', :content => 'green', :value => 'green')
|
|
705
834
|
assert_have_selector('select option', :content => 'orange', :value => 'orange')
|
|
706
835
|
assert_have_selector('select option', :content => 'purple', :value => 'purple')
|
|
707
|
-
assert_have_selector
|
|
836
|
+
assert_have_selector('form.advanced-form select', :name => 'fav_color')
|
|
708
837
|
assert_have_selector('select option', :content => 'green', :value => '1')
|
|
709
838
|
assert_have_selector('select option', :content => 'orange', :value => '2', :selected => 'selected')
|
|
710
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')
|
|
711
850
|
end
|
|
712
851
|
end
|
|
713
852
|
|
|
@@ -734,6 +873,26 @@ describe "FormHelpers" do
|
|
|
734
873
|
assert_have_selector 'form.simple-form input[type=submit]', :count => 1, :value => "Submit"
|
|
735
874
|
assert_have_selector 'form.advanced-form input[type=submit]', :count => 1, :value => "Login"
|
|
736
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
|
|
737
896
|
end
|
|
738
897
|
|
|
739
898
|
context 'for #button_tag method' do
|
|
@@ -808,5 +967,64 @@ describe "FormHelpers" do
|
|
|
808
967
|
end
|
|
809
968
|
assert_has_tag('form button', :type => 'submit', :content => "My button's content", :title => "My button") { actual_html }
|
|
810
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
|
|
811
1029
|
end
|
|
812
1030
|
end
|