Sha256: d0c83512f457099b8da52ce7ee46b5ba7ddde428c9e6a552595e2c0cfc8876b7

Contents?: true

Size: 926 Bytes

Versions: 1

Compression:

Stored size: 926 Bytes

Contents

require 'jquery'
require 'opal-spec'
require 'opal-jquery'

module OpalSpec
  class ExampleGroup

    # Add some html code to the body tag ready for testing. This will
    # be added before each test, then removed after each test. It is
    # convenient for adding html setup quickly. The code is wrapped
    # inside a div, which is directly inside the body element.
    #
    #     describe "DOM feature" do
    #       html <<-HTML
    #         <div id="foo"></div>
    #       HTML
    #
    #       it "foo should exist" do
    #         Document["#foo"]
    #       end
    #     end
    #
    # @param [String] html_string html content to add
    def html(html_string='')
      html = '<div id="opal-jquery-test-div">' + html_string + '</div>'
      before do
        @__html = Document.parse(html)
        @__html.append_to_body
      end

      after { @__html.remove }
    end
  end
end

Opal::Spec::Runner.autorun

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opal-jquery-0.0.5 spec/spec_helper.rb