|
|
|
@ -1,4 +1,4 @@ |
|
|
|
|
shared_examples 'an accessible inplace editor' do |
|
|
|
|
shared_examples 'as an accessible inplace editor' do |
|
|
|
|
it 'triggers edit mode on click' do |
|
|
|
|
scroll_to_element(field.display_element) |
|
|
|
|
field.activate_edition |
|
|
|
@ -23,9 +23,9 @@ shared_examples 'an accessible inplace editor' do |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
shared_examples 'an auth aware field' do |
|
|
|
|
shared_examples 'as an auth aware field' do |
|
|
|
|
context 'when is editable' do |
|
|
|
|
it_behaves_like 'an accessible inplace editor' |
|
|
|
|
it_behaves_like 'as an accessible inplace editor' |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context 'when user is authorized' do |
|
|
|
@ -52,7 +52,7 @@ shared_examples 'an auth aware field' do |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
shared_context 'having a single validation point' do |
|
|
|
|
shared_context 'as a single validation point' do |
|
|
|
|
let(:other_field) { EditField.new page, :type } |
|
|
|
|
before do |
|
|
|
|
other_field.activate_edition |
|
|
|
@ -67,7 +67,7 @@ shared_context 'having a single validation point' do |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
shared_context 'a required field' do |
|
|
|
|
shared_context 'as a required field' do |
|
|
|
|
before do |
|
|
|
|
field.activate_edition |
|
|
|
|
field.input_element.set '' |
|
|
|
@ -86,11 +86,11 @@ shared_examples 'a cancellable field' do |
|
|
|
|
field.expect_state_text(work_package.send(property_name)) |
|
|
|
|
|
|
|
|
|
active_class_name = page.evaluate_script('document.activeElement.className') |
|
|
|
|
expect(active_class_name).to include(field.display_selector[1..-1]) |
|
|
|
|
expect(active_class_name).to include(field.display_selector[1..]) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context 'by escape' do |
|
|
|
|
context 'for escape' do |
|
|
|
|
before do |
|
|
|
|
field.activate! |
|
|
|
|
sleep 1 |
|
|
|
@ -163,15 +163,67 @@ shared_examples 'a principal autocomplete field' do |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context 'in project' do |
|
|
|
|
context 'with the project page' do |
|
|
|
|
let(:wp_page) { Pages::SplitWorkPackage.new(work_package, project) } |
|
|
|
|
|
|
|
|
|
it_behaves_like 'principal autocomplete on field' |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context 'outside project' do |
|
|
|
|
context 'without the project page' do |
|
|
|
|
let(:wp_page) { Pages::SplitWorkPackage.new(work_package) } |
|
|
|
|
|
|
|
|
|
it_behaves_like 'principal autocomplete on field' |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
shared_examples 'not a principal autocomplete field' do |
|
|
|
|
let(:role) { create(:role, permissions: %i[view_work_packages edit_work_packages]) } |
|
|
|
|
let!(:user) do |
|
|
|
|
create :user, |
|
|
|
|
member_in_project: project, |
|
|
|
|
member_through_role: role, |
|
|
|
|
firstname: 'John' |
|
|
|
|
end |
|
|
|
|
let!(:mentioned_user) do |
|
|
|
|
create :user, |
|
|
|
|
member_in_project: project, |
|
|
|
|
member_through_role: role, |
|
|
|
|
firstname: 'Laura', |
|
|
|
|
lastname: 'Foobar' |
|
|
|
|
end |
|
|
|
|
let!(:mentioned_group) do |
|
|
|
|
create(:group, lastname: 'Laudators').tap do |group| |
|
|
|
|
create :member, |
|
|
|
|
principal: group, |
|
|
|
|
project:, |
|
|
|
|
roles: [role] |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
shared_examples 'not principal autocomplete on field' do |
|
|
|
|
before do |
|
|
|
|
wp_page.visit! |
|
|
|
|
wp_page.ensure_page_loaded |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it 'does not autocompletes links to user profiles' do |
|
|
|
|
field.activate! |
|
|
|
|
field.clear with_backspace: true |
|
|
|
|
field.input_element.send_keys(" @lau") |
|
|
|
|
sleep 2 |
|
|
|
|
expect(page).not_to have_selector('.mention-list-item') |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context 'with the project page' do |
|
|
|
|
let(:wp_page) { Pages::SplitWorkPackage.new(work_package, project) } |
|
|
|
|
|
|
|
|
|
it_behaves_like 'not principal autocomplete on field' |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context 'without the project page' do |
|
|
|
|
let(:wp_page) { Pages::SplitWorkPackage.new(work_package) } |
|
|
|
|
|
|
|
|
|
it_behaves_like 'not principal autocomplete on field' |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|