summaryrefslogtreecommitdiff
path: root/test/dompa/coordinates_test.cljc
blob: a827968d7f78811f862c0a1a67fdbfc3c9a67824 (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
25
26
27
28
29
30
31
(ns dompa.coordinates-test
  (:require [clojure.test :refer [deftest testing is]]
            [dompa.coordinates :as coordinates]))

(deftest compose-test
  (testing "Create coordinates"
    (is (= [[0 4] [5 9] [10 15]]
           (coordinates/compose "<div>hello</div>"))))

  (testing "Create coordinates with invalid HTML"
    (is (= [[0 4] [5 9]]
           (coordinates/compose "<div>hello")))

    (is (= []
           (coordinates/compose "<div")))

    (is (= [[0 3]]
           (coordinates/compose "div>")))

    (is (= [[0 1]]
           (coordinates/compose "<>"))))

  (testing "Create coordinates with just text"
    (is (= [[0 4]]
           (coordinates/compose "hello"))))

  (testing "Create coordinates with text starting"
    (is (= [[0 4] [5 9] [10 15]]
           (coordinates/compose "hello<div></div>")))))

(deftest unify-test)