Sha256: 01d49569fe874bba42ffd33dd3bf2ba8e4c14f04954b071f55a0a6e6c3e18bef

Contents?: true

Size: 1.07 KB

Versions: 6

Compression:

Stored size: 1.07 KB

Contents

describe "HTML :on" do

  it "escapes text as :html" do
    target :script, <<-EOF
      WWW_App.compile(
        ["create_event",["div","click","add_class",["red&lt;red"]]]
      );
    EOF

    actual do
      div {
        on(:click) { add_class "red<red" }
      }
    end
  end

  it "renders js" do
    target :script, <<-EOF
      WWW_App.compile(
        #{
          Escape_Escape_Escape.json_encode( ["create_event", [ "#my_box", "click", "add_class", ["hello"] ] ] )
        }
      );
    EOF

    actual {
      div.*(:my_box) {
        on(:click) { add_class :hello }
      }
    }
  end

  it "adds class to id of element: #id.class" do
    target :style, %^
      #me.highlight {
        border-color: #fff;
      }
    ^

    actual do
      div.*(:me) {
        on(:highlight) { border_color '#fff' }
      }
    end
  end

  it "adds a psuedo class if passed a String" do
    target :style, <<-EOF
      a:hover {
        border: 12px;
      }
    EOF

    actual {
      a.href('/home') {
        on(':hover') { border '12px' }
      }
    }
  end

end # === describe


Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
www_app-1.3.0 specs/server-side/0050-on.rb
www_app-1.2.1 specs/server-side/0050-on.rb
www_app-1.2.0 specs/server-side/0050-on.rb
www_app-1.1.0 specs/server-side/0050-on.rb
www_app-1.0.1 specs/as_ruby/0050-on.rb
www_app-1.0.0 specs/as_ruby/0050-on.rb