2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-11-03 12:29:30 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
RSpec.describe 'Projects > Files > User uses soft wrap while editing file', :js do
|
2016-11-03 12:29:30 +05:30
|
|
|
before do
|
2017-09-10 17:25:29 +05:30
|
|
|
project = create(:project, :repository)
|
2018-10-15 14:42:47 +05:30
|
|
|
user = project.owner
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in user
|
|
|
|
visit project_new_blob_path(project, 'master', file_name: 'test_file-name')
|
2020-07-28 23:09:34 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
page.within('.file-editor.code') do
|
2020-07-28 23:09:34 +05:30
|
|
|
find('.inputarea', visible: false).send_keys 'Touch water with paw then recoil in horror chase dog then
|
2018-03-17 18:26:18 +05:30
|
|
|
run away chase the pig around the house eat owner\'s food, and knock
|
|
|
|
dish off table head butt cant eat out of my own dish. Cat is love, cat
|
|
|
|
is life rub face on everything poop on grasses so meow. Playing with
|
|
|
|
balls of wool flee in terror at cucumber discovered on floor run in
|
|
|
|
circles tuxedo cats always looking dapper, but attack dog, run away
|
|
|
|
and pretend to be victim so all of a sudden cat goes crazy, yet chase
|
|
|
|
laser. Make muffins sit in window and stare ooo, a bird! yum lick yarn
|
|
|
|
hanging out of own butt jump off balcony, onto stranger\'s head yet
|
|
|
|
chase laser. Purr for no reason stare at ceiling hola te quiero.'.squish
|
|
|
|
end
|
2016-11-03 12:29:30 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
let(:toggle_button) { find('.soft-wrap-toggle') }
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
it 'user clicks the "Soft wrap" button and then "No wrap" button' do
|
2016-11-03 12:29:30 +05:30
|
|
|
wrapped_content_width = get_content_width
|
2020-07-28 23:09:34 +05:30
|
|
|
|
|
|
|
toggle_button.click do
|
|
|
|
expect(toggle_button).to have_content 'Soft wrap'
|
|
|
|
unwrapped_content_width = get_content_width
|
|
|
|
expect(unwrapped_content_width).to be > wrapped_content_width
|
|
|
|
end
|
|
|
|
|
|
|
|
toggle_button.click do
|
|
|
|
expect(toggle_button).to have_content 'No wrap'
|
|
|
|
expect(get_content_width).to be < unwrapped_content_width
|
|
|
|
end
|
2016-11-03 12:29:30 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def get_content_width
|
2020-07-28 23:09:34 +05:30
|
|
|
find('.view-lines', visible: false)[:style].slice!(/width: \d+/).slice!(/\d+/).to_i
|
2016-11-03 12:29:30 +05:30
|
|
|
end
|
|
|
|
end
|