@@ -917,15 +917,21 @@ defmodule FlokiTest do
917
917
# Floki.find/2 - Selector with descendant combinator
918
918
919
919
test "get elements descending the parent" do
920
- expected = [
921
- {
922
- "img" ,
923
- [ { "src" , "http://twitter.com/logo.png" } , { "class" , "js-twitter-logo" } ] ,
924
- [ ]
925
- }
920
+ doc = document! ( html_body ( """
921
+ <div id="first-div">
922
+ <div id="second-div">
923
+ <span id="first-span"></span>
924
+ </div>
925
+ <span id="second-span"></span>
926
+ </div>
927
+ """ ) )
928
+
929
+ expected = [
930
+ { "span" , [ { "id" , "first-span" } ] , [ ] } ,
931
+ { "span" , [ { "id" , "second-span" } ] , [ ] }
926
932
]
927
933
928
- assert_find ( document! ( @ html_with_img ) , "a img " , expected )
934
+ assert_find ( doc , "div span " , expected )
929
935
end
930
936
931
937
# Floki.find/2 - Selector with child combinator
@@ -1051,6 +1057,7 @@ defmodule FlokiTest do
1051
1057
]
1052
1058
1053
1059
assert_find ( document! ( @ html_with_img ) , ".js-twitter-logo, #logo" , expected )
1060
+ assert_find ( document! ( @ html_with_img ) , "#logo, .js-twitter-logo" , expected )
1054
1061
end
1055
1062
1056
1063
test "get one element when search for multiple and just one exist" do
0 commit comments