summaryrefslogtreecommitdiff
path: root/test/dompa/html_test.cljc
blob: 5b620baad0a334e84e02c2b4034d369ff8ad380a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
(ns dompa.html-test
  #?(:clj
     (:require
      [clojure.test :refer [deftest is testing]]
      [dompa.html :as html]))
  #?(:cljs
     (:require
      [cljs.test :refer-macros [deftest testing is]]
      [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>")))))