Sha256: 3816a3b7b3da31f25c7881ba81a9db58c7005fe3b397fa920af32623254fb66d

Contents?: true

Size: 1.77 KB

Versions: 1

Compression:

Stored size: 1.77 KB

Contents

Given /^there is an edit tab containing "([^\"]*)"$/ do |contents|
  contents = eval(contents.inspect.gsub("\\\\", "\\"))
  tab = Redcar::Top::NewCommand.new.run
  cursor_offset = (contents =~ /<c>/)
  contents = contents.gsub("<c>", "")
  tab.edit_view.document.text = contents
  if cursor_offset
    tab.edit_view.document.cursor_offset = cursor_offset
  end
end

When /^I open a new edit tab$/ do 
  Redcar::Top::NewCommand.new.run
end

When /^I close the focussed tab$/ do
  Redcar::Top::CloseTabCommand.new.run
end

When /^I replace the contents with "([^\"]*)"$/ do |arg1|
  win = Redcar.app.windows.first
  tab = win.focussed_notebook.focussed_tab
  tab.edit_view.document.text = arg1
end

Then /^there should be one (.*) tab$/ do |tab_type|
  # in the model
  tabs = Redcar.app.windows.first.notebooks.map {|nb| nb.tabs }.flatten
  tabs.length.should == 1
  
  # in the GUI
  case tab_type
  when "edit"
    tab_class = Redcar::EditTab
  end
  
  tabs = get_tabs
  tabs.length.should == 1
end

Then /^the edit tab should have the focus$/ do
  tabs = get_tabs
  edit_tabs = tabs.select {|t| t.is_a?(Redcar::EditTab)}
  edit_tabs.length.should == 1
  edit_tabs.first.controller.edit_view.mate_text.get_text_widget.is_focus_control?.should be_true
end

Then /^there should be no open tabs$/ do 
  get_tab_folder.getItems.to_a.length.should == 0
end

Then /^the tab should be focussed within the notebook$/ do
  tab_folder = get_tab_folder
  tab_folder.get_selection.should == tab_folder.getItems.to_a.first
end

Then /^the tab should have the keyboard focus$/ do
  tab = get_tab(get_tab_folder)
  tab.controller.edit_view.has_focus?.should be_true
end

Then /^I should see "(.*)" in the edit tab$/ do |content|
  tab = get_tab(get_tab_folder)
  tab.edit_view.document.to_s.include?(content).should be_true
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
redcar-0.3.0dev plugins/edit_view/features/step_definitions/tab_steps.rb