Add tests for badge component

This commit is contained in:
Marcus Kammer 2023-07-27 16:18:37 +02:00
parent f3b8c3fd95
commit 00defb9b43
2 changed files with 29 additions and 1 deletions

View file

@ -45,6 +45,7 @@
(:module "tests/component"
:components
((:file "accordion")
(:file "alert"))))
(:file "alert")
(:file "badge"))))
:description "Test system for cl-sbt"
:perform (test-op (op c) (symbol-call :rove :run c)))

View file

@ -0,0 +1,27 @@
(defpackage cl-sbt/tests/badge
(:use
:cl
:cl-sbt
:rove)
(:import-from
:cl-sbt/badge
:badge
:badge-primary
:badge-pill-primary))
(in-package :cl-sbt/tests/badge)
(deftest test-badge-macro
(testing "Testing badge macro"
(let ((result (spinneret:with-html-string (badge (:type "primary")))))
(ok (search "class=\"badge text-bg-primary\"" result)))))
(deftest test-badge-primary
(testing "Testing badge primary"
(let ((result (spinneret:with-html-string (badge-primary "foo"))))
(ok (search "class=\"badge text-bg-primary\"" result)))))
(deftest test-badge-pill-primary
(testing "Testing badge pill primary"
(let ((result (spinneret:with-html-string (badge-pill-primary "foo"))))
(ok (search "class=\"badge text-bg-primary rounded-pill\"" result)))))