1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | Object.defineProperty(exports, "__esModule", { value: true });
|
18 | const jsdom_1 = require("../../test/jsdom");
|
19 | let disableJSDOM = (0, jsdom_1.enableJSDOM)();
|
20 | const chai_1 = require("chai");
|
21 | const tab_bar_toolbar_types_1 = require("./tab-bar-toolbar-types");
|
22 | disableJSDOM();
|
23 | describe('tab-bar-toolbar', () => {
|
24 | describe('comparator', () => {
|
25 | before(() => {
|
26 | disableJSDOM = (0, jsdom_1.enableJSDOM)();
|
27 | });
|
28 | after(() => {
|
29 | disableJSDOM();
|
30 | });
|
31 | const testMe = tab_bar_toolbar_types_1.TabBarToolbarItem.PRIORITY_COMPARATOR;
|
32 | it("should favour the 'navigation' group before everything else", () => {
|
33 | (0, chai_1.expect)(testMe({ id: 'a', command: 'a', group: 'navigation' }, { id: 'b', command: 'b', group: 'other' })).to.be.equal(-1);
|
34 | });
|
35 | it("should treat 'undefined' groups as 'navigation'", () => {
|
36 | (0, chai_1.expect)(testMe({ id: 'a', command: 'a' }, { id: 'b', command: 'b' })).to.be.equal(0);
|
37 | (0, chai_1.expect)(testMe({ id: 'a', command: 'a', group: 'navigation' }, { id: 'b', command: 'b' })).to.be.equal(0);
|
38 | (0, chai_1.expect)(testMe({ id: 'a', command: 'a' }, { id: 'b', command: 'b', group: 'navigation' })).to.be.equal(0);
|
39 | (0, chai_1.expect)(testMe({ id: 'a', command: 'a' }, { id: 'b', command: 'b', group: 'other' })).to.be.equal(-1);
|
40 | });
|
41 | it("should fall back to 'priority' if the groups are the same", () => {
|
42 | (0, chai_1.expect)(testMe({ id: 'a', command: 'a', priority: 1 }, { id: 'b', command: 'b', priority: 2 })).to.be.equal(-1);
|
43 | (0, chai_1.expect)(testMe({ id: 'a', command: 'a', group: 'navigation', priority: 1 }, { id: 'b', command: 'b', priority: 2 })).to.be.equal(-1);
|
44 | (0, chai_1.expect)(testMe({ id: 'a', command: 'a', priority: 1 }, { id: 'b', command: 'b', group: 'navigation', priority: 2 })).to.be.equal(-1);
|
45 | (0, chai_1.expect)(testMe({ id: 'a', command: 'a', priority: 1, group: 'other' }, { id: 'b', command: 'b', priority: 2 })).to.be.equal(1);
|
46 | (0, chai_1.expect)(testMe({ id: 'a', command: 'a', group: 'other', priority: 1 }, { id: 'b', command: 'b', priority: 2, group: 'other' })).to.be.equal(-1);
|
47 | (0, chai_1.expect)(testMe({ id: 'a', command: 'a', priority: 10 }, { id: 'b', command: 'b', group: 'other', priority: 2 })).to.be.equal(-1);
|
48 | (0, chai_1.expect)(testMe({ id: 'a', command: 'a', group: 'other', priority: 10 }, { id: 'b', command: 'b', group: 'other', priority: 10 })).to.be.equal(0);
|
49 | });
|
50 | });
|
51 | });
|
52 |
|
\ | No newline at end of file |