Sha256: 43b6d4e9f46172c23eea38c9148ac086716ac34e10acc39bf680c1010836bc7b

Contents?: true

Size: 1.43 KB

Versions: 11

Compression:

Stored size: 1.43 KB

Contents

require 'spec_helper'

feature 'on grid cells', js: true do
  def go_to_user_view
    press('System')
    press('User Management')
    wait_for_ajax
  end

  def go_to_data_grid_view
    find(:xpath, "//a[contains(., 'Applications')]").click
    press('Data Grids')
    wait_for_ajax
  end

  let(:uv) { netzke_find('user_view') }

  before do
    Mcfly.whodunnit = Marty::User.find_by(login: 'marty')
  end

  it 'grid cells should encode html' do
    log_in_as('marty')
    go_to_user_view

    by 'add user with html in field' do
      wait_for_ajax
      press('New User')

      within(:gridpanel, 'add_window', match: :first) do
        fill_in('Login', with: 'extjs_test_login')
        fill_in('First Name', with: 'test_fname')
        fill_in('Last Name',
                with:
                "<b class='test class' onclick='alert()'>test text</b>"
               )
        press 'Ok'
      end
    end

    and_by 'check html rendering' do
      # negative test
      expect do
        find(:xpath, "//b[contains(@class, 'test class')]")
      end.to raise_error(Capybara::ElementNotFound)

      # positive test
      find('tr', text: 'extjs_test_login').should have_content(
        "<b class='test class' onclick='alert()'>test text</b>"
      )

      # positive test
      find(:xpath, "//td[contains(., 'test text')]").click
      go_to_data_grid_view
      expect(URI.parse(current_url).fragment).to eq 'data_grid_user_view'
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
marty-14.3.0 spec/features/extjs_spec.rb
marty-14.0.0 spec/features/extjs_spec.rb
marty-13.0.2 spec/features/extjs_spec.rb
marty-11.0.0 spec/features/extjs_spec.rb
marty-10.0.3 spec/features/extjs_spec.rb
marty-10.0.2 spec/features/extjs_spec.rb
marty-10.0.0 spec/features/extjs_spec.rb
marty-9.5.1 spec/features/extjs_spec.rb
marty-9.5.0 spec/features/extjs_spec.rb
marty-9.3.3 spec/features/extjs_spec.rb
marty-9.3.2 spec/features/extjs_spec.rb