<commit_before># encoding: utf-8
require File.dirname(__FILE__) + '/spec_helper'

describe "H1s", "H2s", "H3s", "H4s", "H5s", "H6s" do

  before :each do
    browser.goto(WatirSpec.files + "/non_control_elements.html")
  end

  describe "#length" do
    it "returns the number of h1s" do
      browser.h2s.length.should == 9
    end
  end

  describe "#[]" do
    it "returns the h1 at the given index" do
      browser.h1s[1].id.should == "first_header"
    end
  end

  describe "#each" do
    it "iterates through header collections correctly" do
      lengths = (1..6).collect do |i|
        collection = browser.send(:"h#{i}s")
        collection.each_with_index do |h, index|
          h.name.should == browser.send(:"h#{i}", :index, index+1).name
          h.id.should == browser.send(:"h#{i}", :index, index+1).id
          h.value.should == browser.send(:"h#{i}", :index, index+1).value
        end
        collection.length
      end
      lengths.should == [2, 9, 2, 1, 1, 2]
    end
  end

end<commit_msg>Add guard for WTR-345<commit_after># encoding: utf-8
require File.dirname(__FILE__) + '/spec_helper'

bug "WTR-345", :watir do

  describe "H1s", "H2s", "H3s", "H4s", "H5s", "H6s" do
    before :each do
      browser.goto(WatirSpec.files + "/non_control_elements.html")
    end

    describe "#length" do
      it "returns the number of h1s" do
        browser.h2s.length.should == 9
      end
    end

    describe "#[]" do
      it "returns the h1 at the given index" do
        browser.h1s[1].id.should == "first_header"
      end
    end

    describe "#each" do
      it "iterates through header collections correctly" do
        lengths = (1..6).collect do |i|
          collection = browser.send(:"h#{i}s")
          collection.each_with_index do |h, index|
            h.name.should == browser.send(:"h#{i}", :index, index+1).name
            h.id.should == browser.send(:"h#{i}", :index, index+1).id
            h.value.should == browser.send(:"h#{i}", :index, index+1).value
          end
          collection.length
        end
        lengths.should == [2, 9, 2, 1, 1, 2]
      end
    end
  end

end
{'fraction_non_alphanumeric': 0.1512447158290277, 'fraction_numerical': 0.025364020666979802, 'mean_word_length': 2.408, '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': '4838160', 'n_tokens_mistral': 759, 'n_tokens_neox': 742, 'n_words': 195}