Skip to content
Permalink
Browse files

Make sure that +all+ returns namespaced components (#160)

* Make sure that +all+ returns namespaced components
* Create two new fixture components for more path tests

Co-authored-by: Nicolas Brousse <nicolas-brousse@users.noreply.github.com>
  • Loading branch information
apauly and nicolas-brousse committed Jan 20, 2020
1 parent 9f9d5f1 commit d1ae3df717caa3984939dfc829e688b00f715d44
@@ -74,6 +74,7 @@ Feature: Component generator
import 'components/all/all';
import 'components/bar/bar';
import 'components/foo_bar/foo_bar';
import 'components/genius_button/genius_button';
import 'components/namespaced';
import 'components/required/required';
import 'components/world/world';
@@ -83,6 +84,7 @@ Feature: Component generator
import 'components/all/all';
import 'components/bar/bar';
import 'components/foo_bar/foo_bar';
import 'components/genius_button/genius_button';
import 'components/namespaced';
import 'components/required/required';
import 'components/world/world';
@@ -94,6 +96,7 @@ Feature: Component generator
import 'components/all/all';
import 'components/bar/bar';
import 'components/foo_bar/foo_bar';
import 'components/genius_button/genius_button';
import 'components/namespaced';
import 'components/required/required';
import 'components/world/world';
@@ -108,6 +111,7 @@ Feature: Component generator
import "components/all/all";
import "components/bar/bar";
import "components/foo_bar/foo_bar";
import "components/genius_button/genius_button";
import "components/namespaced";
import "components/partial";
import "components/required/required";
@@ -0,0 +1 @@
<div class="genius-button"><%= properties.values.join(' ') %></div>
@@ -0,0 +1 @@
import "./genius_button.scss";
@@ -0,0 +1 @@
.genius-button {}
@@ -0,0 +1,3 @@
module GeniusButtonComponent
extend ComponentHelper
end
@@ -1,6 +1,7 @@
import "components/all/all";
import "components/bar/bar";
import "components/foo_bar/foo_bar";
import "components/genius_button/genius_button";
import "components/namespaced";
import "components/partial";
import "components/required/required";
@@ -1 +1,2 @@
import "components/partial/universe/partial_universe";
import "components/partial/universe_button/partial_universe_button";
@@ -0,0 +1 @@
<div class="partial-universe-button">A button</div>
@@ -0,0 +1 @@
.partial-universe-button {}
@@ -0,0 +1 @@
import "./partial_universe_button.css";
@@ -0,0 +1,5 @@
# frozen_string_literal: true

module PartialUniverseButtonComponent
extend ComponentHelper
end
@@ -14,7 +14,7 @@ def all
component_path = Pathname.new(component_dir).relative_path_from(components_root).to_s

next unless File.exist?(components_root.join(component_path)
.join("#{File.basename(component_path)}_component.rb"))
.join("#{component_path.underscore.gsub('/', '_')}_component.rb"))

components[component_path] = Component.new(component_path)
end
@@ -7,7 +7,7 @@ def test_all_returns_components
all = Komponent::Component.all

assert all.is_a?(Hash)
assert_equal all.count, 9
assert_equal all.count, 13
assert all["foo"].is_a?(Komponent::Component)
end

@@ -85,7 +85,11 @@ def test_helper_lists_components
'bar',
'foo',
'foo_bar',
'genius_button',
'hello',
'namespaced/button',
'partial/universe',
'partial/universe_button',
'ping',
'pong',
'required',

0 comments on commit d1ae3df

Please sign in to comment.
You can’t perform that action at this time.