<commit_before>require 'spec_helper'
require 'debugger'


describe "organizations/_form.html.erb" do

  it "renders form partial even for empty Organization" do
    @organization = Organization.new
    render
  end

  it "renders the form with placeholders" do
    @organization = Organization.new

    render

    hash = {
            'organization_name' => 'Enter organisation name',
            'organization_address'  => 'Enter organisation address',
            'organization_postcode' => 'Enter organisation post code',
            'organization_email' => 'Enter organisation email address',
            'organization_description' => 'Enter organisation description',
            'organization_website' => 'Enter organisation website url',
            'organization_telephone' => 'Enter organisation phone number',
            'organization_admin_email_to_add' => "Enter optional additional organisation administrator email",
            'organization_donation_info' => 'Enter organisation donation url'
    }
    hash.each do |label,placeholder|
      debugger
      expect(rendered).to have_xpath("(//td/input|//td/textarea)[@id='#{label}'][@placeholder='#{placeholder}']")
      #expect(rendered).to have_xpath("//td/input[@id='#{label}'][@placeholder='#{placeholder}']")
    end
  end

  it "allows placeholder to be overwritten" do
    @organization = Organization.new({:email => "<EMAIL>"})
    render
    expect(rendered).to have_xpath("//td/input[@id='organization_email'][@value='<EMAIL>']")
  end

end<commit_msg>take out test for placeholder disappearing beacuse it is done by html and move some things into before block<commit_after>require 'spec_helper'
require 'debugger'


describe "organizations/_form.html.erb" do
  before :each do
    @organization = Organization.new
    render
  end
  it "renders form partial even for empty Organization" do
    expect(rendered).not_to be_nil
  end

  it "renders the form with placeholders" do

    hash = {
            'organization_name' => 'Enter organisation name',
            'organization_address'  => 'Enter organisation address',
            'organization_postcode' => 'Enter organisation post code',
            'organization_email' => 'Enter organisation email address',
            'organization_description' => 'Enter organisation description',
            'organization_website' => 'Enter organisation website url',
            'organization_telephone' => 'Enter organisation phone number',
            'organization_admin_email_to_add' => "Enter optional additional organisation administrator email",
            'organization_donation_info' => 'Enter organisation donation url'
    }
    hash.each do |label,placeholder|
      expect(rendered).to have_xpath("(//td/input|//td/textarea)[@id='#{label}'][@placeholder='#{placeholder}']")
    end
  end

end
{'fraction_non_alphanumeric': 0.11307420494699646, 'fraction_numerical': 0.0, 'mean_word_length': 3.5809061488673137, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 24, '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': '6532386', 'n_tokens_mistral': 763, 'n_tokens_neox': 717, 'n_words': 203}