comfortable_mexican_sofa 2.0.9 → 2.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/comfy/vendor/bootstrap.min.js +3 -3
- data/app/assets/stylesheets/comfy/admin/cms/application.sass +1 -2
- data/app/assets/stylesheets/comfy/admin/cms/base.sass +12 -13
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_alert.scss +3 -1
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_button-group.scss +31 -72
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_buttons.scss +26 -19
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_card.scss +23 -12
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_carousel.scss +2 -2
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_close.scss +6 -1
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_code.scss +4 -12
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_custom-forms.scss +124 -84
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_dropdown.scss +30 -2
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_forms.scss +46 -71
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_functions.scss +4 -4
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_images.scss +0 -1
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_input-group.scss +99 -126
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_list-group.scss +2 -1
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_modal.scss +24 -9
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_nav.scss +2 -2
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_navbar.scss +8 -3
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_pagination.scss +32 -19
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_popover.scss +106 -117
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_print.scss +17 -3
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_progress.scss +4 -1
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_reboot.scss +3 -25
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_tables.scss +1 -1
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_tooltip.scss +65 -57
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_type.scss +2 -2
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_variables.scss +174 -108
- data/app/assets/stylesheets/comfy/vendor/bootstrap/bootstrap-grid.scss +32 -0
- data/app/assets/stylesheets/comfy/vendor/bootstrap/bootstrap-reboot.scss +12 -0
- data/app/assets/stylesheets/comfy/vendor/bootstrap/bootstrap.scss +42 -0
- data/app/assets/stylesheets/comfy/vendor/bootstrap/mixins/_background-variant.scss +2 -1
- data/app/assets/stylesheets/comfy/vendor/bootstrap/mixins/_breakpoints.scss +11 -7
- data/app/assets/stylesheets/comfy/vendor/bootstrap/mixins/_buttons.scss +37 -22
- data/app/assets/stylesheets/comfy/vendor/bootstrap/mixins/_caret.scss +30 -0
- data/app/assets/stylesheets/comfy/vendor/bootstrap/mixins/_forms.scss +48 -19
- data/app/assets/stylesheets/comfy/vendor/bootstrap/mixins/_grid-framework.scss +5 -7
- data/app/assets/stylesheets/comfy/vendor/bootstrap/mixins/_hover.scss +24 -46
- data/app/assets/stylesheets/comfy/vendor/bootstrap/mixins/_list-group.scss +10 -13
- data/app/assets/stylesheets/comfy/vendor/bootstrap/mixins/_screen-reader.scss +1 -1
- data/app/assets/stylesheets/comfy/vendor/bootstrap/mixins/_text-hide.scss +1 -0
- data/app/assets/stylesheets/comfy/vendor/bootstrap/utilities/_borders.scss +6 -1
- data/app/assets/stylesheets/comfy/vendor/bootstrap/utilities/_display.scss +10 -28
- data/app/controllers/comfy/admin/cms/files_controller.rb +6 -7
- data/app/helpers/comfy/admin/cms_helper.rb +5 -4
- data/app/models/concerns/comfy/cms/with_categories.rb +20 -9
- data/app/views/comfy/admin/cms/categories/_edit.html.haml +3 -3
- data/app/views/comfy/admin/cms/categories/_form.html.haml +3 -9
- data/app/views/comfy/admin/cms/categories/_index.html.haml +2 -2
- data/app/views/comfy/admin/cms/categories/_show.html.haml +4 -3
- data/app/views/comfy/admin/cms/categories/create.js.erb +1 -1
- data/app/views/comfy/admin/cms/files/_form.html.haml +11 -12
- data/app/views/comfy/admin/cms/files/edit.html.haml +2 -2
- data/app/views/comfy/admin/cms/files/new.html.haml +2 -2
- data/app/views/comfy/admin/cms/fragments/_form_fragment_attachments.html.haml +7 -5
- data/app/views/comfy/admin/cms/fragments/_form_fragments.html.haml +1 -1
- data/app/views/comfy/admin/cms/layouts/_form.html.haml +3 -2
- data/app/views/comfy/admin/cms/layouts/edit.html.haml +1 -1
- data/app/views/comfy/admin/cms/layouts/new.html.haml +2 -2
- data/app/views/comfy/admin/cms/pages/_form.html.haml +3 -5
- data/app/views/comfy/admin/cms/pages/edit.html.haml +1 -1
- data/app/views/comfy/admin/cms/pages/new.html.haml +1 -1
- data/app/views/comfy/admin/cms/revisions/show.html.haml +2 -2
- data/app/views/comfy/admin/cms/sites/_form.html.haml +4 -4
- data/app/views/comfy/admin/cms/sites/edit.html.haml +1 -1
- data/app/views/comfy/admin/cms/sites/new.html.haml +2 -2
- data/app/views/comfy/admin/cms/snippets/_form.html.haml +2 -2
- data/app/views/comfy/admin/cms/snippets/edit.html.haml +1 -1
- data/app/views/comfy/admin/cms/snippets/new.html.haml +2 -2
- data/app/views/comfy/admin/cms/translations/_form.html.haml +5 -7
- data/app/views/comfy/admin/cms/translations/edit.html.haml +1 -1
- data/app/views/comfy/admin/cms/translations/new.html.haml +2 -2
- data/comfortable_mexican_sofa.gemspec +6 -3
- data/config/locales/fr.yml +33 -33
- data/lib/comfortable_mexican_sofa/content/tags/file.rb +1 -1
- data/lib/comfortable_mexican_sofa/content/tags/files.rb +1 -1
- data/lib/comfortable_mexican_sofa/form_builder.rb +10 -15
- data/lib/comfortable_mexican_sofa/seeds.rb +2 -5
- data/lib/comfortable_mexican_sofa/version.rb +1 -1
- metadata +9 -116
- data/app/assets/stylesheets/comfy/vendor/_bootstrap.scss +0 -42
- data/doc/preview.jpg +0 -0
- data/test/controllers/comfy/admin/cms/base_controller_test.rb +0 -18
- data/test/controllers/comfy/admin/cms/categories_controller_test.rb +0 -74
- data/test/controllers/comfy/admin/cms/files_controller_test.rb +0 -242
- data/test/controllers/comfy/admin/cms/layouts_controller_test.rb +0 -137
- data/test/controllers/comfy/admin/cms/pages_controller_test.rb +0 -580
- data/test/controllers/comfy/admin/cms/revisions/layout_controller_test.rb +0 -62
- data/test/controllers/comfy/admin/cms/revisions/page_controller_test.rb +0 -87
- data/test/controllers/comfy/admin/cms/revisions/snippet_controller_test.rb +0 -60
- data/test/controllers/comfy/admin/cms/revisions/translation_controller_test.rb +0 -68
- data/test/controllers/comfy/admin/cms/sites_controller_test.rb +0 -106
- data/test/controllers/comfy/admin/cms/snippets_controller_test.rb +0 -156
- data/test/controllers/comfy/admin/cms/translations_controller_test.rb +0 -182
- data/test/controllers/comfy/cms/assets_controller_test.rb +0 -61
- data/test/controllers/comfy/cms/content_controller_test.rb +0 -249
- data/test/fixtures/active_storage/attachments.yml +0 -9
- data/test/fixtures/active_storage/blobs.yml +0 -13
- data/test/fixtures/comfy/cms/categories.yml +0 -4
- data/test/fixtures/comfy/cms/categorizations.yml +0 -3
- data/test/fixtures/comfy/cms/files.yml +0 -5
- data/test/fixtures/comfy/cms/fragments.yml +0 -25
- data/test/fixtures/comfy/cms/layouts.yml +0 -34
- data/test/fixtures/comfy/cms/pages.yml +0 -24
- data/test/fixtures/comfy/cms/revisions.yml +0 -29
- data/test/fixtures/comfy/cms/sites.yml +0 -5
- data/test/fixtures/comfy/cms/snippets.yml +0 -6
- data/test/fixtures/comfy/cms/translations.yml +0 -7
- data/test/fixtures/files/data.zip +0 -0
- data/test/fixtures/files/document.pdf +0 -0
- data/test/fixtures/files/image.gif +0 -0
- data/test/fixtures/files/image.jpg +0 -0
- data/test/fixtures/generators/cms/application.rb +0 -7
- data/test/fixtures/generators/cms/routes.rb +0 -5
- data/test/fixtures/generators/scaffold/controller.rb +0 -62
- data/test/fixtures/generators/scaffold/migration.rb +0 -9
- data/test/fixtures/generators/scaffold/model.rb +0 -21
- data/test/fixtures/generators/scaffold/routes.rb +0 -6
- data/test/fixtures/generators/scaffold/tests/controller.rb +0 -111
- data/test/fixtures/generators/scaffold/tests/fixture +0 -2
- data/test/fixtures/generators/scaffold/tests/model.rb +0 -24
- data/test/fixtures/generators/scaffold/views/_form.haml +0 -5
- data/test/fixtures/generators/scaffold/views/edit.haml +0 -5
- data/test/fixtures/generators/scaffold/views/index.haml +0 -21
- data/test/fixtures/generators/scaffold/views/new.haml +0 -5
- data/test/fixtures/generators/scaffold/views/show.haml +0 -4
- data/test/fixtures/views/_nav_hook.html.erb +0 -1
- data/test/fixtures/views/_nav_hook_2.html.erb +0 -1
- data/test/fixtures/views/render_test/_test.html.erb +0 -1
- data/test/fixtures/views/render_test/new.html.erb +0 -1
- data/test/fixtures/views/render_test/render_layout.html.erb +0 -1
- data/test/gemfiles/5.2.gemfile +0 -19
- data/test/generators/cms_assets_generator_test.rb +0 -14
- data/test/generators/cms_controllers_generator_test.rb +0 -14
- data/test/generators/cms_generator_test.rb +0 -26
- data/test/generators/cms_models_generator_test.rb +0 -14
- data/test/generators/cms_views_generator_test.rb +0 -14
- data/test/generators/scaffold_generator_test.rb +0 -32
- data/test/helpers/cms_helper_test.rb +0 -106
- data/test/integration/access_control_test.rb +0 -179
- data/test/integration/i18n_test.rb +0 -38
- data/test/integration/meta_variables_test.rb +0 -27
- data/test/integration/render_cms_test.rb +0 -255
- data/test/integration/routing_test.rb +0 -19
- data/test/integration/seeds_test.rb +0 -75
- data/test/integration/sites_test.rb +0 -107
- data/test/integration/view_hooks_test.rb +0 -47
- data/test/lib/configuration_test.rb +0 -38
- data/test/lib/content/block_test.rb +0 -26
- data/test/lib/content/params_parser_test.rb +0 -126
- data/test/lib/content/renderer_test.rb +0 -276
- data/test/lib/content/tag_test.rb +0 -58
- data/test/lib/content/tags/asset_test.rb +0 -104
- data/test/lib/content/tags/checkbox_test.rb +0 -21
- data/test/lib/content/tags/date_test.rb +0 -21
- data/test/lib/content/tags/datetime_test.rb +0 -21
- data/test/lib/content/tags/file_link_test.rb +0 -91
- data/test/lib/content/tags/file_test.rb +0 -69
- data/test/lib/content/tags/files_test.rb +0 -52
- data/test/lib/content/tags/fragment_test.rb +0 -68
- data/test/lib/content/tags/helper_test.rb +0 -62
- data/test/lib/content/tags/markdown_test.rb +0 -37
- data/test/lib/content/tags/number_test.rb +0 -14
- data/test/lib/content/tags/partial_test.rb +0 -65
- data/test/lib/content/tags/snippet_test.rb +0 -37
- data/test/lib/content/tags/template_test.rb +0 -51
- data/test/lib/content/tags/text_test.rb +0 -14
- data/test/lib/content/tags/textarea_test.rb +0 -14
- data/test/lib/content/tags/wysiwyg_test.rb +0 -14
- data/test/lib/revisions_test.rb +0 -222
- data/test/lib/seeds/files_test.rb +0 -97
- data/test/lib/seeds/layouts_test.rb +0 -156
- data/test/lib/seeds/pages_test.rb +0 -230
- data/test/lib/seeds/snippets_test.rb +0 -99
- data/test/lib/seeds_test.rb +0 -51
- data/test/models/categorization_test.rb +0 -76
- data/test/models/category_test.rb +0 -39
- data/test/models/file_test.rb +0 -43
- data/test/models/fragment_test.rb +0 -132
- data/test/models/layout_test.rb +0 -194
- data/test/models/page_test.rb +0 -575
- data/test/models/site_test.rb +0 -190
- data/test/models/snippet_test.rb +0 -56
- data/test/models/translation_test.rb +0 -67
- data/test/system/layouts_frontend_test.rb +0 -15
- data/test/system/pages_frontend_test.rb +0 -15
- data/test/system/sites_frontend_test.rb +0 -11
- data/test/system/snippets_frontend_test.rb +0 -15
- data/test/tasks/cms_seeds_test.rb +0 -34
- data/test/test_helper.rb +0 -201
@@ -1,62 +0,0 @@
|
|
1
|
-
require_relative "../../../test_helper"
|
2
|
-
|
3
|
-
class ContentTagsHelperTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def test_init
|
6
|
-
tag = ComfortableMexicanSofa::Content::Tag::Helper.new(context: @page, params: ["helper_method"])
|
7
|
-
assert_equal "helper_method", tag.method_name
|
8
|
-
assert_equal [], tag.params
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_init_with_params
|
12
|
-
tag = ComfortableMexicanSofa::Content::Tag::Helper.new(
|
13
|
-
context: @page,
|
14
|
-
params: ["helper_method", "param", { "key" => "val" }]
|
15
|
-
)
|
16
|
-
assert_equal "helper_method", tag.method_name
|
17
|
-
assert_equal ["param", { "key" => "val" }], tag.params
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_init_without_method_name
|
21
|
-
message = "Missing method name for helper tag"
|
22
|
-
assert_exception_raised ComfortableMexicanSofa::Content::Tag::Error, message do
|
23
|
-
ComfortableMexicanSofa::Content::Tag::Helper.new(context: @page)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_content
|
28
|
-
tag = ComfortableMexicanSofa::Content::Tag::Helper.new(
|
29
|
-
context: @page,
|
30
|
-
params: ["method_name", "param", { "key" => "val" }]
|
31
|
-
)
|
32
|
-
assert_equal "<%= method_name(\"param\",{\"key\"=>\"val\"}) %>", tag.content
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_render
|
36
|
-
tag = ComfortableMexicanSofa::Content::Tag::Helper.new(
|
37
|
-
context: @page,
|
38
|
-
params: ["method_name", "param", { "key" => "val" }]
|
39
|
-
)
|
40
|
-
assert_equal "<%= method_name(\"param\",{\"key\"=>\"val\"}) %>", tag.render
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_render_with_whitelist
|
44
|
-
ComfortableMexicanSofa.config.allowed_helpers = %i[tester eval]
|
45
|
-
tag = ComfortableMexicanSofa::Content::Tag::Helper.new(context: @page, params: ["tester"])
|
46
|
-
assert_equal "<%= tester() %>", tag.render
|
47
|
-
|
48
|
-
tag = ComfortableMexicanSofa::Content::Tag::Helper.new(context: @page, params: ["eval"])
|
49
|
-
assert_equal "<%= eval() %>", tag.render
|
50
|
-
|
51
|
-
tag = ComfortableMexicanSofa::Content::Tag::Helper.new(context: @page, params: ["not_whitelisted"])
|
52
|
-
assert_nil tag.render
|
53
|
-
end
|
54
|
-
|
55
|
-
def test_render_with_blacklist
|
56
|
-
ComfortableMexicanSofa::Content::Tag::Helper::BLACKLIST.each do |method|
|
57
|
-
tag = ComfortableMexicanSofa::Content::Tag::Helper.new(context: @page, params: [method])
|
58
|
-
assert_nil tag.render
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
require_relative "../../../test_helper"
|
2
|
-
|
3
|
-
class ContentTagsMarkdownTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
setup do
|
6
|
-
@page = comfy_cms_pages(:default)
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_init
|
10
|
-
tag = ComfortableMexicanSofa::Content::Tag::Markdown.new(context: @page, params: ["test"])
|
11
|
-
assert_equal "test", tag.identifier
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_content
|
15
|
-
frag = comfy_cms_fragments(:default)
|
16
|
-
tag = ComfortableMexicanSofa::Content::Tag::Markdown.new(context: @page, params: [frag.identifier])
|
17
|
-
assert_equal frag, tag.fragment
|
18
|
-
assert_equal frag.content, tag.content
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_render
|
22
|
-
frag = comfy_cms_fragments(:default)
|
23
|
-
frag.update_column(:content, "**test**")
|
24
|
-
tag = ComfortableMexicanSofa::Content::Tag::Markdown.new(context: @page, params: [frag.identifier])
|
25
|
-
assert_equal "<p><strong>test</strong></p>\n", tag.render
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_render_unrenderable
|
29
|
-
frag = comfy_cms_fragments(:default)
|
30
|
-
tag = ComfortableMexicanSofa::Content::Tag::Markdown.new(
|
31
|
-
context: @page,
|
32
|
-
params: [frag.identifier, { "render" => "false" }]
|
33
|
-
)
|
34
|
-
assert_equal "", tag.render
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require_relative "../../../test_helper"
|
2
|
-
|
3
|
-
class ContentTagsNumberTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
setup do
|
6
|
-
@page = comfy_cms_pages(:default)
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_init
|
10
|
-
tag = ComfortableMexicanSofa::Content::Tag::Number.new(context: @page, params: ["test"])
|
11
|
-
assert_equal "test", tag.identifier
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
require_relative "../../../test_helper"
|
2
|
-
|
3
|
-
class ContentTagsPartialTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def test_init
|
6
|
-
tag = ComfortableMexicanSofa::Content::Tag::Partial.new(
|
7
|
-
context: @page,
|
8
|
-
params: ["path/to/partial"]
|
9
|
-
)
|
10
|
-
assert_equal "path/to/partial", tag.path
|
11
|
-
assert_equal ({}), tag.locals
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_init_with_locals
|
15
|
-
tag = ComfortableMexicanSofa::Content::Tag::Partial.new(
|
16
|
-
context: @page,
|
17
|
-
params: ["path/to/partial", { "key" => "val" }]
|
18
|
-
)
|
19
|
-
assert_equal "path/to/partial", tag.path
|
20
|
-
assert_equal ({ "key" => "val" }), tag.locals
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_init_without_path
|
24
|
-
message = "Missing path for partial tag"
|
25
|
-
assert_exception_raised ComfortableMexicanSofa::Content::Tag::Error, message do
|
26
|
-
ComfortableMexicanSofa::Content::Tag::Partial.new(
|
27
|
-
context: @page,
|
28
|
-
params: [{ "key" => "val" }]
|
29
|
-
)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_content
|
34
|
-
tag = ComfortableMexicanSofa::Content::Tag::Partial.new(
|
35
|
-
context: @page,
|
36
|
-
params: ["path/to/partial", { "key" => "val" }]
|
37
|
-
)
|
38
|
-
assert_equal "<%= render partial: \"path/to/partial\", locals: {\"key\"=>\"val\"} %>", tag.content
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_render
|
42
|
-
tag = ComfortableMexicanSofa::Content::Tag::Partial.new(
|
43
|
-
context: @page,
|
44
|
-
params: ["path/to/partial", { "key" => "val" }]
|
45
|
-
)
|
46
|
-
assert_equal "<%= render partial: \"path/to/partial\", locals: {\"key\"=>\"val\"} %>", tag.render
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_render_with_whitelist
|
50
|
-
ComfortableMexicanSofa.config.allowed_partials = ["safe/path"]
|
51
|
-
|
52
|
-
tag = ComfortableMexicanSofa::Content::Tag::Partial.new(
|
53
|
-
context: @page,
|
54
|
-
params: ["path/to/partial"]
|
55
|
-
)
|
56
|
-
assert_equal "", tag.render
|
57
|
-
|
58
|
-
tag = ComfortableMexicanSofa::Content::Tag::Partial.new(
|
59
|
-
context: @page,
|
60
|
-
params: ["safe/path"]
|
61
|
-
)
|
62
|
-
assert_equal "<%= render partial: \"safe/path\", locals: {} %>", tag.render
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
require_relative "../../../test_helper"
|
2
|
-
|
3
|
-
class ContentTagsSnippetTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
setup do
|
6
|
-
@page = comfy_cms_pages(:default)
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_init
|
10
|
-
tag = ComfortableMexicanSofa::Content::Tag::Snippet.new(context: @page, params: ["default"])
|
11
|
-
assert_equal "default", tag.identifier
|
12
|
-
assert_equal comfy_cms_snippets(:default), tag.snippet
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_init_without_identifier
|
16
|
-
message = "Missing identifier for snippet tag"
|
17
|
-
assert_exception_raised ComfortableMexicanSofa::Content::Tag::Error, message do
|
18
|
-
ComfortableMexicanSofa::Content::Tag::Snippet.new(context: @page)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_snippet_new_record
|
23
|
-
tag = ComfortableMexicanSofa::Content::Tag::Snippet.new(context: @page, params: ["new"])
|
24
|
-
assert tag.snippet.new_record?
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_content
|
28
|
-
tag = ComfortableMexicanSofa::Content::Tag::Snippet.new(context: @page, params: ["default"])
|
29
|
-
assert_equal "snippet content", tag.content
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_content_new_record
|
33
|
-
tag = ComfortableMexicanSofa::Content::Tag::Snippet.new(context: @page, params: ["new"])
|
34
|
-
assert_nil tag.content
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require_relative "../../../test_helper"
|
2
|
-
|
3
|
-
class ContentTagsTemplateTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def test_init
|
6
|
-
tag = ComfortableMexicanSofa::Content::Tag::Template.new(
|
7
|
-
context: @page,
|
8
|
-
params: ["path/to/template"]
|
9
|
-
)
|
10
|
-
assert_equal "path/to/template", tag.path
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_init_without_path
|
14
|
-
message = "Missing template path for template tag"
|
15
|
-
assert_exception_raised ComfortableMexicanSofa::Content::Tag::Error, message do
|
16
|
-
ComfortableMexicanSofa::Content::Tag::Template.new(context: @page)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_content
|
21
|
-
tag = ComfortableMexicanSofa::Content::Tag::Template.new(
|
22
|
-
context: @page,
|
23
|
-
params: ["path/to/template"]
|
24
|
-
)
|
25
|
-
assert_equal "<%= render template: \"path/to/template\" %>", tag.content
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_render
|
29
|
-
tag = ComfortableMexicanSofa::Content::Tag::Template.new(
|
30
|
-
context: @page,
|
31
|
-
params: ["path/to/template"]
|
32
|
-
)
|
33
|
-
assert_equal "<%= render template: \"path/to/template\" %>", tag.render
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_render_with_whitelist
|
37
|
-
ComfortableMexicanSofa.config.allowed_templates = ["allowed/path"]
|
38
|
-
tag = ComfortableMexicanSofa::Content::Tag::Template.new(
|
39
|
-
context: @page,
|
40
|
-
params: ["allowed/path"]
|
41
|
-
)
|
42
|
-
assert_equal "<%= render template: \"allowed/path\" %>", tag.render
|
43
|
-
|
44
|
-
tag = ComfortableMexicanSofa::Content::Tag::Template.new(
|
45
|
-
context: @page,
|
46
|
-
params: ["not_allowed/path"]
|
47
|
-
)
|
48
|
-
assert_equal "", tag.render
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require_relative "../../../test_helper"
|
2
|
-
|
3
|
-
class ContentTagsTextTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
setup do
|
6
|
-
@page = comfy_cms_pages(:default)
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_init
|
10
|
-
tag = ComfortableMexicanSofa::Content::Tag::Text.new(context: @page, params: ["test"])
|
11
|
-
assert_equal "test", tag.identifier
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require_relative "../../../test_helper"
|
2
|
-
|
3
|
-
class ContentTagsTextAreaTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
setup do
|
6
|
-
@page = comfy_cms_pages(:default)
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_init
|
10
|
-
tag = ComfortableMexicanSofa::Content::Tag::TextArea.new(context: @page, params: ["test"])
|
11
|
-
assert_equal "test", tag.identifier
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require_relative "../../../test_helper"
|
2
|
-
|
3
|
-
class ContentTagsWysiwygTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
setup do
|
6
|
-
@page = comfy_cms_pages(:default)
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_init
|
10
|
-
tag = ComfortableMexicanSofa::Content::Tag::Wysiwyg.new(context: @page, params: ["test"])
|
11
|
-
assert_equal "test", tag.identifier
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
data/test/lib/revisions_test.rb
DELETED
@@ -1,222 +0,0 @@
|
|
1
|
-
require_relative "../test_helper"
|
2
|
-
|
3
|
-
class RevisionsTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
setup do
|
6
|
-
@site = comfy_cms_sites(:default)
|
7
|
-
@layout = comfy_cms_layouts(:default)
|
8
|
-
@page = comfy_cms_pages(:default)
|
9
|
-
@snippet = comfy_cms_snippets(:default)
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_fixtures_validity
|
13
|
-
assert_equal ({
|
14
|
-
"content" => "revision {{cms:fragment content}}",
|
15
|
-
"css" => "revision css",
|
16
|
-
"js" => "revision js" }), comfy_cms_revisions(:layout).data
|
17
|
-
|
18
|
-
assert_equal ({ "fragments_attributes" => [
|
19
|
-
{ "identifier" => "content", "content" => "old content" },
|
20
|
-
{ "identifier" => "title", "content" => "old title" }
|
21
|
-
] }), comfy_cms_revisions(:page).data
|
22
|
-
|
23
|
-
assert_equal ({
|
24
|
-
"content" => "revision content"
|
25
|
-
}), comfy_cms_revisions(:snippet).data
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_init_for_layouts
|
29
|
-
assert_equal %w[content css js], @layout.revision_fields
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_init_for_pages
|
33
|
-
assert_equal ["fragments_attributes"], @page.revision_fields
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_init_for_snippets
|
37
|
-
assert_equal ["content"], @snippet.revision_fields
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_creation_for_layout
|
41
|
-
old_attributes = @layout.attributes.slice("content", "css", "js")
|
42
|
-
|
43
|
-
assert_difference -> { @layout.revisions.count } do
|
44
|
-
@layout.update_attributes!(
|
45
|
-
content: "new {{cms:fragment content}}",
|
46
|
-
js: "new js"
|
47
|
-
)
|
48
|
-
@layout.reload
|
49
|
-
assert_equal 2, @layout.revisions.count
|
50
|
-
revision = @layout.revisions.last
|
51
|
-
assert_equal old_attributes, revision.data
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def test_creation_for_layout_ignore
|
56
|
-
assert_no_difference -> { @layout.revisions.count } do
|
57
|
-
@layout.update_attributes(label: "new label")
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_creation_for_page
|
62
|
-
assert_difference -> { @page.revisions.count } do
|
63
|
-
@page.update_attributes!(
|
64
|
-
fragments_attributes: [
|
65
|
-
{ identifier: "content",
|
66
|
-
content: "new content" }
|
67
|
-
]
|
68
|
-
)
|
69
|
-
@page.reload
|
70
|
-
assert_equal 2, @page.revisions.count
|
71
|
-
revision = @page.revisions.last
|
72
|
-
|
73
|
-
assert_equal ({
|
74
|
-
"fragments_attributes" => [
|
75
|
-
{ identifier: "boolean",
|
76
|
-
tag: "checkbox",
|
77
|
-
content: nil,
|
78
|
-
datetime: nil,
|
79
|
-
boolean: true },
|
80
|
-
{ identifier: "file",
|
81
|
-
tag: "file",
|
82
|
-
content: nil,
|
83
|
-
datetime: nil,
|
84
|
-
boolean: false },
|
85
|
-
{ identifier: "datetime",
|
86
|
-
tag: "datetime",
|
87
|
-
content: nil,
|
88
|
-
datetime: comfy_cms_fragments(:datetime).datetime,
|
89
|
-
boolean: false },
|
90
|
-
{ identifier: "content",
|
91
|
-
tag: "text",
|
92
|
-
content: "content",
|
93
|
-
datetime: nil,
|
94
|
-
boolean: false }
|
95
|
-
]
|
96
|
-
}), revision.data
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
def test_creation_for_page_ignore
|
101
|
-
assert_no_difference -> { @page.revisions.count } do
|
102
|
-
@page.update_attributes(label: "new label")
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
def test_creation_for_snippet
|
107
|
-
old_attributes = @snippet.attributes.slice("content")
|
108
|
-
|
109
|
-
assert_difference -> { @snippet.revisions.count } do
|
110
|
-
@snippet.update_attributes(content: "new content")
|
111
|
-
@snippet.reload
|
112
|
-
assert_equal 2, @snippet.revisions.count
|
113
|
-
revision = @snippet.revisions.last
|
114
|
-
assert_equal old_attributes, revision.data
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
def test_creation_for_snippet_ignore
|
119
|
-
assert_no_difference -> { @snippet.revisions.count } do
|
120
|
-
@snippet.update_attributes(label: "new label")
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
def test_creation_for_new_record
|
125
|
-
assert_difference "Comfy::Cms::Snippet.count" do
|
126
|
-
assert_no_difference "Comfy::Cms::Revision.count" do
|
127
|
-
snippet = @site.snippets.create!(
|
128
|
-
label: "test snippet",
|
129
|
-
identifier: "test_snippet",
|
130
|
-
content: "test content"
|
131
|
-
)
|
132
|
-
assert_equal 0, snippet.revisions.count
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
def test_restore_from_revision_for_layout
|
138
|
-
revision = comfy_cms_revisions(:layout)
|
139
|
-
|
140
|
-
assert_difference -> { @layout.revisions.count } do
|
141
|
-
@layout.restore_from_revision(revision)
|
142
|
-
@layout.reload
|
143
|
-
assert_equal "revision {{cms:fragment content}}", @layout.content
|
144
|
-
assert_equal "revision css", @layout.css
|
145
|
-
assert_equal "revision js", @layout.js
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
def test_restore_from_revision_for_page
|
150
|
-
revision = comfy_cms_revisions(:page)
|
151
|
-
|
152
|
-
assert_difference -> { @page.revisions.count } do
|
153
|
-
@page.restore_from_revision(revision)
|
154
|
-
@page.reload
|
155
|
-
|
156
|
-
assert_equal [
|
157
|
-
{ identifier: "boolean",
|
158
|
-
tag: "checkbox",
|
159
|
-
content: nil,
|
160
|
-
datetime: nil,
|
161
|
-
boolean: true },
|
162
|
-
{ identifier: "file",
|
163
|
-
tag: "file",
|
164
|
-
content: nil,
|
165
|
-
datetime: nil,
|
166
|
-
boolean: false },
|
167
|
-
{ identifier: "datetime",
|
168
|
-
tag: "datetime",
|
169
|
-
content: nil,
|
170
|
-
datetime: comfy_cms_fragments(:datetime).datetime,
|
171
|
-
boolean: false },
|
172
|
-
{ identifier: "content",
|
173
|
-
tag: "text",
|
174
|
-
content: "old content",
|
175
|
-
datetime: nil,
|
176
|
-
boolean: false },
|
177
|
-
{ identifier: "title",
|
178
|
-
tag: "text",
|
179
|
-
content: "old title",
|
180
|
-
datetime: nil,
|
181
|
-
boolean: false }
|
182
|
-
], @page.fragments_attributes
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
def test_restore_from_revision_for_snippet
|
187
|
-
revision = comfy_cms_revisions(:snippet)
|
188
|
-
|
189
|
-
assert_difference -> { @snippet.revisions.count } do
|
190
|
-
@snippet.restore_from_revision(revision)
|
191
|
-
@snippet.reload
|
192
|
-
assert_equal "revision content", @snippet.content
|
193
|
-
end
|
194
|
-
end
|
195
|
-
|
196
|
-
def test_restore_from_revision_with_wrong_revision_type
|
197
|
-
revision = comfy_cms_revisions(:layout)
|
198
|
-
|
199
|
-
assert_no_difference -> { @snippet.revisions.count } do
|
200
|
-
@snippet.restore_from_revision(revision)
|
201
|
-
@snippet.reload
|
202
|
-
assert_equal "snippet content", @snippet.content
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
def test_creation_with_limit
|
207
|
-
ComfortableMexicanSofa.config.revisions_limit = 1
|
208
|
-
revision = comfy_cms_revisions(:snippet)
|
209
|
-
|
210
|
-
assert_equal 1, @snippet.revisions.count
|
211
|
-
|
212
|
-
assert_no_difference -> { @snippet.revisions.count } do
|
213
|
-
@snippet.update_attributes(content: "new content")
|
214
|
-
assert_nil Comfy::Cms::Revision.find_by_id(revision.id)
|
215
|
-
|
216
|
-
@snippet.reload
|
217
|
-
revision = @snippet.revisions.last
|
218
|
-
assert_equal ({ "content" => "snippet content" }), revision.data
|
219
|
-
end
|
220
|
-
end
|
221
|
-
|
222
|
-
end
|