/
dom_element.spec.js
35 lines (30 loc) · 1.11 KB
/
dom_element.spec.js
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
/******************************************************************************
*
* Copyright (c) 2018, the Perspective Authors.
*
* This file is part of the Perspective library, distributed under the terms of
* the Apache License 2.0. The full license can be found in the LICENSE file.
*
*/
import {DomElement} from "../../../src/js/viewer/dom_element";
jest.mock("../../../src/less/computed_column.less", () => jest.fn());
describe(DomElement, () => {
describe("._autocomplete_choices", () => {
let dom_element, json_choices;
beforeEach(() => {
dom_element = new DomElement();
json_choices = [
{__ROW_PATH__: [], foo: 2},
{__ROW_PATH__: [null], foo: 25},
{__ROW_PATH__: ["somestring"], foo: 3},
{__ROW_PATH__: ["otherstring"], foo: 3}
];
});
test("the first value and null values are filtered out", () => {
expect(dom_element._autocomplete_choices(json_choices)).toEqual([
["somestring"],
["otherstring"]
]);
});
});
});