mobility-toolbox-js 1.7.3 → 1.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common/mixins/TrackerLayerMixin.js +18 -8
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/ol/layers/TralisLayer.test.js +40 -1
- package/package.json +1 -1
|
@@ -61,6 +61,18 @@ describe('TrajservLayer', () => {
|
|
|
61
61
|
expect(clone).toBeInstanceOf(TralisLayer);
|
|
62
62
|
});
|
|
63
63
|
|
|
64
|
+
test('should use the sort function.', () => {
|
|
65
|
+
const fn = () => true;
|
|
66
|
+
const laye = new TralisLayer({
|
|
67
|
+
url: 'ws://localhost:1234',
|
|
68
|
+
apiKey: 'apiKey',
|
|
69
|
+
sort: fn,
|
|
70
|
+
});
|
|
71
|
+
expect(laye).toBeInstanceOf(TralisLayer);
|
|
72
|
+
expect(laye.useDelayStyle).toBe(false);
|
|
73
|
+
expect(laye.sort).toBe(fn);
|
|
74
|
+
});
|
|
75
|
+
|
|
64
76
|
test('should set a default sort function if useDelayStyle is used.', () => {
|
|
65
77
|
const laye = new TralisLayer({
|
|
66
78
|
url: 'ws://localhost:1234',
|
|
@@ -82,7 +94,7 @@ describe('TrajservLayer', () => {
|
|
|
82
94
|
expect(trajectories).toEqual([red, yellow, cancelled, green2, green, gray]);
|
|
83
95
|
});
|
|
84
96
|
|
|
85
|
-
test('should override the
|
|
97
|
+
test('should override the default sort function when useDelayStyle is used.', () => {
|
|
86
98
|
const laye = new TralisLayer({
|
|
87
99
|
url: 'ws://localhost:1234',
|
|
88
100
|
apiKey: 'apiKey',
|
|
@@ -103,4 +115,31 @@ describe('TrajservLayer', () => {
|
|
|
103
115
|
trajectories.sort(laye.sort);
|
|
104
116
|
expect(trajectories).toEqual([cancelled, green2, red, yellow, green, gray]);
|
|
105
117
|
});
|
|
118
|
+
|
|
119
|
+
test('should use filter function.', () => {
|
|
120
|
+
const fn = () => true;
|
|
121
|
+
const laye = new TralisLayer({
|
|
122
|
+
url: 'ws://localhost:1234',
|
|
123
|
+
apiKey: 'apiKey',
|
|
124
|
+
useDelayStyle: true,
|
|
125
|
+
filter: fn, // reverse the array
|
|
126
|
+
});
|
|
127
|
+
expect(laye).toBeInstanceOf(TralisLayer);
|
|
128
|
+
expect(laye.useDelayStyle).toBe(true);
|
|
129
|
+
expect(laye.filter).toBe(fn);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test('should override filter function if operator, tripNumber, regexPublishedLineName is set.', () => {
|
|
133
|
+
const fn = () => true;
|
|
134
|
+
const laye = new TralisLayer({
|
|
135
|
+
url: 'ws://localhost:1234',
|
|
136
|
+
apiKey: 'apiKey',
|
|
137
|
+
useDelayStyle: true,
|
|
138
|
+
filter: fn, // reverse the array
|
|
139
|
+
publishedLineName: '.*',
|
|
140
|
+
});
|
|
141
|
+
expect(laye).toBeInstanceOf(TralisLayer);
|
|
142
|
+
expect(laye.useDelayStyle).toBe(true);
|
|
143
|
+
expect(laye.filter).not.toBe(fn);
|
|
144
|
+
});
|
|
106
145
|
});
|
package/package.json
CHANGED