emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/hyperbole 3cda4a6: Add hui:ebut-create and hui:ebut-mod


From: ELPA Syncer
Subject: [elpa] externals/hyperbole 3cda4a6: Add hui:ebut-create and hui:ebut-modify tests (#106)
Date: Sun, 4 Jul 2021 18:57:11 -0400 (EDT)

branch: externals/hyperbole
commit 3cda4a6d1366b84905b46cdb55389066b9bb950f
Author: Mats Lidell <mats.lidell@lidells.se>
Commit: GitHub <noreply@github.com>

    Add hui:ebut-create and hui:ebut-modify tests (#106)
---
 ChangeLog         |  6 ++++++
 test/hui-tests.el | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index fa512f5..c8f51b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2021-07-04  Mats Lidell  <matsl@gnu.org>
+
+* test/hui-tests.el (hui-ebut-create-link-to-www-url)
+    
(hui-ebut-modify-link-to-www-url-keeping-all-values-should-not-modify-buffer-or-ebut):
+    Add hui:ebut-create and hui:ebut-modify tests.
+
 2021-07-04  Bob Weiner  <rsw@gnu.org>
 
 * hbut.el (ebut:program): Change to a function from a macro so 'args' are 
evaluated.
diff --git a/test/hui-tests.el b/test/hui-tests.el
index 1eb0473..adf2381 100644
--- a/test/hui-tests.el
+++ b/test/hui-tests.el
@@ -17,6 +17,7 @@
 
 (require 'ert)
 (require 'with-simulated-input)
+(require 'hui)
 
 (load (expand-file-name "hy-test-helpers"
                         (file-name-directory (or load-file-name
@@ -60,6 +61,37 @@
           (should (equal (hattr:get (hbut:at-p) 'lbl-key) "label")))
       (delete-file file))))
 
+(ert-deftest hui-ebut-create-link-to-www-url ()
+  "Create an ebut with link to www-url."
+  (let ((file (make-temp-file "hypb_" nil ".txt")))
+    (unwind-protect
+        (find-file file)
+        (with-simulated-input "label RET RET www-url RET www.hypb.org RET"
+          (hui:ebut-create)
+          (should (eq (hattr:get (hbut:at-p) 'actype) 'actypes::www-url))
+          (should (equal (hattr:get (hbut:at-p) 'args) '("www.hypb.org")))
+          (should (equal (hattr:get (hbut:at-p) 'lbl-key) "label")))
+      (delete-file file))))
+
+(ert-deftest 
hui-ebut-modify-link-to-www-url-keeping-all-values-should-not-modify-buffer-or-ebut
 ()
+  "Modify an ebut keeping all initial values should not modify buffer or ebut.
+Modifying the button but keeping the label creates a dubbel label."
+  (let ((file (make-temp-file "hypb_" nil ".txt")))
+    (unwind-protect
+        (find-file file)
+        (with-simulated-input "label RET RET www-url RET www.hypb.org RET"
+          (hui:ebut-create)
+          (should (eq (hattr:get (hbut:at-p) 'actype) 'actypes::www-url))
+          (should (equal (hattr:get (hbut:at-p) 'args) '("www.hypb.org")))
+          (should (equal (hattr:get (hbut:at-p) 'lbl-key) "label")))
+        (with-simulated-input "RET RET RET RET"
+          (hui:ebut-modify "label")
+          (should (eq (hattr:get (hbut:at-p) 'actype) 'actypes::www-url))
+          (should (equal (hattr:get (hbut:at-p) 'args) '("www.hypb.org")))
+          (should (equal (hattr:get (hbut:at-p) 'lbl-key) "label"))
+          (should (string= "<(label)>" (buffer-string)))))
+    (delete-file file)))
+
 (ert-deftest hui-ebut-use-region-as-label ()
   "Create an ebut using region as label."
   (skip-unless (not noninteractive))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]