Skip to content

Commit

Permalink
(#108) org-cliplink-long-title-with-custom-transformer--http
Browse files Browse the repository at this point in the history
  • Loading branch information
rexim committed Aug 10, 2018
1 parent 1fade9b commit 52eafab
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test-data/site/long-title.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>very very very very very very very very very very very very very very very very very long title</title>
</head>
</html>
18 changes: 18 additions & 0 deletions url-el-integration-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -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]]")
Expand Down

0 comments on commit 52eafab

Please sign in to comment.