]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/html/parser/analyzer/analyzer-tests.factor
html.parser.analyzer: when matching on classname, check that the tag has the given...
[factor.git] / extra / html / parser / analyzer / analyzer-tests.factor
index 426fd75b2690ff15436eb6c3ae24f4fb7af816fe..fc40ee9825166e6e528af3584a86c7096b5729fa 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2010 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: html.parser html.parser.analyzer math tools.test ;
+USING: html.parser html.parser.analyzer kernel math sequences tools.test ;
 IN: html.parser.analyzer.tests
 
 [ 0 3 ]
@@ -70,3 +70,27 @@ IN: html.parser.analyzer.tests
     "<body><div class=\"foo\"><div><p>para</p></div></div></body>" parse-html
     "foo" find-by-class-between
 ] unit-test
+
+[ t ] [
+    T{ tag { name "f" } { attributes H{ { "class" "a b c" } } } }
+    { "a" "b" "c" } [ html-class? ] with all?
+] unit-test
+
+[
+    V{
+        T{ tag
+           { name "div" }
+           { attributes H{ { "class" "foo and more" } } }
+        }
+        T{ tag { name "div" } { attributes H{ } } { closing? t } }
+    }
+] [ "<div class=\"foo and more\"></div>" parse-html
+    "foo" find-by-class-between
+] unit-test
+
+[
+    0
+    T{ tag { name "div" } { attributes H{ { "class" "foo bar" } } } }
+] [
+    "<div class=\"foo bar\"></div>" parse-html "bar" find-by-class
+] unit-test