hello"]
(is (= {:html html
:coordinates [[0 4] [5 9]]}
(-> (coordinates/compose html)
coordinates/unify))))
(let [html "
hello"]
(is (= {:html html
:coordinates [[0 4] [5 9]]}
(-> (coordinates/compose html)
coordinates/unify)))))
(testing "Unify coordinates with just text"
(let [html "hello"]
(is (= {:html html
:coordinates [[0 4]]}
(-> (coordinates/compose html)
coordinates/unify)))))
(testing "Unify coordinates with text starting"
(let [html "hello
"]
(is (= {:html html
:coordinates [[0 4] [5 15]]}
(-> (coordinates/compose html)
coordinates/unify)))))
(testing "Unify coordinates with text ending"
(let [html "
hello"]
(is (= {:html html
:coordinates [[0 10] [11 15]]}
(-> (coordinates/compose html)
coordinates/unify))))))
(deftest nodes-test
(testing "Create nodes"
(is (= [{:name :div
:attrs {}
:children [{:name :dompa/text
:value "hello"}]}]
(-> "
hello
"
coordinates/compose
coordinates/unify
coordinates/->nodes))))
(testing "Create nodes with attributes"
(is (= [{:attrs {:class "some test classes"
:data-attr "something"
:checked true}
:children [{:name :dompa/text
:value "hello"}]
:name :div}]
(-> "
hello
"
coordinates/compose
coordinates/unify
coordinates/->nodes)))))