Skip to content

Commit

Permalink
tests for all the HTML (#114)
Browse files Browse the repository at this point in the history
* leverage fixtures for selenium start/end
* added boot task to help with local development
* fix notice about not having a target dir for webdriver tests
* update selenium version for ff 45 compatibility
  • Loading branch information
thedavidmeister authored and alandipert committed Apr 13, 2016
1 parent fe0ebd0 commit ec64cb2
Show file tree
Hide file tree
Showing 6 changed files with 462 additions and 19 deletions.
1 change: 1 addition & 0 deletions boot.properties
@@ -0,0 +1 @@
BOOT_EMIT_TARGET=no
44 changes: 35 additions & 9 deletions build.boot
Expand Up @@ -12,7 +12,7 @@
[adzerk/boot-test "1.1.1" :scope "test"]
[clj-webdriver "0.7.2" :scope "test"]
[pandeiro/boot-http "0.7.0" :scope "test"]
[org.seleniumhq.selenium/selenium-java "2.48.2" :scope "test"]
[org.seleniumhq.selenium/selenium-java "2.52.0" :scope "test"]
[cljsjs/jquery "1.9.1-0"]
[hoplon/javelin "3.8.4"]])

Expand All @@ -34,14 +34,40 @@
:scm {:url "https://github.com/hoplon/hoplon"}
:license {"Eclipse Public License" "http://www.eclipse.org/legal/epl-v10.html"}})

(def target-dir "target")

(defn test-filter-for-wip
[wip?]
(if wip?
'(:wip (meta %))
'(not (:wip (meta %)))))

(deftask webdriver-tests
"Run all Selenium + Firefox tests"
[ w watch? bool "Watches the filesystem and reruns tests when changes are made."
W wip? bool "true to only run WIP tests. WIP tests will not run if false."]
(comp
(target :dir #{target-dir})
(serve :dir target-dir)
(if watch?
(comp
(watch)
(speak))
identity)
(hoplon)
(cljs)
(target :dir #{target-dir})
(test
:filters [(test-filter-for-wip wip?)])))

(deftask dev
"Build Hoplon for local development."
[]
(let [target-dir "target"]
(comp
(hoplon)
(cljs)
(prerender)
(target :dir #{target-dir})
(serve :dir target-dir)
(test))))
(comp
(target :dir #{target-dir})
(serve :dir target-dir)
(watch)
(speak)
(hoplon)
(cljs)
(target :dir #{target-dir})))
5 changes: 4 additions & 1 deletion src/hoplon/core.cljs
Expand Up @@ -357,6 +357,7 @@
(def del (make-elem-ctor "del"))
(def details (make-elem-ctor "details"))
(def dfn (make-elem-ctor "dfn"))
(def dialog (make-elem-ctor "dialog"))
(def dir (make-elem-ctor "dir"))
(def div (make-elem-ctor "div"))
(def dl (make-elem-ctor "dl"))
Expand Down Expand Up @@ -393,10 +394,11 @@
(def legend (make-elem-ctor "legend"))
(def li (make-elem-ctor "li"))
(def link (make-elem-ctor "link"))
(def html-map (make-elem-ctor "map"))
(def main (make-elem-ctor "main"))
(def html-map (make-elem-ctor "map"))
(def mark (make-elem-ctor "mark"))
(def menu (make-elem-ctor "menu"))
(def menuitem (make-elem-ctor "menuitem"))
(def html-meta (make-elem-ctor "meta"))
(def meter (make-elem-ctor "meter"))
(def nav (make-elem-ctor "nav"))
Expand All @@ -414,6 +416,7 @@
(def q (make-elem-ctor "q"))
(def rp (make-elem-ctor "rp"))
(def rt (make-elem-ctor "rt"))
(def rtc (make-elem-ctor "rtc"))
(def ruby (make-elem-ctor "ruby"))
(def s (make-elem-ctor "s"))
(def samp (make-elem-ctor "samp"))
Expand Down
245 changes: 243 additions & 2 deletions test/src/index.cljs.hl
Expand Up @@ -2,6 +2,247 @@

(html
(head
(link :rel "stylesheet" :href "main.css"))
(link :rel "stylesheet" :href "main.css")
(html-meta :charset "UTF-8")
(base
:href "http://hoplon.io/images/")
(title "Test examples")
(style
"h1 {color:red};} p {color:blue};}")
(isindex :prompt "Search Document... "))

(body
(h1 "hello world")))
(noscript "Your browser does not support JavaScript!")
(noframes "Sorry, your browser does not handle frames!")
(frameset "cols \"25%\""
(frame :src "http://hoplon.io"))

(script "1;")
(eventsource)
(basefont :color "red" :size "5")
(font :face "verdana" :color "green"
"This is some text!")

(nav
(menu :type "context" :id "mymenu"
(menuitem :label "Refresh")
(command :type "command" :label "Save")))

(article
(header
(h1 "hello world")
(h2 "something"))
(h3 "less important")
(hgroup
(h4 "getting lower")
(h5 "quite specific"))
(h6 "maximum specificity")
(a :href "http://hoplon.io/" "a link"))
(hr)
(abbr :title "Cascading Style Sheet" "CSS")
(aside
(address "123 Best Street, Nowhere")
"Some text" (b "with cool") "styling")
(figure
(img
:src "logos/hoplon-logo.png"
:usemap "#logomap")
(figcaption "The logo"))
(html-map
:name "logomap"
(area
:shape "rect"
:coords "0,0,100,100"
:href "http://hoplon.io"
:alt "click me"))
(audio :controls true)

(object :width "400" :height "400" :data "helloworld.swf"
(param :name "autoplay" :value "true"))

(br)
(bdo
:dir "rtl"
"Right to " (bdi "left"))

(section
(blockquote
:cite "http://hoplon.io"
"Hoplon is a set of "
(strong "Clojure and ClojureScript")
" libraries that pave over the web's "
(span "idiosyncrasies and present a simpler")
" way to design and "
(small "build single-page")
" web applications. "
(samp "Learn more on our wiki.")))

(pre
"Text in a pre element
is displayed in a fixed-width
font, and it preserves
both spaces and
line breaks")

(button
:type "button"
"click me")
(canvas)

(table
(caption "Monthly savings")
(colgroup
(col)
(col))
(tr
(th (center "Month"))
(th "Savings"))
(tr
(td "January")
(td "$100")))

(table
(thead
(tr
(th (tt "Month"))
(th (strike "Savings"))))
(tfoot
(tr)
(td "Sum")
(td "$180"))
(tbody
(tr
(td "January")
(td "$100"))))

(p "Can I get "
(big "this ")
(acronym :title "as soon as possible"
"ASAP")
"?")

(applet
:code "Bubbles.class"
:width "350"
:height "350"
"Java applet that draws animated bubbles.")

(cite "cite")
(code "(= (+ 1 1) 2)")
(input :list "numbers")
(datalist :id "numbers"
(option :value "one")
(option :value "two")
(option :value "three"))
(label :for "some-input")
(input :id "some-input")
(textarea)
(keygen :name "security")
(sup "foo")
(sub "bar")
(dl
(dt "Coffee")
(dd "Black hot drink")
(dt "Milk")
(dd "White cold drink"))

(main
(p "My favorite color is " (del "blue") (ins "red") "!")

(details
(summary "Copyright 1999-2014.")
(p " - by Refsnes Data. All Rights Reserved.")
(p "All content and " (s "graphics" ) " on this web site are the property of the company Refsnes Data."))

(div (dfn "HTML") " is the " (em "standard markup") "language for creating web pages.")

(p "He named his car " (i "The lightning") ", because it was very fast.")

(p "Do not "
(q "forget to buy ")
(mark "milk")
" today."))

(ruby
""
(rp "(")
(rt "ㄏㄢˋ")
(rtc "San Francisco")
(rp ")"))

(meter :value "2" :min "0" :max "10" "2 out of 10")
(progress :value "22" :max "100")

(embed :src "foo.swf")

(video :width "320" :height "240" :controls true
(source :src "movie.mp4" :type "video/mp4")
(source :src "movie.ogg" :type "video/ogg")
(track :src "subtitles_no.vtt" :kind "subtitles" :srclang "no" :label "Norwegian")
"Your browser does not support the video tag.")

(p "To learn AJAX, you must be familiar with the XML"
(wbr "Http")
"Request Object.")

(dialog :open true
(p "Greetings, one and all!"))

(form
(fieldset
(legend "Personalia:")
"Name: " (input :type "text")
"Email: " (input :type "text")
"Date of birth: " (input :type "text")))

(iframe :src "http://hoplon.io")

(ol
(li "Coffee")
(li "Tea")
(li "Milk"))

(ul
(li "Coffee")
(li "Tea")
(li "Milk"))

(html-var "Variable")

(p "New " (u "Products"))
(ul
(li
(data :value "3967381398" "Mini Ketchup"))
(li
(data :value "3967381399" "Jumbo Ketchup"))
(li
(data :value "3967381400" "Mega Jumbo Ketchup")))

(p "We open at " (html-time "10:00") " every morning.")

(select
(optgroup :label "Swedish Cars"
(option :value "volvo" "Volvo")
(option :value "saab" "Saab"))

(optgroup :label "German Cars"
(option :value "mercedes" "Mercedes")
(option :value "audi" "Audi")))

(let
[ a (cell 10)
b (cell 20)]
(form
(input :id "a" :value a :input #(reset! a (int @%)))
"+"
(input :id "b" :value b :input #(reset! b (int @%)))
"="
(output :for "a b" :value (cell= (+ a b)))))

(footer
(p "Press " (kbd "cmd")))

(dir
(li "html")
(li "xhtml")
(li "css"))))

0 comments on commit ec64cb2

Please sign in to comment.