Sha256: b4a72f65ac081927e8e54a5e8bb99c6076f17923fbae1fc23a394e91a2e4c11f
Contents?: true
Size: 1.27 KB
Versions: 3
Compression:
Stored size: 1.27 KB
Contents
$:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib') require 'test/unit' require 'glue' require 'nitro/compiler/elements' include Nitro $source = %{ <html> <?r a = 5 ?> Here is some text <body style="hidden" name="1"> Some more <Box color="#f00"> Hello World <Box color="#ff0"> <b>nice</b> <i>stuff</i> <Box color="#fff"> It works </Box> </Box> Text </Box> The End </body> </html> } $source2 = %{ <x:box color="#ff0"> xhtml mode </x:box> } $source3 = %{ <Page> <Box>Hello</Box> <Box>World</Box> <Bar>Foo</Bar> </Page> } class Page < Nitro::Element def render %~ <html id="2"> #{content} #{content :bar} </html> ~ end end class Box < Nitro::Element def open %|<div style="color: #@color">| end def close "</div>" end end class Bar < Nitro::Element def render %~ This is a great #{content}. ~ end end class TC_Element < Test::Unit::TestCase # :nodoc: all def test_all res = ElementProcessor.transform($source, nil) assert_match /div style/, res res = ElementProcessor.transform($source2, nil) assert_match /div style/, res res = ElementProcessor.transform($source3, nil) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
nitro-0.27.0 | test/nitro/tc_element.rb |
nitro-0.28.0 | test/nitro/tc_element.rb |
nitro-0.29.0 | test/nitro/tc_element.rb |