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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
describe("Awesomplete.ITEM", function () {
subject(function () { return Awesomplete.ITEM });
def("element", function () { return this.subject("JavaScript", this.input || "") });
it("creates DOM element", function () {
expect(this.element instanceof HTMLElement).toBe(true);
});
it("creates LI element", function () {
expect(this.element.tagName).toBe("LI");
});
it("sets aria-selected to false", function () {
expect(this.element.getAttribute("aria-selected")).toBe("false");
});
describe("with matched input", function () {
def("input", "jav");
it("marks the match", function () {
expect(this.element.innerHTML).toBe("<mark>Jav</mark>aScript");
});
});
describe("with multiple matches", function () {
def("input", "a");
it("marks all matches", function () {
expect(this.element.innerHTML).toBe("J<mark>a</mark>v<mark>a</mark>Script");
});
});
describe("with no match", function () {
def("input", "foo");
it("does not mark anything", function () {
expect(this.element.innerHTML).toBe("JavaScript");
});
});
describe("with empty input", function () {
def("input", "");
it("does not mark anything", function () {
expect(this.element.innerHTML).toBe("JavaScript");
});
});
describe("with space input", function () {
def("input", " ");
it("does not mark anything", function () {
expect(this.element.innerHTML).toBe("JavaScript");
});
});
});
|