PageRenderTime 12ms CodeModel.GetById 1ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/t/t-ajax.lisp

http://github.com/mtravers/wuwei
Lisp | 41 lines | 24 code | 13 blank | 4 comment | 0 complexity | 4ce5eae80e75547be59b4dce37970d54 MD5 | raw file
 1(in-package :wu)
 2
 3(5am:def-suite :ajax :in :wuwei)
 4(5am:in-suite :ajax)
 5
 6(defparameter *test-port* 8003)
 7;;; aserve started acting hincky in ccl, so this stops working if it is called >1 time...or something like that.
 8(net.aserve:start :port *test-port*)
 9
10(defun test-url (s)
11  (format nil "http://localhost:~A/tests/~A" *test-port* s))
12
13(defun test-path (s)
14  (string+ "/tests/" s))
15
16;;; Tests for basic Ajax machinery and update generation
17
18;;; Test that the generation machinery is sane
19(5am:test generation 
20  (5am:is 
21     (typep
22      (html-string
23       (link-to-remote "foo" "/foo" :html-options '(:style "font-style:italic") :success "alert('you win');"))
24      'string)))
25
26(defparameter *ajax-test-url* (format nil "http://localhost:~A" *test-port*))
27
28;;; Tests ajax-continuation mechanism via GET-URL
29(5am:test ajax
30    (let ((test nil))
31      (get-url (string+ *ajax-test-url*
32			(ajax-continuation () 
33					   (setq test t)
34					   (render-update (:alert "foo"))))
35	       :method :post)
36      (5am:is-true test)))
37
38
39
40
41