Sha256: 29d55d127d4bac4f1ee882f84d296451ce2481c4bcc077cf0aaead0a6ea6e25e

Contents?: true

Size: 1.4 KB

Versions: 1

Compression:

Stored size: 1.4 KB

Contents

When /^I close a tab for node "([^"]*)"$/ do |path|
  tab_id = Capybara.current_session.evaluate_script <<-JS
    Rwiki.tabPanel.findTabByPagePath('#{path}').tabEl.id;
  JS

  close_button = find("li##{tab_id} a.x-tab-strip-close")
  # TODO try fix this workaround see http://groups.google.com/group/ruby-capybara/browse_thread/thread/985b123dc98d27b5
  close_button.click rescue nil
end

# TODO rename this step
When /^I click a tab for page "([^"]*)"$/ do |path|
  tab_id = Capybara.current_session.evaluate_script <<-JS
    Rwiki.tabPanel.findTabByPagePath('#{path}').tabEl.id;
  JS

  tab = find("li##{tab_id}")
  tab.click
end

Then /^I should see active tab titled "([^"]*)"$/ do |title|
  page.find('li.x-tab-strip-active').text.should == title
end

Then /^I should have the following open tabs:$/ do |table|
  actual_table = table(tableish("div.x-tab-panel ul li[@class!='x-tab-edge']", "a.x-tab-right"))
  table.diff!(actual_table)
end

Then /^I should have no open tabs$/ do
  page.all("div.x-tab-panel ul li[class!='x-tab-edge']").size.should == 0
end

# TODO rename this scenario
When /^I right click the tab with path "([^"]*)"$/ do |path|
  Capybara.current_session.execute_script <<-JS
    var tab = Rwiki.tabPanel.findTabByPagePath('#{path}');
    var eventStub = { stopEvent: function() {}, getPoint: function() { return [0, 0] } };
    Rwiki.tabPanel.fireEvent('contextmenu', Rwiki.tabPanel, tab, eventStub)
  JS
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rwiki-0.2.5 features/step_definitions/tab_panel_steps.rb