From ecc66cafb9485e3b55e9ed83c226279b417225d4 Mon Sep 17 00:00:00 2001 From: Andreas Alin Date: Fri, 19 Apr 2024 13:57:59 -0500 Subject: [PATCH] Fix filenames in haml transformer tests --- .../transformers/__test__/haml/basic.rb | 4 ++-- .../transformers/__test__/haml/case.rb | 4 ++-- .../transformers/__test__/haml/class_names.rb | 4 ++-- .../transformers/__test__/haml/comments.rb | 4 ++-- .../transformers/__test__/haml/context.rb | 4 ++-- .../loaders/transformers/__test__/haml/css.rb | 23 ++++++++++++------- .../transformers/__test__/haml/dashes.rb | 4 ++-- .../__test__/haml/early_return.rb | 4 ++-- .../__test__/haml/early_return2.rb | 4 ++-- .../transformers/__test__/haml/handlers.rb | 4 ++-- .../transformers/__test__/haml/if_else.rb | 4 ++-- .../__test__/haml/interpolation.rb | 4 ++-- .../__test__/haml/multiple_ruby_filters.rb | 20 ++++++++++------ .../__test__/haml/object_ref_as_key.rb | 4 ++-- .../transformers/__test__/haml/plain.rb | 4 ++-- .../transformers/__test__/haml/props.rb | 4 ++-- .../transformers/__test__/haml/slots.rb | 4 ++-- .../__test__/haml/slots_dynamic.rb | 4 ++-- .../__test__/haml/slots_fallback.rb | 4 ++-- .../transformers/__test__/haml/spacing.rb | 4 ++-- .../transformers/__test__/haml/spacing2.rb | 4 ++-- .../transformers/__test__/haml/spacing3.rb | 4 ++-- .../transformers/__test__/haml/state.rb | 4 ++-- .../transformers/__test__/haml/stylesheets.rb | 23 ++++++++++++------- .../__test__/haml/whitespace_preservation.rb | 4 ++-- lib/mayu/modules/loaders/transformers/css.rb | 2 +- .../modules/loaders/transformers/haml.test.rb | 4 ++-- 27 files changed, 90 insertions(+), 70 deletions(-) diff --git a/lib/mayu/modules/loaders/transformers/__test__/haml/basic.rb b/lib/mayu/modules/loaders/transformers/__test__/haml/basic.rb index f5b6e556..ce1f841e 100644 --- a/lib/mayu/modules/loaders/transformers/__test__/haml/basic.rb +++ b/lib/mayu/modules/loaders/transformers/__test__/haml/basic.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Test < Mayu::Component::Base +class Basic < Mayu::Component::Base def self.module_path __FILE__ end @@ -10,5 +10,5 @@ def self.module_path H[:p, "Hello world", **self.class.merge_props({ class: :__p })] end end -Default = Test +Default = Basic Default::Styles.each { add_asset(Assets::Asset.build(_1.filename, _1.content)) } diff --git a/lib/mayu/modules/loaders/transformers/__test__/haml/case.rb b/lib/mayu/modules/loaders/transformers/__test__/haml/case.rb index 16c3502f..6f4b4806 100644 --- a/lib/mayu/modules/loaders/transformers/__test__/haml/case.rb +++ b/lib/mayu/modules/loaders/transformers/__test__/haml/case.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Test < Mayu::Component::Base +class Case < Mayu::Component::Base def self.module_path __FILE__ end @@ -21,5 +21,5 @@ def self.module_path ] end end -Default = Test +Default = Case Default::Styles.each { add_asset(Assets::Asset.build(_1.filename, _1.content)) } diff --git a/lib/mayu/modules/loaders/transformers/__test__/haml/class_names.rb b/lib/mayu/modules/loaders/transformers/__test__/haml/class_names.rb index acff66b7..dc60efad 100644 --- a/lib/mayu/modules/loaders/transformers/__test__/haml/class_names.rb +++ b/lib/mayu/modules/loaders/transformers/__test__/haml/class_names.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Test < Mayu::Component::Base +class Class_names < Mayu::Component::Base def self.module_path __FILE__ end @@ -46,5 +46,5 @@ def self.module_path ] end end -Default = Test +Default = Class_names Default::Styles.each { add_asset(Assets::Asset.build(_1.filename, _1.content)) } diff --git a/lib/mayu/modules/loaders/transformers/__test__/haml/comments.rb b/lib/mayu/modules/loaders/transformers/__test__/haml/comments.rb index a140cdaa..a3675225 100644 --- a/lib/mayu/modules/loaders/transformers/__test__/haml/comments.rb +++ b/lib/mayu/modules/loaders/transformers/__test__/haml/comments.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Test < Mayu::Component::Base +class Comments < Mayu::Component::Base def self.module_path __FILE__ end @@ -15,5 +15,5 @@ def self.module_path ] end end -Default = Test +Default = Comments Default::Styles.each { add_asset(Assets::Asset.build(_1.filename, _1.content)) } diff --git a/lib/mayu/modules/loaders/transformers/__test__/haml/context.rb b/lib/mayu/modules/loaders/transformers/__test__/haml/context.rb index cb05c66b..52139ace 100644 --- a/lib/mayu/modules/loaders/transformers/__test__/haml/context.rb +++ b/lib/mayu/modules/loaders/transformers/__test__/haml/context.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Test < Mayu::Component::Base +class Context < Mayu::Component::Base def self.module_path __FILE__ end @@ -27,5 +27,5 @@ def increase_context_var ] end end -Default = Test +Default = Context Default::Styles.each { add_asset(Assets::Asset.build(_1.filename, _1.content)) } diff --git a/lib/mayu/modules/loaders/transformers/__test__/haml/css.rb b/lib/mayu/modules/loaders/transformers/__test__/haml/css.rb index 663ce2c5..d9efb0cf 100644 --- a/lib/mayu/modules/loaders/transformers/__test__/haml/css.rb +++ b/lib/mayu/modules/loaders/transformers/__test__/haml/css.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Test < Mayu::Component::Base +class Css < Mayu::Component::Base def self.module_path __FILE__ end @@ -7,16 +7,23 @@ def self.module_path FILENAME = __FILE__ Styles = Mayu::StyleSheet[ - source_filename: "/app/components/Test.haml (inline css)", - content_hash: "II_m4Tqejb8BcNpaXciICXJBLLft4dvCnYoTLEm_hcc", + source_filename: + "/Users/andreas/Projects/mayu-live/framework/lib/mayu/modules/loaders/transformers/__test__/haml/css.haml (inline css)", + content_hash: "5HZABHNkuR2dxz9RlgC0DfKE8pZseYPLg7US5JUy22s", classes: { - button: "/app/components/Test.button?Trf1Txj1", - "button-text": "/app/components/Test.button-text?Trf1Txj1" + button: + "/Users/andreas/Projects/mayu-live/framework/lib/mayu/modules/loaders/transformers/__test__/haml/css.button?Trf1Txj1", + "button-text": + "/Users/andreas/Projects/mayu-live/framework/lib/mayu/modules/loaders/transformers/__test__/haml/css.button-text?Trf1Txj1" }, content: <Bar\nBaz" end end -Default = Test +Default = Whitespace_preservation Default::Styles.each { add_asset(Assets::Asset.build(_1.filename, _1.content)) } diff --git a/lib/mayu/modules/loaders/transformers/css.rb b/lib/mayu/modules/loaders/transformers/css.rb index b8698409..46d4f2da 100644 --- a/lib/mayu/modules/loaders/transformers/css.rb +++ b/lib/mayu/modules/loaders/transformers/css.rb @@ -22,7 +22,7 @@ def self.transform(source_path, source) .then do new(source_path, _1).build_inline_ast(assign_default: true) end - .then { SyntaxTree::Formatter.format("", _1) } + .then { SyntaxTree::Formatter.format("", _1).rstrip + "\n" } end def self.transform_inline(source_path, source, **options) diff --git a/lib/mayu/modules/loaders/transformers/haml.test.rb b/lib/mayu/modules/loaders/transformers/haml.test.rb index 6aa5a790..127b1501 100755 --- a/lib/mayu/modules/loaders/transformers/haml.test.rb +++ b/lib/mayu/modules/loaders/transformers/haml.test.rb @@ -15,13 +15,13 @@ class Mayu::Modules::Loaders::Transformers::Haml::Test < Minitest::Test .then do Mayu::Modules::Loaders::Transformers::Haml.transform( _1, - "/app/components/Test.haml", + haml ).output end .then do Mayu::Modules::Loaders::Transformers::Ruby.transform( _1, - "/app/components/Test.haml", + haml, component_base_class: "Mayu::Component::Base" ) end