discourse/spec/system/page_objects/modals/upsert_hyperlink.rb
Martin Brennan a24107dd15
FIX: Escape URL when inserting/editing links in composer modal (#33501)
Fixes an issue where a URL like this:

```
https://meta.discourse.org/admin/site_settings/category/all_results?filter=discourse connect
```

Would appear to be broken when inserting into the composer via the
hyperlink modal. All we have to do is escape it before inserting,
and unescape before editing it in the modal.

Also in this commit I am renaming the InsertHyperlink modal to
UpsertHyperlink,
since it is used for both inserting and editing links.
2025-07-08 12:51:25 +10:00

27 lines
694 B
Ruby
Vendored

# frozen_string_literal: true
module PageObjects
module Modals
class UpsertHyperlink < PageObjects::Modals::Base
BODY_SELECTOR = ".upsert-hyperlink-modal"
MODAL_SELECTOR = ".upsert-hyperlink-modal"
LINK_TEXT_SELECTOR = ".d-modal__body input.link-text"
LINK_URL_SELECTOR = ".d-modal__body input.link-url"
def fill_in_link_text(text)
find(LINK_TEXT_SELECTOR).fill_in(with: text)
end
def fill_in_link_url(url)
find(LINK_URL_SELECTOR).fill_in(with: url)
end
def link_text_value
find(LINK_TEXT_SELECTOR).value
end
def link_url_value
find(LINK_URL_SELECTOR).value
end
end
end
end