Skip to content

Commit

Permalink
Add basic custom scheme test.
Browse files Browse the repository at this point in the history
  • Loading branch information
aadcg committed Feb 26, 2024
1 parent cbfd82d commit 538a5d6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions nyxt.asd
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@
:components ((:file "renderer-package")
(:file "renderer-offline/set-url")
(:file "renderer-offline/execute-command-eval")
(:file "renderer-offline/register-custom-scheme")
(:file "renderer-offline/nyxt-url-security")
(:file "renderer-offline/search-buffer")
;; See https://github.com/atlas-engineer/nyxt/issues/3172
Expand Down
22 changes: 22 additions & 0 deletions tests/renderer-offline/register-custom-scheme.lisp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
;;;; SPDX-FileCopyrightText: Atlas Engineer LLC
;;;; SPDX-License-Identifier: BSD-3-Clause

(in-package :nyxt/tests/renderer)

(nyxt:define-internal-scheme "test"
(lambda (url)
(declare (ignore url))
(spinneret:with-html-string (:p (format nil "pass")))))

(define-test register-custom-scheme ()
(let ((ready-channel (nyxt::make-channel 1)))
(nyxt:start :no-config t :no-auto-config t :headless t
:socket "/tmp/nyxt-test.socket" :profile "test")
(with-current-buffer (nyxt:make-buffer-focus :url "test:test")
(hooks:once-on (nyxt:buffer-loaded-hook (current-buffer)) (buffer)
(calispel:! ready-channel t))
(calispel:? ready-channel)
(sleep 1)
(assert-equal "pass"
(nyxt:ps-eval (ps:chain (nyxt/ps:qs document "p") inner-text))))
(nyxt:quit)))

0 comments on commit 538a5d6

Please sign in to comment.