Sha256: 7c0ff6d71c9e8c57e3b2acf55d73483c09c4877ae7f56d732fb9996271f4a475
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
require 'test_helper' class BaseTest < ActiveSupport::TestCase class NoLogic < ExpressTemplates::Components::Base has_markup -> { h1 { span "Some stuff" } } end test ".has_markup makes compile return the block passed through express compiled" do assert_equal %Q("<h1><span>Some stuff</span></h1>"), NoLogic.new.compile end test "components register themselves as macros" do assert ExpressTemplates::Expander.instance_methods.include?(:no_logic) end class Context def initialize ; @foo = ['bar', 'baz'] ; end end test "fragments and has_markup are synonyms for emits" do assert_equal NoLogic.method(:emits), NoLogic.method(:fragments) assert_equal NoLogic.method(:emits), NoLogic.method(:has_markup) end class Helpers < ECB helper :title_helper, &-> { @foo.first } emits -> { h1 { title_helper } } end test "helpers defined in component are evaluated in context" do compiled = Helpers.new.compile assert_equal "<h1>bar</h1>", Context.new.instance_eval(compiled) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
express_templates-0.3.0 | test/components/base_test.rb |