Fixes #2710 - ignore 'new line' between trigger chars.
This commit is contained in:
parent
40dcb0e132
commit
c88739cde8
4 changed files with 30 additions and 6 deletions
|
@ -155,7 +155,10 @@
|
||||||
if (e.keyCode === 16) return
|
if (e.keyCode === 16) return
|
||||||
|
|
||||||
// enter
|
// enter
|
||||||
if (e.keyCode === 13) return
|
if (e.keyCode === 13) {
|
||||||
|
this.buffer = ''
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// arrow keys
|
// arrow keys
|
||||||
if (e.keyCode === 37 || e.keyCode === 38 || e.keyCode === 39 || e.keyCode === 40) return
|
if (e.keyCode === 37 || e.keyCode === 38 || e.keyCode === 39 || e.keyCode === 40) return
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
RSpec.shared_examples 'group-dependent text modules' do |path:|
|
RSpec.shared_examples 'text modules' do |path:|
|
||||||
|
|
||||||
let!(:group1) { create :group }
|
let!(:group1) { create :group }
|
||||||
let!(:group2) { create :group }
|
let!(:group2) { create :group }
|
||||||
|
@ -6,6 +6,27 @@ RSpec.shared_examples 'group-dependent text modules' do |path:|
|
||||||
let!(:text_module_group1) { create :text_module, groups: [group1] }
|
let!(:text_module_group1) { create :text_module, groups: [group1] }
|
||||||
let!(:text_module_group2) { create :text_module, groups: [group2] }
|
let!(:text_module_group2) { create :text_module, groups: [group2] }
|
||||||
|
|
||||||
|
it 'shows when send ::' do
|
||||||
|
visit path
|
||||||
|
within(:active_content) do
|
||||||
|
find('select[name="group_id"]').select(1)
|
||||||
|
find(:richtext).send_keys(':')
|
||||||
|
find(:richtext).send_keys(':')
|
||||||
|
expect(page).to have_selector(:text_module, text_module_without_group.id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not show when send :enter:' do
|
||||||
|
visit path
|
||||||
|
within(:active_content) do
|
||||||
|
find('select[name="group_id"]').select(1)
|
||||||
|
find(:richtext).send_keys(':')
|
||||||
|
find(:richtext).send_keys(:enter)
|
||||||
|
find(:richtext).send_keys(':')
|
||||||
|
expect(page).to have_no_selector(:text_module, text_module_without_group.id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
it 'supports group-dependent text modules' do
|
it 'supports group-dependent text modules' do
|
||||||
|
|
||||||
# give user access to all groups including those created
|
# give user access to all groups including those created
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
require 'system/examples/text_modules_group_dependency_examples'
|
require 'system/examples/text_modules_examples'
|
||||||
|
|
||||||
RSpec.describe 'Ticket Create', type: :system do
|
RSpec.describe 'Ticket Create', type: :system do
|
||||||
context 'when applying ticket templates' do
|
context 'when applying ticket templates' do
|
||||||
|
@ -34,6 +34,6 @@ RSpec.describe 'Ticket Create', type: :system do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when using text modules' do
|
context 'when using text modules' do
|
||||||
include_examples 'group-dependent text modules', path: 'ticket/create'
|
include_examples 'text modules', path: 'ticket/create'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
require 'system/examples/text_modules_group_dependency_examples'
|
require 'system/examples/text_modules_examples'
|
||||||
|
|
||||||
RSpec.describe 'Ticket Update', type: :system do
|
RSpec.describe 'Ticket Update', type: :system do
|
||||||
|
|
||||||
|
@ -139,6 +139,6 @@ RSpec.describe 'Ticket Update', type: :system do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when using text modules' do
|
context 'when using text modules' do
|
||||||
include_examples 'group-dependent text modules', path: "#ticket/zoom/#{Ticket.first.id}"
|
include_examples 'text modules', path: "#ticket/zoom/#{Ticket.first.id}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue