docks_app 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.editorconfig +8 -0
- data/.gitignore +22 -0
- data/.rubocop.yml +20 -0
- data/.travis.yml +10 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +35 -0
- data/Rakefile +3 -0
- data/bin/docks +5 -0
- data/config/json/docks_config.json +71 -0
- data/config/ruby/docks_config.rb +127 -0
- data/config/yaml/docks_config.yml +70 -0
- data/docks.gemspec +38 -0
- data/lib/docks/build.rb +300 -0
- data/lib/docks/cache.rb +143 -0
- data/lib/docks/command_line.rb +65 -0
- data/lib/docks/configuration.rb +217 -0
- data/lib/docks/containers/base_container.rb +103 -0
- data/lib/docks/containers/class_container.rb +39 -0
- data/lib/docks/containers/component_container.rb +92 -0
- data/lib/docks/containers/demo_container.rb +105 -0
- data/lib/docks/containers/factory_container.rb +12 -0
- data/lib/docks/containers/function_container.rb +46 -0
- data/lib/docks/containers/mixin_container.rb +19 -0
- data/lib/docks/containers/pattern_container.rb +168 -0
- data/lib/docks/containers/pattern_library_container.rb +77 -0
- data/lib/docks/containers/state_container.rb +9 -0
- data/lib/docks/containers/symbol_container.rb +77 -0
- data/lib/docks/containers/variable_container.rb +47 -0
- data/lib/docks/containers/variant_container.rb +9 -0
- data/lib/docks/containers/variation_container.rb +38 -0
- data/lib/docks/containers.rb +25 -0
- data/lib/docks/descriptor.rb +60 -0
- data/lib/docks/errors.rb +5 -0
- data/lib/docks/group.rb +66 -0
- data/lib/docks/helpers/github_helper.rb +29 -0
- data/lib/docks/helpers/path_helper.rb +94 -0
- data/lib/docks/helpers/render_helper.rb +87 -0
- data/lib/docks/helpers.rb +19 -0
- data/lib/docks/languages/base_language.rb +17 -0
- data/lib/docks/languages/coffeescript_language.rb +30 -0
- data/lib/docks/languages/common_types/markup_language.rb +71 -0
- data/lib/docks/languages/css_language.rb +13 -0
- data/lib/docks/languages/erb_language.rb +21 -0
- data/lib/docks/languages/haml_language.rb +21 -0
- data/lib/docks/languages/html_language.rb +10 -0
- data/lib/docks/languages/javascript_language.rb +42 -0
- data/lib/docks/languages/json_language.rb +18 -0
- data/lib/docks/languages/less_language.rb +33 -0
- data/lib/docks/languages/markdown_language.rb +10 -0
- data/lib/docks/languages/sass_language.rb +36 -0
- data/lib/docks/languages/slim_language.rb +21 -0
- data/lib/docks/languages/stylus_language.rb +26 -0
- data/lib/docks/languages/yaml_language.rb +18 -0
- data/lib/docks/languages.rb +103 -0
- data/lib/docks/markdown.rb +18 -0
- data/lib/docks/messenger.rb +69 -0
- data/lib/docks/naming_conventions/base_naming_convention.rb +9 -0
- data/lib/docks/naming_conventions/bem_naming_convention.rb +45 -0
- data/lib/docks/naming_conventions/suit_naming_convention.rb +45 -0
- data/lib/docks/naming_conventions.rb +21 -0
- data/lib/docks/ostruct.rb +17 -0
- data/lib/docks/parser.rb +86 -0
- data/lib/docks/parsers/base_parser.rb +128 -0
- data/lib/docks/parsers/coffeescript_parser.rb +30 -0
- data/lib/docks/parsers/css_parser.rb +27 -0
- data/lib/docks/parsers/javascript_parser.rb +30 -0
- data/lib/docks/parsers/less_parser.rb +22 -0
- data/lib/docks/parsers/sass_parser.rb +31 -0
- data/lib/docks/parsers/stylus_parser.rb +28 -0
- data/lib/docks/process.rb +60 -0
- data/lib/docks/processors.rb +416 -0
- data/lib/docks/renderers/base_renderer.rb +64 -0
- data/lib/docks/renderers/common_features/capturable.rb +69 -0
- data/lib/docks/renderers/common_features/helperable.rb +23 -0
- data/lib/docks/renderers/erb_renderer.rb +68 -0
- data/lib/docks/renderers/haml_renderer.rb +37 -0
- data/lib/docks/renderers/slim_renderer.rb +33 -0
- data/lib/docks/symbol_sources/base_symbol_source.rb +12 -0
- data/lib/docks/symbol_sources/jquery_symbol_source.rb +17 -0
- data/lib/docks/symbol_sources/mdn_symbol_source.rb +35 -0
- data/lib/docks/symbol_sources/sass_symbol_source.rb +27 -0
- data/lib/docks/symbol_sources.rb +28 -0
- data/lib/docks/tags/access_tag.rb +27 -0
- data/lib/docks/tags/activate_with_tag.rb +17 -0
- data/lib/docks/tags/active_tag.rb +14 -0
- data/lib/docks/tags/alias_tag.rb +17 -0
- data/lib/docks/tags/author_tag.rb +19 -0
- data/lib/docks/tags/base_tag.rb +52 -0
- data/lib/docks/tags/beta_tag.rb +26 -0
- data/lib/docks/tags/class_tag.rb +16 -0
- data/lib/docks/tags/compatibility_tag.rb +19 -0
- data/lib/docks/tags/demo_type_tag.rb +14 -0
- data/lib/docks/tags/deprecated_tag.rb +26 -0
- data/lib/docks/tags/description_tag.rb +99 -0
- data/lib/docks/tags/example_tag.rb +20 -0
- data/lib/docks/tags/factory_tag.rb +16 -0
- data/lib/docks/tags/for_tag.rb +23 -0
- data/lib/docks/tags/group_tag.rb +10 -0
- data/lib/docks/tags/helper_tag.rb +13 -0
- data/lib/docks/tags/include_with_tag.rb +57 -0
- data/lib/docks/tags/javascript_action_tag.rb +10 -0
- data/lib/docks/tags/link_tag.rb +18 -0
- data/lib/docks/tags/markup_tag.rb +106 -0
- data/lib/docks/tags/member_tag.rb +37 -0
- data/lib/docks/tags/method_tag.rb +18 -0
- data/lib/docks/tags/name_tag.rb +10 -0
- data/lib/docks/tags/object_tag.rb +15 -0
- data/lib/docks/tags/param_tag.rb +94 -0
- data/lib/docks/tags/pattern_tag.rb +21 -0
- data/lib/docks/tags/preclude_tag.rb +17 -0
- data/lib/docks/tags/private_tag.rb +15 -0
- data/lib/docks/tags/property_tag.rb +18 -0
- data/lib/docks/tags/public_tag.rb +15 -0
- data/lib/docks/tags/require_tag.rb +47 -0
- data/lib/docks/tags/returns_tag.rb +31 -0
- data/lib/docks/tags/set_by_tag.rb +18 -0
- data/lib/docks/tags/signature_tag.rb +35 -0
- data/lib/docks/tags/since_tag.rb +26 -0
- data/lib/docks/tags/source_tag.rb +12 -0
- data/lib/docks/tags/state_tag.rb +21 -0
- data/lib/docks/tags/static_tag.rb +14 -0
- data/lib/docks/tags/subcomponent_tag.rb +68 -0
- data/lib/docks/tags/subtitle_tag.rb +11 -0
- data/lib/docks/tags/symbol_type_tag.rb +10 -0
- data/lib/docks/tags/throws_tag.rb +30 -0
- data/lib/docks/tags/title_tag.rb +10 -0
- data/lib/docks/tags/type_tag.rb +10 -0
- data/lib/docks/tags/value_tag.rb +10 -0
- data/lib/docks/tags/variant_tag.rb +21 -0
- data/lib/docks/tags/variation_tag.rb +136 -0
- data/lib/docks/tags.rb +103 -0
- data/lib/docks/templates.rb +122 -0
- data/lib/docks/themes.rb +19 -0
- data/lib/docks/types.rb +26 -0
- data/lib/docks/version.rb +3 -0
- data/lib/docks.rb +37 -0
- data/spec/fixtures/build/scripts/bar/bar_2.js +1 -0
- data/spec/fixtures/build/scripts/bar.js +1 -0
- data/spec/fixtures/build/styles/foo/foo-2.css +1 -0
- data/spec/fixtures/build/styles/foo.css +1 -0
- data/spec/fixtures/build/templates/baz/baz_2.erb +1 -0
- data/spec/fixtures/build/templates/baz.erb +1 -0
- data/spec/fixtures/grouper/components/button/button.coffee +0 -0
- data/spec/fixtures/grouper/components/button/button.haml +0 -0
- data/spec/fixtures/grouper/components/button/button.scss +0 -0
- data/spec/fixtures/grouper/components/checkbox/_checkbox.haml +0 -0
- data/spec/fixtures/grouper/components/checkbox/_checkbox.scss +0 -0
- data/spec/fixtures/grouper/components/checkbox/checkbox.coffee +0 -0
- data/spec/fixtures/grouper/components/form/form.coffee +0 -0
- data/spec/fixtures/grouper/components/form/form.m +0 -0
- data/spec/fixtures/grouper/components/form/form.scss +0 -0
- data/spec/fixtures/grouper/components/next-expanding-textarea/_next-expanding-textarea.scss +0 -0
- data/spec/fixtures/grouper/components/next-expanding-textarea/_next_expanding_textarea.coffee +0 -0
- data/spec/fixtures/grouper/components/next-expanding-textarea/next-expanding-textarea.haml +0 -0
- data/spec/fixtures/grouper/components/next-tab/next-tab.coffee +0 -0
- data/spec/fixtures/grouper/components/next-tab/next-tab.haml +0 -0
- data/spec/fixtures/grouper/components/next-tab/next-tab.scss +0 -0
- data/spec/fixtures/grouper/components/segmented control/segmented control.coffee +0 -0
- data/spec/fixtures/grouper/components/segmented control/segmented control.haml +0 -0
- data/spec/fixtures/grouper/components/segmented control/segmented control.min.html +0 -0
- data/spec/fixtures/grouper/components/segmented control/segmented control.scss +0 -0
- data/spec/fixtures/grouper/markup/list-view.haml +0 -0
- data/spec/fixtures/grouper/markup/resizable/resizable.haml +0 -0
- data/spec/fixtures/grouper/markup/toggle.haml +0 -0
- data/spec/fixtures/grouper/scripts/resizable/resizable.coffee +0 -0
- data/spec/fixtures/grouper/scripts/toggle.coffee +0 -0
- data/spec/fixtures/grouper/style/_list-view.scss +0 -0
- data/spec/fixtures/grouper/style/_toggle.scss +0 -0
- data/spec/fixtures/languages/stub.json +3 -0
- data/spec/fixtures/languages/stub.yml +2 -0
- data/spec/fixtures/parsers/coffeescript_parser_fixture_basic.coffee +20 -0
- data/spec/fixtures/parsers/coffeescript_parser_fixture_complex.coffee +80 -0
- data/spec/fixtures/parsers/css_parser_fixture_basic.css +44 -0
- data/spec/fixtures/parsers/css_parser_fixture_complex.css +120 -0
- data/spec/fixtures/parsers/javascript_parser_fixture_basic.js +27 -0
- data/spec/fixtures/parsers/javascript_parser_fixture_complex.js +85 -0
- data/spec/fixtures/parsers/sass_parser_fixture_basic.scss +39 -0
- data/spec/fixtures/parsers/sass_parser_fixture_complex.scss +149 -0
- data/spec/fixtures/parsers/stylus_parser_fixture_basic.styl +34 -0
- data/spec/fixtures/parsers/stylus_parser_fixture_complex.styl +113 -0
- data/spec/fixtures/processors/join_with_smart_line_breaks/code_blocks.txt +10 -0
- data/spec/fixtures/processors/join_with_smart_line_breaks/headings.txt +15 -0
- data/spec/fixtures/processors/join_with_smart_line_breaks/lists.txt +21 -0
- data/spec/fixtures/processors/join_with_smart_line_breaks/lists_with_nesting.txt +13 -0
- data/spec/fixtures/processors/join_with_smart_line_breaks/multiple_paragraphs.txt +11 -0
- data/spec/fixtures/renderers/helpers.rb +37 -0
- data/spec/fixtures/renderers/html_output.html +7 -0
- data/spec/fixtures/renderers/templates/layouts/application.html.erb +0 -0
- data/spec/fixtures/renderers/templates/layouts/more/subdirectory.html.erb +0 -0
- data/spec/fixtures/renderers/templates/partials/_leading_underscore.html.erb +1 -0
- data/spec/fixtures/renderers/templates/partials/more/_subdirectory.html.erb +1 -0
- data/spec/fixtures/renderers/templates/partials/partial.html.erb +0 -0
- data/spec/fixtures/renderers/templates/partials/template.html.erb +1 -0
- data/spec/fixtures/renderers/templates/template.html.erb +1 -0
- data/spec/fixtures/tags/description/button.md +24 -0
- data/spec/fixtures/tags/description/class.md +27 -0
- data/spec/fixtures/tags/description/component.md +23 -0
- data/spec/fixtures/tags/description/function.md +30 -0
- data/spec/lib/build_spec.rb +467 -0
- data/spec/lib/cache_spec.rb +175 -0
- data/spec/lib/command_line_spec.rb +77 -0
- data/spec/lib/configuration_spec.rb +180 -0
- data/spec/lib/containers/base_container_spec.rb +214 -0
- data/spec/lib/containers/class_container_spec.rb +209 -0
- data/spec/lib/containers/component_container_spec.rb +158 -0
- data/spec/lib/containers/demo_container_spec.rb +113 -0
- data/spec/lib/containers/function_container_spec.rb +116 -0
- data/spec/lib/containers/mixin_container_spec.rb +4 -0
- data/spec/lib/containers/pattern_container_spec.rb +291 -0
- data/spec/lib/containers/pattern_library_container_spec.rb +130 -0
- data/spec/lib/containers/symbol_container_spec.rb +216 -0
- data/spec/lib/containers/variable_container_spec.rb +116 -0
- data/spec/lib/containers/variation_container_spec.rb +52 -0
- data/spec/lib/containers_spec.rb +22 -0
- data/spec/lib/descriptor_spec.rb +73 -0
- data/spec/lib/group_spec.rb +151 -0
- data/spec/lib/helpers/path_helper_spec.rb +202 -0
- data/spec/lib/helpers/render_helper_spec.rb +159 -0
- data/spec/lib/helpers_spec.rb +35 -0
- data/spec/lib/languages/base_language_spec.rb +32 -0
- data/spec/lib/languages/coffeescript_language_spec.rb +52 -0
- data/spec/lib/languages/css_language_spec.rb +13 -0
- data/spec/lib/languages/erb_language_spec.rb +33 -0
- data/spec/lib/languages/haml_language_spec.rb +32 -0
- data/spec/lib/languages/javascript_language_spec.rb +54 -0
- data/spec/lib/languages/json_language_spec.rb +24 -0
- data/spec/lib/languages/less_language_spec.rb +39 -0
- data/spec/lib/languages/markup_language_spec.rb +95 -0
- data/spec/lib/languages/sass_language_spec.rb +53 -0
- data/spec/lib/languages/slim_language_spec.rb +32 -0
- data/spec/lib/languages/stylus_language_spec.rb +34 -0
- data/spec/lib/languages/yaml_language_spec.rb +24 -0
- data/spec/lib/languages_spec.rb +127 -0
- data/spec/lib/markdown_spec.rb +63 -0
- data/spec/lib/messenger_spec.rb +1 -0
- data/spec/lib/naming_conventions/bem_naming_convention_spec.rb +112 -0
- data/spec/lib/naming_conventions/suit_naming_convention_spec.rb +107 -0
- data/spec/lib/naming_conventions_spec.rb +28 -0
- data/spec/lib/ostruct_spec.rb +15 -0
- data/spec/lib/parser_spec.rb +93 -0
- data/spec/lib/parsers/base_parser_spec.rb +128 -0
- data/spec/lib/parsers/coffeescript_parser_spec.rb +184 -0
- data/spec/lib/parsers/css_parser_spec.rb +136 -0
- data/spec/lib/parsers/javascript_parser_spec.rb +216 -0
- data/spec/lib/parsers/less_parser_spec.rb +111 -0
- data/spec/lib/parsers/sass_parser_spec.rb +233 -0
- data/spec/lib/parsers/stylus_parser_spec.rb +212 -0
- data/spec/lib/process_spec.rb +96 -0
- data/spec/lib/processors_spec.rb +555 -0
- data/spec/lib/renderers/base_renderer_spec.rb +122 -0
- data/spec/lib/renderers/common_features/helperable_spec.rb +30 -0
- data/spec/lib/renderers/erb_renderer_spec.rb +119 -0
- data/spec/lib/renderers/haml_renderer_spec.rb +103 -0
- data/spec/lib/renderers/slim_renderer_spec.rb +103 -0
- data/spec/lib/symbol_sources/jquery_symbol_source_spec.rb +25 -0
- data/spec/lib/symbol_sources/mdn_symbol_source_spec.rb +40 -0
- data/spec/lib/symbol_sources/sass_symbol_source_spec.rb +39 -0
- data/spec/lib/symbol_sources_spec.rb +19 -0
- data/spec/lib/tags/access_tag_spec.rb +32 -0
- data/spec/lib/tags/activate_with_tag_spec.rb +31 -0
- data/spec/lib/tags/active_tag_spec.rb +24 -0
- data/spec/lib/tags/alias_tag_spec.rb +31 -0
- data/spec/lib/tags/author_tag_spec.rb +172 -0
- data/spec/lib/tags/base_tag_spec.rb +21 -0
- data/spec/lib/tags/beta_tag_spec.rb +52 -0
- data/spec/lib/tags/class_tag_spec.rb +29 -0
- data/spec/lib/tags/compatibility_tag_spec.rb +159 -0
- data/spec/lib/tags/demo_type_tag_spec.rb +24 -0
- data/spec/lib/tags/deprecated_tag_spec.rb +50 -0
- data/spec/lib/tags/description_tag_spec.rb +242 -0
- data/spec/lib/tags/example_tag_spec.rb +37 -0
- data/spec/lib/tags/factory_tag_spec.rb +29 -0
- data/spec/lib/tags/for_tag_spec.rb +45 -0
- data/spec/lib/tags/group_tag_spec.rb +20 -0
- data/spec/lib/tags/helper_tag_spec.rb +22 -0
- data/spec/lib/tags/include_with_tag_spec.rb +74 -0
- data/spec/lib/tags/javascript_action_tag_spec.rb +20 -0
- data/spec/lib/tags/link_tag_spec.rb +49 -0
- data/spec/lib/tags/markup_tag_spec.rb +255 -0
- data/spec/lib/tags/member_tag_spec.rb +167 -0
- data/spec/lib/tags/method_tag_spec.rb +27 -0
- data/spec/lib/tags/name_tag_spec.rb +20 -0
- data/spec/lib/tags/object_tag_spec.rb +24 -0
- data/spec/lib/tags/param_tag_spec.rb +261 -0
- data/spec/lib/tags/pattern_tag_spec.rb +49 -0
- data/spec/lib/tags/preclude_tag_spec.rb +31 -0
- data/spec/lib/tags/private_tag_spec.rb +31 -0
- data/spec/lib/tags/property_tag_spec.rb +27 -0
- data/spec/lib/tags/public_tag_spec.rb +29 -0
- data/spec/lib/tags/require_tag_spec.rb +133 -0
- data/spec/lib/tags/returns_tag_spec.rb +85 -0
- data/spec/lib/tags/set_by_tag_spec.rb +92 -0
- data/spec/lib/tags/signature_tag_spec.rb +125 -0
- data/spec/lib/tags/since_tag_spec.rb +48 -0
- data/spec/lib/tags/state_tag_spec.rb +199 -0
- data/spec/lib/tags/static_tag_spec.rb +27 -0
- data/spec/lib/tags/subcomponent_tag_spec.rb +78 -0
- data/spec/lib/tags/subtitle_tag_spec.rb +13 -0
- data/spec/lib/tags/symbol_type_tag_spec.rb +20 -0
- data/spec/lib/tags/throws_tag_spec.rb +49 -0
- data/spec/lib/tags/title_tag_spec.rb +20 -0
- data/spec/lib/tags/type_tag_spec.rb +20 -0
- data/spec/lib/tags/value_tag_spec.rb +20 -0
- data/spec/lib/tags/variant_tag_spec.rb +13 -0
- data/spec/lib/tags/variation_tag_spec.rb +154 -0
- data/spec/lib/tags_spec.rb +264 -0
- data/spec/lib/templates_spec.rb +185 -0
- data/spec/lib/themes_spec.rb +32 -0
- data/spec/spec_helper.rb +34 -0
- data/tasks/rspec.rake +7 -0
- data/tasks/rubocop.rake +8 -0
- metadata +740 -0
@@ -0,0 +1,92 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Docks::Tags::SetBy do
|
4
|
+
subject { Docks::Tags::SetBy.instance }
|
5
|
+
|
6
|
+
it "does not allow multiline content" do
|
7
|
+
expect(subject.multiline?).to be false
|
8
|
+
end
|
9
|
+
|
10
|
+
it "allows multiple tags per block" do
|
11
|
+
expect(subject.multiple_allowed?).to be true
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#process" do
|
15
|
+
let(:symbol) { Docks::Containers::Symbol.new }
|
16
|
+
let(:simple_content) { ":checked?" }
|
17
|
+
let(:complex_setter) { ":size" }
|
18
|
+
let(:complex_constant) { "SIZE::LARGE" }
|
19
|
+
let(:complex_content) { "#{complex_setter} (#{complex_constant})" }
|
20
|
+
|
21
|
+
it "creates a :setter when there is no constant" do
|
22
|
+
expect(process_set_by_with(simple_content).first.setter).to eq simple_content
|
23
|
+
end
|
24
|
+
|
25
|
+
it "creates a :setter when there is a constant" do
|
26
|
+
expect(process_set_by_with(complex_content).first.setter).to eq complex_setter
|
27
|
+
end
|
28
|
+
|
29
|
+
it "does not create a constant when no parentheses are provided" do
|
30
|
+
expect(process_set_by_with(simple_content).first.constant).to be nil
|
31
|
+
end
|
32
|
+
|
33
|
+
it "creates a constant when one is provided without a key" do
|
34
|
+
expect(process_set_by_with(complex_content).first.constant).to eq complex_constant
|
35
|
+
end
|
36
|
+
|
37
|
+
it "creates a constant when one is provided with the :constant key" do
|
38
|
+
complex_content.sub!("(", "(constant: ")
|
39
|
+
expect(process_set_by_with(complex_content).first.constant).to eq complex_constant
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "mutliple :set_by per line" do
|
43
|
+
let(:setter_two) { ":state" }
|
44
|
+
let(:constant_two) { "STATE::CHECKED" }
|
45
|
+
let(:content_two) { "#{setter_two} (#{constant_two})" }
|
46
|
+
|
47
|
+
it "creates multiple :set_by when they are separated by a comma" do
|
48
|
+
[
|
49
|
+
"#{complex_content}, #{content_two}, #{simple_content}",
|
50
|
+
"#{complex_content} ,#{content_two} ,#{simple_content}",
|
51
|
+
"#{complex_content} , #{content_two} , #{simple_content}"
|
52
|
+
].each do |test|
|
53
|
+
result = process_set_by_with(test)
|
54
|
+
expect(result.length).to eq 3
|
55
|
+
|
56
|
+
expect(result[0].setter).to eq complex_setter
|
57
|
+
expect(result[0].constant).to eq complex_constant
|
58
|
+
expect(result[1].setter).to eq setter_two
|
59
|
+
expect(result[1].constant).to eq constant_two
|
60
|
+
expect(result[2].setter).to eq simple_content
|
61
|
+
expect(result[2].constant).to be nil
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
it "creates multiple :set_by when they are separated by a pipe" do
|
66
|
+
[
|
67
|
+
"#{complex_content}| #{content_two}| #{simple_content}",
|
68
|
+
"#{complex_content} |#{content_two} |#{simple_content}",
|
69
|
+
"#{complex_content} | #{content_two} | #{simple_content}"
|
70
|
+
].each do |test|
|
71
|
+
result = process_set_by_with(test)
|
72
|
+
expect(result.length).to eq 3
|
73
|
+
|
74
|
+
expect(result[0].setter).to eq complex_setter
|
75
|
+
expect(result[0].constant).to eq complex_constant
|
76
|
+
expect(result[1].setter).to eq setter_two
|
77
|
+
expect(result[1].constant).to eq constant_two
|
78
|
+
expect(result[2].setter).to eq simple_content
|
79
|
+
expect(result[2].constant).to be nil
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
private
|
85
|
+
|
86
|
+
def process_set_by_with(content)
|
87
|
+
symbol[subject.name] = content
|
88
|
+
subject.process(symbol)
|
89
|
+
symbol[subject.name]
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,125 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Docks::Tags::Signature do
|
4
|
+
subject { Docks::Tags::Signature.instance }
|
5
|
+
|
6
|
+
it "allows multiline content" do
|
7
|
+
expect(subject.multiline?).to be true
|
8
|
+
end
|
9
|
+
|
10
|
+
it "only allows one description per block" do
|
11
|
+
expect(subject.multiple_allowed?).to be false
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#process" do
|
15
|
+
it "connects multiline content with line breaks" do
|
16
|
+
signature = ["foo", "bar"]
|
17
|
+
symbol = Docks::Containers::Symbol.new(signature: signature.dup)
|
18
|
+
subject.process(symbol)
|
19
|
+
expect(symbol[subject.name]).to eq signature.join("\n")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "post process" do
|
24
|
+
before(:each) { Docks::Languages.register_bundled_languages }
|
25
|
+
|
26
|
+
let(:script_source) { OpenStruct.new(file: "foo.coffee") }
|
27
|
+
|
28
|
+
let(:mixin) { Docks::Containers::Mixin.new(name: "foo", source: OpenStruct.new(file: "foo.scss")) }
|
29
|
+
let(:function) { Docks::Containers::Function.new(name: "foo", source: script_source) }
|
30
|
+
let(:method) { Docks::Containers::Function.new(name: "foo", source: script_source) }
|
31
|
+
|
32
|
+
let(:klass) do
|
33
|
+
klass = Docks::Containers::Klass.new(name: "Foo", source: script_source)
|
34
|
+
klass.add_member(method)
|
35
|
+
klass
|
36
|
+
end
|
37
|
+
|
38
|
+
let(:factory) do
|
39
|
+
factory = Docks::Containers::Factory.new(name: "Bar", source: script_source)
|
40
|
+
factory.add_member(method)
|
41
|
+
factory
|
42
|
+
end
|
43
|
+
|
44
|
+
let(:object) do
|
45
|
+
object = Docks::Containers::Variable.new(name: "Baz", object: true, source: script_source)
|
46
|
+
object.add_member(method)
|
47
|
+
object
|
48
|
+
end
|
49
|
+
|
50
|
+
let(:pattern) { Docks::Containers::Pattern.new(name: "foo") }
|
51
|
+
|
52
|
+
it "asks the language for a function to update the signature" do
|
53
|
+
pattern.add(:script, function)
|
54
|
+
expect(Docks::Languages::CoffeeScript.instance).to receive(:signature_for).with(function).and_return("foo")
|
55
|
+
|
56
|
+
post_process
|
57
|
+
|
58
|
+
expect(function.signature).to eq "foo"
|
59
|
+
end
|
60
|
+
|
61
|
+
it "asks the language for a mixin to update the signature" do
|
62
|
+
pattern.add(:style, mixin)
|
63
|
+
expect(Docks::Languages::Sass.instance).to receive(:signature_for).with(mixin).and_return("foo")
|
64
|
+
|
65
|
+
post_process
|
66
|
+
|
67
|
+
expect(mixin.signature).to eq "foo"
|
68
|
+
end
|
69
|
+
|
70
|
+
it "asks the language for a class and its methods to update the signature" do
|
71
|
+
pattern.add(:script, klass)
|
72
|
+
expect(Docks::Languages::CoffeeScript.instance).to receive(:signature_for).with(klass).and_return("foo")
|
73
|
+
expect(Docks::Languages::CoffeeScript.instance).to receive(:signature_for).with(method).and_return("bar")
|
74
|
+
|
75
|
+
post_process
|
76
|
+
|
77
|
+
expect(klass.signature).to eq "foo"
|
78
|
+
expect(method.signature).to eq "bar"
|
79
|
+
end
|
80
|
+
|
81
|
+
it "asks the language for a factory and its methods to update the signature" do
|
82
|
+
pattern.add(:script, factory)
|
83
|
+
expect(Docks::Languages::CoffeeScript.instance).to receive(:signature_for).with(factory).and_return("foo")
|
84
|
+
expect(Docks::Languages::CoffeeScript.instance).to receive(:signature_for).with(method).and_return("bar")
|
85
|
+
|
86
|
+
post_process
|
87
|
+
|
88
|
+
expect(factory.signature).to eq "foo"
|
89
|
+
expect(method.signature).to eq "bar"
|
90
|
+
end
|
91
|
+
|
92
|
+
it "asks the language for an object's methods to update the signature" do
|
93
|
+
pattern.add(:script, object)
|
94
|
+
expect(Docks::Languages::CoffeeScript.instance).to receive(:signature_for).with(method).and_return("foo")
|
95
|
+
|
96
|
+
post_process
|
97
|
+
|
98
|
+
expect(method.signature).to eq "foo"
|
99
|
+
end
|
100
|
+
|
101
|
+
it "adds signatures for nested methods" do
|
102
|
+
second_method = Docks::Containers::Function.new(name: "foo", source: script_source)
|
103
|
+
method.add_member(second_method)
|
104
|
+
|
105
|
+
pattern.add(:script, object)
|
106
|
+
expect(Docks::Languages::CoffeeScript.instance).to receive(:signature_for).with(method).and_return("foo")
|
107
|
+
expect(Docks::Languages::CoffeeScript.instance).to receive(:signature_for).with(second_method).and_return("bar")
|
108
|
+
|
109
|
+
post_process
|
110
|
+
|
111
|
+
expect(method.signature).to eq "foo"
|
112
|
+
expect(second_method.signature).to eq "bar"
|
113
|
+
end
|
114
|
+
|
115
|
+
it "doesn't replace a singature that exists" do
|
116
|
+
factory.signature = "Bar = (node) ->"
|
117
|
+
pattern.add(:script, factory)
|
118
|
+
expect { post_process }.to_not change { factory.signature }
|
119
|
+
end
|
120
|
+
|
121
|
+
def post_process
|
122
|
+
Docks::Process.process(pattern)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Docks::Tags::Since do
|
4
|
+
subject { Docks::Tags::Since.instance }
|
5
|
+
|
6
|
+
it "allows multiline content" do
|
7
|
+
expect(subject.multiline?).to be true
|
8
|
+
end
|
9
|
+
|
10
|
+
it "allows only one tag per block" do
|
11
|
+
expect(subject.multiple_allowed?).to be false
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#process" do
|
15
|
+
let(:symbol) { Docks::Containers::Symbol.new }
|
16
|
+
let(:version) { "1.5.0-beta003" }
|
17
|
+
let(:description) { "This is the description" }
|
18
|
+
|
19
|
+
it "correctly sets the version when no description is provided" do
|
20
|
+
expect(process_since_with(version).version).to eq version
|
21
|
+
end
|
22
|
+
|
23
|
+
it "correctly sets the version when a description is provided" do
|
24
|
+
expect(process_since_with("#{version} #{description}").version).to eq version
|
25
|
+
expect(process_since_with("#{version} - #{description}").version).to eq version
|
26
|
+
expect(process_since_with("#{version} -#{description}").version).to eq version
|
27
|
+
end
|
28
|
+
|
29
|
+
it "correctly returns a nil description when no description is provided" do
|
30
|
+
expect(process_since_with(version).description).to be nil
|
31
|
+
end
|
32
|
+
|
33
|
+
it "correctly assigns a description when one is provided" do
|
34
|
+
target_description = Docks::Processors.join_with_smart_line_breaks(description)
|
35
|
+
expect(process_since_with("#{version} #{description}").description).to eq target_description
|
36
|
+
expect(process_since_with("#{version} - #{description}").description).to eq target_description
|
37
|
+
expect(process_since_with("#{version} -#{description}").description).to eq target_description
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def process_since_with(content)
|
43
|
+
symbol[subject.name] = content
|
44
|
+
subject.process(symbol)
|
45
|
+
symbol[subject.name]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,199 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Docks::Tags::State do
|
4
|
+
subject { Docks::Tags::State.instance }
|
5
|
+
|
6
|
+
it "allows multiline content" do
|
7
|
+
expect(subject.multiline?).to be true
|
8
|
+
end
|
9
|
+
|
10
|
+
it "allows multiple tags per block" do
|
11
|
+
expect(subject.multiple_allowed?).to be true
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#process" do
|
15
|
+
before :each do
|
16
|
+
@default_state_hash = {
|
17
|
+
description: nil,
|
18
|
+
activate_with: [],
|
19
|
+
precludes: [],
|
20
|
+
set_by: [],
|
21
|
+
include_with: [],
|
22
|
+
demo_type: Docks::Types::Demo::DEFAULT,
|
23
|
+
active: false,
|
24
|
+
javascript_action: nil
|
25
|
+
}
|
26
|
+
|
27
|
+
@optional_state_params = [:description, :activate_with, :precludes, :set_by, :include_with, :demo_type, :active, :javascript_action]
|
28
|
+
end
|
29
|
+
|
30
|
+
let(:name) { "tab--is-active" }
|
31
|
+
let(:description) { "An active tab." }
|
32
|
+
let(:activate_with) { "tab--is-important | tab--is-valid" }
|
33
|
+
let(:precludes) { "tab--is-inactive" }
|
34
|
+
let(:set_by) { "TabList#activate | :state (Tabs::State::ACTIVE)" }
|
35
|
+
let(:include_with) { "tab-list" }
|
36
|
+
let(:demo_type) { Docks::Types::Demo::SELECT }
|
37
|
+
let(:active) { "true" }
|
38
|
+
let(:javascript_action) { "this.activate()" }
|
39
|
+
|
40
|
+
it "creates states as their container" do
|
41
|
+
symbol = Docks::Containers::Symbol.new(states: [name])
|
42
|
+
subject.process(symbol)
|
43
|
+
expect(symbol.states.length).to be 1
|
44
|
+
expect(symbol.states.first).to be_a Docks::Containers::State
|
45
|
+
end
|
46
|
+
|
47
|
+
it "sets the defaults when parameters are not included" do
|
48
|
+
result = subject.send(:break_apart_variation_details, name)
|
49
|
+
expect(result[:name]).to eq name
|
50
|
+
|
51
|
+
expect_default_for_optionals_with_exclusions(result)
|
52
|
+
end
|
53
|
+
|
54
|
+
it "sets the description when one is provided without an options parenthetical" do
|
55
|
+
[
|
56
|
+
"#{name} #{description}",
|
57
|
+
"#{name} - #{description}"
|
58
|
+
].each do |str|
|
59
|
+
result = subject.send(:break_apart_variation_details, str)
|
60
|
+
expect(result[:name]).to eq name
|
61
|
+
expect(result[:description]).to eq description
|
62
|
+
expect(result[:description]).to eq description
|
63
|
+
|
64
|
+
expect_default_for_optionals_with_exclusions(result, :description)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
it "sets the description when one is provided with an options parenthetical" do
|
69
|
+
[
|
70
|
+
"#{name} (#{Docks::Types::Demo::NONE}) #{description}",
|
71
|
+
"#{name} (#{Docks::Types::Demo::NONE}) - #{description}"
|
72
|
+
].each do |str|
|
73
|
+
result = subject.send(:break_apart_variation_details, str)
|
74
|
+
expect(result[:name]).to eq name
|
75
|
+
expect(result[:description]).to eq description
|
76
|
+
expect(result[:description]).to eq description
|
77
|
+
expect(result[:demo_type]).to eq Docks::Types::Demo::NONE
|
78
|
+
|
79
|
+
expect_default_for_optionals_with_exclusions(result, :description, :demo_type)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
it "sets the demo type when it is the only thing provided in the parenthetical" do
|
84
|
+
demo_type = Docks::Types::Demo::SELECT
|
85
|
+
result = subject.send(:break_apart_variation_details, "#{name} (#{demo_type})")
|
86
|
+
expect(result[:demo_type]).to eq demo_type
|
87
|
+
|
88
|
+
expect_default_for_optionals_with_exclusions(result, :demo_type)
|
89
|
+
end
|
90
|
+
|
91
|
+
it "sets the demo type when other key-value pairs are provided in the parenthetical" do
|
92
|
+
result = subject.send(:break_apart_variation_details, "#{name} (#{demo_type}, activate with: #{activate_with})")
|
93
|
+
expect(result[:name]).to eq name
|
94
|
+
expect(result[:demo_type]).to eq demo_type
|
95
|
+
expect(result[:activate_with]).to eq Docks::Processors.split_on_characters(activate_with, "\s\|")
|
96
|
+
|
97
|
+
expect_default_for_optionals_with_exclusions(result, :demo_type, :activate_with)
|
98
|
+
end
|
99
|
+
|
100
|
+
it "sets active parameter" do
|
101
|
+
[
|
102
|
+
"#{name} (active : yup)",
|
103
|
+
"#{name} (active: true)"
|
104
|
+
].each do |str|
|
105
|
+
result = subject.send(:break_apart_variation_details, str)
|
106
|
+
expect(result[:name]).to eq name
|
107
|
+
expect(result[:active]).to be true
|
108
|
+
expect_default_for_optionals_with_exclusions(result, :active)
|
109
|
+
end
|
110
|
+
|
111
|
+
[
|
112
|
+
"#{name} (active: false)",
|
113
|
+
"#{name} (active : false)"
|
114
|
+
].each do |str|
|
115
|
+
result = subject.send(:break_apart_variation_details, str)
|
116
|
+
expect(result[:name]).to eq name
|
117
|
+
expect(result[:active]).to be false
|
118
|
+
expect_default_for_optionals_with_exclusions(result, :active)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
it "sets the include_with parameter" do
|
123
|
+
result = subject.send(:break_apart_variation_details, "#{name} (include with : #{include_with})")
|
124
|
+
expect(result[:name]).to eq name
|
125
|
+
expect(result[:include_with]).to eq Docks::Processors.split_on_characters(include_with, "\s\|")
|
126
|
+
|
127
|
+
expect_default_for_optionals_with_exclusions(result, :include_with)
|
128
|
+
end
|
129
|
+
|
130
|
+
it "sets the activate_with parameter" do
|
131
|
+
result = subject.send(:break_apart_variation_details, "#{name} (activate with : #{activate_with})")
|
132
|
+
expect(result[:name]).to eq name
|
133
|
+
expect(result[:activate_with]).to eq Docks::Processors.split_on_characters(activate_with, "\s\|")
|
134
|
+
|
135
|
+
expect_default_for_optionals_with_exclusions(result, :activate_with)
|
136
|
+
end
|
137
|
+
|
138
|
+
it "sets the precludes parameter" do
|
139
|
+
result = subject.send(:break_apart_variation_details, "#{name} (precludes : #{precludes})")
|
140
|
+
expect(result[:name]).to eq name
|
141
|
+
expect(result[:precludes]).to eq Docks::Processors.split_on_characters(precludes, "\s\|")
|
142
|
+
|
143
|
+
expect_default_for_optionals_with_exclusions(result, :precludes)
|
144
|
+
end
|
145
|
+
|
146
|
+
it "sets the javascript_action parameter" do
|
147
|
+
result = subject.send(:break_apart_variation_details, "#{name} (javascript action : #{javascript_action})")
|
148
|
+
expect(result[:name]).to eq name
|
149
|
+
expect(result[:javascript_action]).to eq javascript_action
|
150
|
+
|
151
|
+
expect_default_for_optionals_with_exclusions(result, :javascript_action)
|
152
|
+
end
|
153
|
+
|
154
|
+
it "sets the set_by parameter" do
|
155
|
+
result = subject.send(:break_apart_variation_details, "#{name} (set by : #{set_by})")
|
156
|
+
expected_setters = Docks::Processors.split_on_top_level_parens_commas_and_pipes(set_by).map do |setter|
|
157
|
+
Docks::Processors.name_and_parenthetical(setter, :setter, :constant)
|
158
|
+
end
|
159
|
+
|
160
|
+
expect(result[:name]).to eq name
|
161
|
+
expect(result[:set_by]).to eq expected_setters
|
162
|
+
|
163
|
+
expect_default_for_optionals_with_exclusions(result, :set_by)
|
164
|
+
end
|
165
|
+
|
166
|
+
it "sets multiple parameters simultaneously" do
|
167
|
+
[
|
168
|
+
"#{name} ( #{demo_type}, activate_with : #{activate_with} , include_with: #{include_with} , precludes: #{precludes}, active : true, javascript action : #{javascript_action}, set by : #{set_by}) #{description}",
|
169
|
+
"#{name} (#{demo_type}, activate_with : #{activate_with} , include_with: #{include_with} , precludes: #{precludes}, active : true, javascript action : #{javascript_action}, set by : #{set_by} ) - #{description}"
|
170
|
+
].each do |str|
|
171
|
+
result = subject.send(:break_apart_variation_details, str)
|
172
|
+
expected_setters = Docks::Processors.split_on_top_level_parens_commas_and_pipes(set_by).map do |setter|
|
173
|
+
Docks::Processors.name_and_parenthetical(setter, :setter, :constant)
|
174
|
+
end
|
175
|
+
|
176
|
+
expect(result[:name]).to eq name
|
177
|
+
expect(result[:description]).to eq description
|
178
|
+
expect(result[:description]).to eq description
|
179
|
+
expect(result[:demo_type]).to eq demo_type
|
180
|
+
expect(result[:active]).to be true
|
181
|
+
expect(result[:javascript_action]).to eq javascript_action
|
182
|
+
[:include_with, :activate_with, :precludes].each do |param|
|
183
|
+
expect(result[param]).to eq Docks::Processors.split_on_characters(eval(param.to_s), "\s\|")
|
184
|
+
end
|
185
|
+
expect(result[:set_by]).to eq expected_setters
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
private
|
190
|
+
|
191
|
+
def expect_default_for_optionals_with_exclusions(result, *exclusions)
|
192
|
+
exclusions.each { |excl| @optional_state_params.delete(excl) }
|
193
|
+
|
194
|
+
@optional_state_params.each do |param|
|
195
|
+
expect(result[param]).to eq @default_state_hash[param]
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Docks::Tags::Static do
|
4
|
+
subject { Docks::Tags::Static.instance }
|
5
|
+
|
6
|
+
it "does not allow multiline content" do
|
7
|
+
expect(subject.multiline?).to be false
|
8
|
+
end
|
9
|
+
|
10
|
+
it "only allows one tag per block" do
|
11
|
+
expect(subject.multiple_allowed?).to be false
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#process" do
|
15
|
+
it "sets the class to be true when it exists at all" do
|
16
|
+
symbol = Docks::Containers::Symbol.new
|
17
|
+
|
18
|
+
symbol[subject.name] = ""
|
19
|
+
subject.process(symbol)
|
20
|
+
expect(symbol[subject.name]).to be true
|
21
|
+
|
22
|
+
symbol[subject.name] = "static"
|
23
|
+
subject.process(symbol)
|
24
|
+
expect(symbol[subject.name]).to be true
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Docks::Tags::Subcomponent do
|
4
|
+
subject { described_class.instance }
|
5
|
+
|
6
|
+
it "can't be be parsed from files" do
|
7
|
+
expect(subject.parseable?).to be false
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "#setup_post_processors" do
|
11
|
+
let(:component_container) { Docks::Containers::Component }
|
12
|
+
|
13
|
+
let(:pattern) { Docks::Containers::Pattern.new(name: "button") }
|
14
|
+
let(:component) { component_container.new(name: "button") }
|
15
|
+
let(:subcomponent_one) { component_container.new(name: "button__text") }
|
16
|
+
let(:subcomponent_two) { component_container.new(name: "button__text__icon") }
|
17
|
+
let(:orphan_subcomponent_one) { component_container.new(name: "tablist__tab") }
|
18
|
+
let(:orphan_subcomponent_two) { component_container.new(name: "tablist__panel-list__panel") }
|
19
|
+
|
20
|
+
it "leaves components as-is" do
|
21
|
+
pattern.add(:style, component)
|
22
|
+
Docks::Process.process(pattern)
|
23
|
+
expect(pattern.components.length).to be 1
|
24
|
+
expect(pattern.components.first).to be component
|
25
|
+
end
|
26
|
+
|
27
|
+
it "joins subcomponents to the base component" do
|
28
|
+
pattern.add(:style, [component, subcomponent_one, subcomponent_two])
|
29
|
+
Docks::Process.process(pattern)
|
30
|
+
expect(pattern.components.length).to be 1
|
31
|
+
|
32
|
+
component = pattern.components.first
|
33
|
+
expect(component).to be component
|
34
|
+
expect(component.subcomponents.length).to be 1
|
35
|
+
|
36
|
+
subcomponent = component.subcomponents.first
|
37
|
+
expect(subcomponent).to be subcomponent_one
|
38
|
+
expect(subcomponent.subcomponents.length).to be 1
|
39
|
+
expect(subcomponent.subcomponents.first).to be subcomponent_two
|
40
|
+
end
|
41
|
+
|
42
|
+
it "joins subcomponents before the base component to the base component" do
|
43
|
+
pattern.add(:style, [subcomponent_two, component, subcomponent_one])
|
44
|
+
Docks::Process.process(pattern)
|
45
|
+
expect(pattern.components.length).to be 1
|
46
|
+
|
47
|
+
component = pattern.components.first
|
48
|
+
expect(component).to be component
|
49
|
+
expect(component.subcomponents.length).to be 1
|
50
|
+
|
51
|
+
subcomponent = component.subcomponents.first
|
52
|
+
expect(subcomponent).to be subcomponent_one
|
53
|
+
expect(subcomponent.subcomponents.length).to be 1
|
54
|
+
expect(subcomponent.subcomponents.first).to be subcomponent_two
|
55
|
+
end
|
56
|
+
|
57
|
+
it "creates a new base component for orphaned subcomponents" do
|
58
|
+
pattern.add(:style, [orphan_subcomponent_one, orphan_subcomponent_two])
|
59
|
+
Docks::Process.process(pattern)
|
60
|
+
expect(pattern.components.length).to be 1
|
61
|
+
|
62
|
+
component = pattern.components.first
|
63
|
+
expect(component.name).to eq Docks.config.naming_convention.base_component(orphan_subcomponent_one.name)
|
64
|
+
|
65
|
+
subcomponents = component.subcomponents
|
66
|
+
expect(subcomponents.length).to be 2
|
67
|
+
expect(subcomponents).to include orphan_subcomponent_one
|
68
|
+
|
69
|
+
orphan_two_parent = subcomponents.find do |subcomponent|
|
70
|
+
subcomponent.name == Docks.config.naming_convention.parent_component(orphan_subcomponent_two.name)
|
71
|
+
end
|
72
|
+
|
73
|
+
expect(subcomponents).to include orphan_two_parent
|
74
|
+
expect(orphan_two_parent.subcomponents.length).to be 1
|
75
|
+
expect(orphan_two_parent.subcomponents).to include orphan_subcomponent_two
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Docks::Tags::Subtitle do
|
4
|
+
subject { Docks::Tags::Subtitle.instance }
|
5
|
+
|
6
|
+
it "does not allow multiline content" do
|
7
|
+
expect(subject.multiline?).to be false
|
8
|
+
end
|
9
|
+
|
10
|
+
it "only allows one tag per block" do
|
11
|
+
expect(subject.multiple_allowed?).to be false
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Docks::Tags::SymbolType do
|
4
|
+
subject { Docks::Tags::SymbolType.instance }
|
5
|
+
|
6
|
+
it "does not allow multiline content" do
|
7
|
+
expect(subject.multiline?).to be false
|
8
|
+
end
|
9
|
+
|
10
|
+
it "only allows one tag per block" do
|
11
|
+
expect(subject.multiple_allowed?).to be false
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#process" do
|
15
|
+
it "does not perform any processing" do
|
16
|
+
content = "foo"
|
17
|
+
expect(subject.process(content)).to eq content
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Docks::Tags::Throws do
|
4
|
+
subject { Docks::Tags::Throws.instance }
|
5
|
+
|
6
|
+
it "allows multiline content" do
|
7
|
+
expect(subject.multiline?).to be true
|
8
|
+
end
|
9
|
+
|
10
|
+
it "allows only multiple tags per block" do
|
11
|
+
expect(subject.multiple_allowed?).to be true
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#process" do
|
15
|
+
let(:symbol) { Docks::Containers::Symbol.new }
|
16
|
+
let(:types) { "{TypeError | NameError DocksError, Error}" }
|
17
|
+
let(:description) { "This is the description" }
|
18
|
+
|
19
|
+
it "splits apart types when no description is provided" do
|
20
|
+
expect(process_throws_with(types).types).to eq Docks::Processors.split_types(types)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "splits apart types when a description is provided" do
|
24
|
+
type_results = Docks::Processors.split_types(types)
|
25
|
+
expect(process_throws_with("#{types} #{description}").types).to eq type_results
|
26
|
+
expect(process_throws_with("#{types} - #{description}").types).to eq type_results
|
27
|
+
expect(process_throws_with("#{types} -#{description}").types).to eq type_results
|
28
|
+
expect(process_throws_with("#{types}- #{description}").types).to eq type_results
|
29
|
+
end
|
30
|
+
|
31
|
+
it "returns a nil description when no description is provided" do
|
32
|
+
expect(process_throws_with(types).description).to be nil
|
33
|
+
end
|
34
|
+
|
35
|
+
it "assigns a description when one is provided" do
|
36
|
+
target_description = Docks::Processors.join_with_smart_line_breaks(description)
|
37
|
+
expect(process_throws_with("#{types} #{description}").description).to eq target_description
|
38
|
+
expect(process_throws_with("#{types} - #{description}").description).to eq target_description
|
39
|
+
expect(process_throws_with("#{types} -#{description}").description).to eq target_description
|
40
|
+
expect(process_throws_with("#{types}- #{description}").description).to eq target_description
|
41
|
+
end
|
42
|
+
|
43
|
+
def process_throws_with(content)
|
44
|
+
symbol[subject.name] = content
|
45
|
+
subject.process(symbol)
|
46
|
+
symbol[subject.name].first
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Docks::Tags::Title do
|
4
|
+
subject { Docks::Tags::Title.instance }
|
5
|
+
|
6
|
+
it "does not allow multiline content" do
|
7
|
+
expect(subject.multiline?).to be false
|
8
|
+
end
|
9
|
+
|
10
|
+
it "only allows one tag per block" do
|
11
|
+
expect(subject.multiple_allowed?).to be false
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#process" do
|
15
|
+
it "does not perform any processing" do
|
16
|
+
content = "foo"
|
17
|
+
expect(subject.process(content)).to eq content
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|