summaryrefslogtreecommitdiff
path: root/test/dompa/html_test.cljc
blob: 0bab86e48a7627af6b2fe87be6924a9ee8302e17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
(ns dompa.html-test
  (:require [clojure.test :refer [deftest is testing]]
            [dompa.html :as html]))

(deftest coordinates-test
  (testing "HTML to coordinates"
    (is (= {:coordinates [[0 15]
                          [5 9]]
            :html        "<div>hello</div>"}
           (html/->coordinates "<div>hello</div>")))))

(deftest nodes-test
  (testing "HTML to nodes"
    (is (= [{:node/name     :div
             :node/attrs    {}
             :node/children [{:node/name  :dompa/text
                              :node/value "hello"}]}]
           (html/->nodes "<div>hello</div>")))))