diff --git a/test-data/site/long-title.html b/test-data/site/long-title.html new file mode 100644 index 0000000..3374475 --- /dev/null +++ b/test-data/site/long-title.html @@ -0,0 +1,5 @@ + + + very very very very very very very very very very very very very very very very very long title + + diff --git a/url-el-integration-tests.el b/url-el-integration-tests.el index 48387c3..5c88199 100644 --- a/url-el-integration-tests.el +++ b/url-el-integration-tests.el @@ -17,6 +17,24 @@ (sleep-for timeout) (should (equal (buffer-string) expected-outcome))))) +(ert-deftest org-cliplink-long-title-with-custom-transformer--http () + (let ((url "http://127.0.0.1:8001/long-title.html") + (expected-outcome "[[http://127.0.0.1:8001/http.html][long title]]") + (timeout 1) + (custom-org-cliplink + (lambda () + (org-cliplink-insert-transformed-title + (org-cliplink-clipboard-content) + (lambda (url title) + (org-cliplink-org-mode-link-transformer + url + (replace-regexp-in-string "\\(very \\)+\\([[:alpha:][:space:]]+\\)" "\\2" title))))))) + (with-temp-buffer + (kill-new url) + (funcall custom-org-cliplink) + (sleep-for timeout) + (should (equal (buffer-string) expected-outcome))))) + (ert-deftest org-cliplink-simple-title--http () (let ((url "http://127.0.0.1:8001/http.html") (expected-outcome "[[http://127.0.0.1:8001/http.html][Hello World]]")