mirror of
https://github.com/discourse/discourse.git
synced 2026-08-14 13:58:53 +08:00
Currently when you search for a tag in the composer, it requires two arrow key presses to reach the second option, even though the first option is already highlighted. This is because the create option (first row) is pre-highlighted... so arrow down in select-kit calls `this.selectKit.highlightFirst()` and you end up re-highlighting it on the first arrow press. This checks if a row is pre-highlighted to avoid `highlightFirst` and instead fires `highlightNext` (and the opposite for up arrow cases)
34 lines
961 B
Ruby
Vendored
34 lines
961 B
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
module PageObjects
|
|
module Modals
|
|
class Assign < PageObjects::Modals::Base
|
|
def assignee=(assignee)
|
|
assignee = assignee.is_a?(Group) ? assignee.name : assignee.username
|
|
find(".control-group input").fill_in(with: assignee)
|
|
find("li[data-value='#{assignee}']").click
|
|
end
|
|
|
|
def select_assignee_with_keyboard(assignee)
|
|
assignee = assignee.is_a?(Group) ? assignee.name : assignee.username
|
|
input = find(".control-group input")
|
|
input.fill_in(with: assignee)
|
|
find("li[data-value='#{assignee}'].is-highlighted")
|
|
input.send_keys(:enter)
|
|
end
|
|
|
|
def status=(status)
|
|
find("#assign-status").click
|
|
find("[data-value='#{status}']").click
|
|
end
|
|
|
|
def note=(note)
|
|
find("#assign-modal-note").fill_in(with: note)
|
|
end
|
|
|
|
def confirm
|
|
find(".d-modal__footer .btn-primary").click
|
|
end
|
|
end
|
|
end
|
|
end
|