<commit_before># encoding: utf-8
require File.expand_path('../watirspec_helper', __FILE__)

# spatial navigation
# ---------------
describe 'Spatnav' do

  before :each do
    browser.url = fixture('grid.html')
  end

  describe '#up' do
    it 'selects the correct links when navigating up' do
      browser.spatnav.up
      window.eval_js("document.activeElement.text;").to_s.should == 'C1'
      browser.spatnav.up
      window.eval_js("document.activeElement.text;").to_s.should == 'C2'
      browser.spatnav.up
      window.eval_js("document.activeElement.text;").to_s.should == 'C3'
    end
  end

  describe '#down' do
    it 'selects the correct links when navigating down' do
      browser.spatnav.down
      window.eval_js("document.activeElement.text;").to_s.should == 'C3'
      browser.spatnav.down
      window.eval_js("document.activeElement.text;").to_s.should == 'C2'
      browser.spatnav.down
      window.eval_js("document.activeElement.text;").to_s.should == 'C1'
    end
  end

  describe '#left' do
    it 'selects the correct links when navigating left' do
      browser.spatnav.left
      window.eval_js("document.activeElement.text;").to_s.should == 'C1'
      browser.spatnav.left
      window.eval_js("document.activeElement.text;").to_s.should == 'B1'
      browser.spatnav.left
      window.eval_js("document.activeElement.text;").to_s.should == 'A1'
    end
  end

  describe '#right' do
    it 'selects the correct links when navigating right' do
      browser.spatnav.right
      window.eval_js("document.activeElement.text;").to_s.should == 'A1'
      browser.spatnav.right
      window.eval_js("document.activeElement.text;").to_s.should == 'B1'
      browser.spatnav.right
      window.eval_js("document.activeElement.text;").to_s.should == 'C1'
    end
  end

  describe '#activate!' do
    it 'activates the focused link' do
      browser.spatnav.down
		browser.spatnav.activate!
		window.url.should include 'C3'
    end
  end


end<commit_msg>activate! → activate, eval_js → execute.script<commit_after>require File.expand_path('../watirspec_helper', __FILE__)

describe 'Spatnav' do

  before :each do
    browser.url = fixture('grid.html')
  end

  describe '#up' do
    it 'selects the correct links when navigating up' do
      browser.spatnav.up
      window.execute_script("document.activeElement.text;").to_s.should == 'C1'
      browser.spatnav.up
      window.execute_script("document.activeElement.text;").to_s.should == 'C2'
      browser.spatnav.up
      window.execute_script("document.activeElement.text;").to_s.should == 'C3'
    end
  end

  describe '#down' do
    it 'selects the correct links when navigating down' do
      browser.spatnav.down
      window.execute_script("document.activeElement.text;").to_s.should == 'C3'
      browser.spatnav.down
      window.execute_script("document.activeElement.text;").to_s.should == 'C2'
      browser.spatnav.down
      window.execute_script("document.activeElement.text;").to_s.should == 'C1'
    end
  end

  describe '#left' do
    it 'selects the correct links when navigating left' do
      browser.spatnav.left
      window.execute_script("document.activeElement.text;").to_s.should == 'C1'
      browser.spatnav.left
      window.execute_script("document.activeElement.text;").to_s.should == 'B1'
      browser.spatnav.left
      window.execute_script("document.activeElement.text;").to_s.should == 'A1'
    end
  end

  describe '#right' do
    it 'selects the correct links when navigating right' do
      browser.spatnav.right
      window.execute_script("document.activeElement.text;").to_s.should == 'A1'
      browser.spatnav.right
      window.execute_script("document.activeElement.text;").to_s.should == 'B1'
      browser.spatnav.right
      window.execute_script("document.activeElement.text;").to_s.should == 'C1'
    end
  end

  describe '#activate!' do
    it 'activates the focused link' do
      browser.spatnav.down
		browser.spatnav.activate
		window.url.should include 'C3'
    end
  end


end
{'fraction_non_alphanumeric': 0.1297539149888143, 'fraction_numerical': 0.006711409395973154, 'mean_word_length': 3.231335436382755, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4463080', 'n_tokens_mistral': 1337, 'n_tokens_neox': 1306, 'n_words': 251}