Sha256: df4ede7b77227eb9e66b22f2266adb577f930839309572751b785555282a7db4

Contents?: true

Size: 848 Bytes

Versions: 2

Compression:

Stored size: 848 Bytes

Contents

describe Hamlit::Engine do
  describe 'text' do
    it 'renders string interpolation' do
      assert_render(<<-'HAML', <<-HTML)
        #{ "a#{3}a" }a" #{["1", 2]} b " !
        a#{{ a: 3 }}
        <ht#{2}ml>
      HAML
        a3aa" ["1", 2] b " !
        a{:a=>3}
        <ht2ml>
      HTML
    end

    it 'renders . or # which is not continued by tag name' do
      assert_render(<<-HAML, <<-HTML)
        .
        .*
        #
        #+
      HAML
        .
        .*
        #
        #+
      HTML
    end

    it 'escapes all operators by backslash' do
      assert_render(<<-'HAML', <<-HTML)
        = 'a'
        -
        \= 'a'
        \-
      HAML
        a
        = 'a'
        -
      HTML
    end

    it 'leaves empty spaces after backslash' do
      expect(render_string('\       a')).to eq("       a\n")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hamlit-1.3.2 spec/hamlit/engine/text_spec.rb
hamlit-1.3.1 spec/hamlit/engine/text_spec.rb