Sha256: 82ce561533427fc7ae281f9c121aa5142b86d1b8358973e51d95ed40183690e9

Contents?: true

Size: 843 Bytes

Versions: 3

Compression:

Stored size: 843 Bytes

Contents

describe "Element#toggle" do
  
  before(:all) do
    elem = Element.new :div, :id => "element_toggle_spec"
  
    elem.html = [
      "<div id='testing_toggle_hidden' style='display: none;'></div>",
      "<div id='testing_toggle_visible'></div>"
    ].join("")
    
    Document.body << elem
  end
  
  it "should show elements that are currently hidden" do
    Document[:testing_toggle_hidden].toggle
    Document[:testing_toggle_hidden].visible?.should == true
    Document[:testing_toggle_hidden].hidden?.should == false
  end
  
  it "should hide elements that are currently visible" do
    Document[:testing_toggle_visible].toggle
    Document[:testing_toggle_visible].visible?.should == false
    Document[:testing_toggle_visible].hidden?.should == true
  end
  
  after :all do
    Document[:element_toggle_spec].remove
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
opal-0.2.2 opals/opal/browser/spec/element/toggle_spec.rb
opal-0.2.0 opals/opal/browser/spec/element/toggle_spec.rb
opal-0.1.0 opals/browser/spec/element/toggle_spec.rb