Sha256: 7ddcb8d32ed38c27a4b06e66667e6fc2a38d046918d10ef7d9a1451488271e25

Contents?: true

Size: 910 Bytes

Versions: 7

Compression:

Stored size: 910 Bytes

Contents

require "spec_helper"

RSpec.describe "Element display methods" do
  html <<-HTML
    <div id="shown"></div>
    <div id="hidden" style="display: none"></div>
  HTML

  it "hides an element" do
    element = Element.find('#shown')
    element.css('display').should == 'block'
    element.hide
    element.css('display').should == 'none'
  end

  it "shows an element" do
    element = Element.find('#hidden')
    element.css('display').should == 'none'
    element.show
    element.css('display').should == 'block'
  end

  it "toggles on a hidden element" do
    element = Element.find('#hidden')
    element.css('display').should == 'none'
    element.toggle
    element.css('display').should == 'block'
  end

  it "toggles off a displayed element" do
    element = Element.find('#shown')
    element.css('display').should == 'block'
    element.toggle
    element.css('display').should == 'none'
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
opal-jquery-0.5.2 spec-opal/element/display_spec.rb
opal-jquery-0.5.1 spec-opal/element/display_spec.rb
opal-jquery-0.5.0 spec-opal/element/display_spec.rb
opal-jquery-0.4.6 spec-opal/element/display_spec.rb
opal-jquery-0.4.5 spec-opal/element/display_spec.rb
opal-jquery-0.4.4 spec-opal/element/display_spec.rb
opal-jquery-0.4.3 spec-opal/element/display_spec.rb