diff --git a/cl-sbt.asd b/cl-sbt.asd index f260c0f..a8dc386 100644 --- a/cl-sbt.asd +++ b/cl-sbt.asd @@ -47,6 +47,7 @@ ((:file "accordion") (:file "alert") (:file "badge") - (:file "button")))) + (:file "button") + (:file "card")))) :description "Test system for cl-sbt" :perform (test-op (op c) (symbol-call :rove :run c))) diff --git a/tests/component/card.lisp b/tests/component/card.lisp new file mode 100644 index 0000000..a094437 --- /dev/null +++ b/tests/component/card.lisp @@ -0,0 +1,55 @@ +(defpackage cl-sbt/tests/card + (:use + :cl + :cl-sbt + :rove) + (:import-from + :cl-sbt/card + :title + :subtitle + :text + :link + :header + :img + :body + :card-with-img + :card + :card-group)) + +(in-package :cl-sbt/tests/card) + +(deftest test-title + (let ((result (spinneret:with-html-string (title "My Title")))) + (testing "Testing title macro" + (ok (string= "
Some card text here" result)))))
+
+(deftest test-link
+ (let ((result (spinneret:with-html-string (link (:href "https://example.com") "Example link"))))
+ (testing "Testing link macro"
+ (ok (string= "Example link" result)))))
+
+(deftest test-header
+ (let ((result (spinneret:with-html-string (header "My Card Header"))))
+ (testing "Testing header macro"
+ (ok (search "class=header" result))
+ (ok (search "My Card Header" result)))))
+
+(deftest test-img
+ (let ((result (spinneret:with-html-string (img (:src "https://example.com/image.jpg" :alt "An example image")))))
+ (testing "Testing img macro"
+ (ok (string= "" result)))))
+
+(deftest test-body
+ (let ((result (spinneret:with-html-string (body (title "My Title") (text "Some card text here")))))
+ (testing "Testing body macro"
+ (ok (string= "
Some card text here