gantt-source_management 3.37.5
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/.editorconfig +9 -0
- package/.eslintrc.json +39 -0
- package/.prettierrc.cjs +5 -0
- package/README.md +129 -0
- package/cypress/e2e/add-rows-items.test.ts +26 -0
- package/cypress/e2e/basic.test.ts +173 -0
- package/cypress/e2e/calculated-zoom-mode.test.ts +163 -0
- package/cypress/e2e/calendar-dates.test.ts +285 -0
- package/cypress/e2e/dst.test.ts +691 -0
- package/cypress/e2e/grid-cells.test.ts +72 -0
- package/cypress/e2e/items-vertical.test.ts +305 -0
- package/cypress/e2e/items.test.ts +501 -0
- package/cypress/e2e/list-columns-toggle.test.ts +124 -0
- package/cypress/e2e/list-header-resize.test.ts +30 -0
- package/cypress/e2e/locale.test.ts +102 -0
- package/cypress/e2e/move-items-outside.test.ts +437 -0
- package/cypress/e2e/rows.test.ts +50 -0
- package/cypress/e2e/scroll-bar.test.ts +357 -0
- package/cypress/e2e/time-bookmarks.test.ts +92 -0
- package/cypress/e2e/utc-mode.test.ts +51 -0
- package/cypress/fixtures/example.json +5 -0
- package/cypress/helpers.ts +12 -0
- package/cypress/plugins/index.js +22 -0
- package/cypress/support/commands.ts +175 -0
- package/cypress/support/e2e.ts +31 -0
- package/cypress.config.js +24 -0
- package/dist/api/api.d.ts +182 -0
- package/dist/api/helpers.d.ts +9 -0
- package/dist/api/id.d.ts +14 -0
- package/dist/api/locale.d.ts +3 -0
- package/dist/api/main.d.ts +47 -0
- package/dist/api/public.d.ts +32 -0
- package/dist/api/slots.d.ts +22 -0
- package/dist/api/time.d.ts +104 -0
- package/dist/assets/2f1f893a.wasm +0 -0
- package/dist/gstc.d.ts +708 -0
- package/dist/gstc.esm.min.d.ts +708 -0
- package/dist/gstc.esm.min.js +574 -0
- package/dist/gstc.umd.min.d.ts +708 -0
- package/dist/gstc.umd.min.js +701 -0
- package/dist/gstc.wasm.esm.min.d.ts +708 -0
- package/dist/gstc.wasm.esm.min.js +574 -0
- package/dist/gstc.wasm.umd.min.d.ts +708 -0
- package/dist/gstc.wasm.umd.min.js +701 -0
- package/dist/plugins/calendar-scroll.d.ts +15 -0
- package/dist/plugins/calendar-scroll.esm.min.d.ts +15 -0
- package/dist/plugins/calendar-scroll.esm.min.js +13 -0
- package/dist/plugins/calendar-scroll.umd.min.d.ts +15 -0
- package/dist/plugins/calendar-scroll.umd.min.js +13 -0
- package/dist/plugins/dependency-lines.d.ts +47 -0
- package/dist/plugins/dependency-lines.esm.min.d.ts +47 -0
- package/dist/plugins/dependency-lines.esm.min.js +38 -0
- package/dist/plugins/dependency-lines.umd.min.d.ts +47 -0
- package/dist/plugins/dependency-lines.umd.min.js +38 -0
- package/dist/plugins/export-image.d.ts +12 -0
- package/dist/plugins/export-image.esm.min.d.ts +12 -0
- package/dist/plugins/export-image.esm.min.js +28 -0
- package/dist/plugins/export-image.umd.min.d.ts +12 -0
- package/dist/plugins/export-image.umd.min.js +34 -0
- package/dist/plugins/export-pdf.d.ts +12 -0
- package/dist/plugins/export-pdf.esm.min.d.ts +12 -0
- package/dist/plugins/export-pdf.esm.min.js +389 -0
- package/dist/plugins/export-pdf.umd.min.d.ts +12 -0
- package/dist/plugins/export-pdf.umd.min.js +511 -0
- package/dist/plugins/grab-scroll.d.ts +14 -0
- package/dist/plugins/grab-scroll.esm.min.d.ts +14 -0
- package/dist/plugins/grab-scroll.umd.min.d.ts +14 -0
- package/dist/plugins/highlight-weekends.d.ts +12 -0
- package/dist/plugins/highlight-weekends.esm.min.d.ts +12 -0
- package/dist/plugins/highlight-weekends.esm.min.js +14 -0
- package/dist/plugins/highlight-weekends.umd.min.d.ts +12 -0
- package/dist/plugins/highlight-weekends.umd.min.js +14 -0
- package/dist/plugins/item-movement.d.ts +97 -0
- package/dist/plugins/item-movement.esm.min.d.ts +97 -0
- package/dist/plugins/item-movement.esm.min.js +25 -0
- package/dist/plugins/item-movement.umd.min.d.ts +97 -0
- package/dist/plugins/item-movement.umd.min.js +25 -0
- package/dist/plugins/item-resizing.d.ts +102 -0
- package/dist/plugins/item-resizing.esm.min.d.ts +102 -0
- package/dist/plugins/item-resizing.esm.min.js +37 -0
- package/dist/plugins/item-resizing.umd.min.d.ts +102 -0
- package/dist/plugins/item-resizing.umd.min.js +37 -0
- package/dist/plugins/item-types.d.ts +13 -0
- package/dist/plugins/item-types.esm.min.d.ts +13 -0
- package/dist/plugins/item-types.esm.min.js +127 -0
- package/dist/plugins/item-types.umd.min.d.ts +13 -0
- package/dist/plugins/item-types.umd.min.js +127 -0
- package/dist/plugins/progress-bar.d.ts +13 -0
- package/dist/plugins/progress-bar.esm.min.d.ts +13 -0
- package/dist/plugins/progress-bar.esm.min.js +27 -0
- package/dist/plugins/progress-bar.umd.min.d.ts +13 -0
- package/dist/plugins/progress-bar.umd.min.js +27 -0
- package/dist/plugins/selection.d.ts +94 -0
- package/dist/plugins/selection.esm.min.d.ts +94 -0
- package/dist/plugins/selection.esm.min.js +26 -0
- package/dist/plugins/selection.umd.min.d.ts +94 -0
- package/dist/plugins/selection.umd.min.js +26 -0
- package/dist/plugins/time-bookmarks.d.ts +38 -0
- package/dist/plugins/time-bookmarks.esm.min.d.ts +38 -0
- package/dist/plugins/time-bookmarks.esm.min.js +50 -0
- package/dist/plugins/time-bookmarks.umd.min.d.ts +38 -0
- package/dist/plugins/time-bookmarks.umd.min.js +50 -0
- package/dist/plugins/timeline-pointer.d.ts +83 -0
- package/dist/plugins/timeline-pointer.esm.min.d.ts +83 -0
- package/dist/plugins/timeline-pointer.esm.min.js +13 -0
- package/dist/plugins/timeline-pointer.umd.min.d.ts +83 -0
- package/dist/plugins/timeline-pointer.umd.min.js +13 -0
- package/dist/style.css +811 -0
- package/dist/vendor.esm.min.js +128 -0
- package/examples/complex-1/faces/face-1.jpg +0 -0
- package/examples/complex-1/faces/face-10.jpg +0 -0
- package/examples/complex-1/faces/face-11.jpg +0 -0
- package/examples/complex-1/faces/face-12.jpg +0 -0
- package/examples/complex-1/faces/face-13.jpg +0 -0
- package/examples/complex-1/faces/face-14.jpg +0 -0
- package/examples/complex-1/faces/face-15.jpg +0 -0
- package/examples/complex-1/faces/face-16.jpg +0 -0
- package/examples/complex-1/faces/face-17.jpg +0 -0
- package/examples/complex-1/faces/face-18.jpg +0 -0
- package/examples/complex-1/faces/face-19.jpg +0 -0
- package/examples/complex-1/faces/face-2.jpg +0 -0
- package/examples/complex-1/faces/face-20.jpg +0 -0
- package/examples/complex-1/faces/face-21.jpg +0 -0
- package/examples/complex-1/faces/face-22.jpg +0 -0
- package/examples/complex-1/faces/face-23.jpg +0 -0
- package/examples/complex-1/faces/face-24.jpg +0 -0
- package/examples/complex-1/faces/face-25.jpg +0 -0
- package/examples/complex-1/faces/face-26.jpg +0 -0
- package/examples/complex-1/faces/face-27.jpg +0 -0
- package/examples/complex-1/faces/face-28.jpg +0 -0
- package/examples/complex-1/faces/face-29.jpg +0 -0
- package/examples/complex-1/faces/face-3.jpg +0 -0
- package/examples/complex-1/faces/face-30.jpg +0 -0
- package/examples/complex-1/faces/face-31.jpg +0 -0
- package/examples/complex-1/faces/face-32.jpg +0 -0
- package/examples/complex-1/faces/face-33.jpg +0 -0
- package/examples/complex-1/faces/face-34.jpg +0 -0
- package/examples/complex-1/faces/face-35.jpg +0 -0
- package/examples/complex-1/faces/face-36.jpg +0 -0
- package/examples/complex-1/faces/face-37.jpg +0 -0
- package/examples/complex-1/faces/face-38.jpg +0 -0
- package/examples/complex-1/faces/face-39.jpg +0 -0
- package/examples/complex-1/faces/face-4.jpg +0 -0
- package/examples/complex-1/faces/face-40.jpg +0 -0
- package/examples/complex-1/faces/face-41.jpg +0 -0
- package/examples/complex-1/faces/face-42.jpg +0 -0
- package/examples/complex-1/faces/face-43.jpg +0 -0
- package/examples/complex-1/faces/face-44.jpg +0 -0
- package/examples/complex-1/faces/face-45.jpg +0 -0
- package/examples/complex-1/faces/face-46.jpg +0 -0
- package/examples/complex-1/faces/face-47.jpg +0 -0
- package/examples/complex-1/faces/face-48.jpg +0 -0
- package/examples/complex-1/faces/face-49.jpg +0 -0
- package/examples/complex-1/faces/face-5.jpg +0 -0
- package/examples/complex-1/faces/face-50.jpg +0 -0
- package/examples/complex-1/faces/face-6.jpg +0 -0
- package/examples/complex-1/faces/face-7.jpg +0 -0
- package/examples/complex-1/faces/face-8.jpg +0 -0
- package/examples/complex-1/faces/face-9.jpg +0 -0
- package/examples/complex-1/index.html +61 -0
- package/examples/complex-1/index.js +923 -0
- package/examples/index.html +22 -0
- package/examples/reset.css +455 -0
- package/examples/server.js +18 -0
- package/package.json +150 -0
- package/tsconfig.json +17 -0
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
import DeepState from 'deep-state-observer';
|
|
2
|
+
import { Api } from '../../dist/api/api';
|
|
3
|
+
import { DataChartTime, DataChartTimeLevelDate, Item, ItemData } from '../../dist/gstc';
|
|
4
|
+
import { fixed, examples } from '../helpers';
|
|
5
|
+
|
|
6
|
+
describe('Items', () => {
|
|
7
|
+
function resizing(url) {
|
|
8
|
+
return it('Resizing ' + url, () => {
|
|
9
|
+
const rightResizerSelector =
|
|
10
|
+
'.gstc__chart-timeline-items-row-item[data-gstcid="gstcid-3"] .gstc__chart-timeline-items-row-item-resizing-handle--right';
|
|
11
|
+
let api: Api;
|
|
12
|
+
let state: DeepState;
|
|
13
|
+
let spacing = 4;
|
|
14
|
+
|
|
15
|
+
cy.load(url)
|
|
16
|
+
.window()
|
|
17
|
+
.then((win) => {
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
api = win.gstc.api;
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
state = win.state;
|
|
22
|
+
const item = api.getItem('gstcid-3');
|
|
23
|
+
api.scrollToTime(item.time.start, false);
|
|
24
|
+
spacing = state.get('config.chart.spacing');
|
|
25
|
+
})
|
|
26
|
+
.wait(Cypress.env('wait'))
|
|
27
|
+
.then(() => {
|
|
28
|
+
const item = api.getItem('gstcid-3');
|
|
29
|
+
expect(state.get('$data.chart.time.leftGlobal')).to.eq(item.time.start);
|
|
30
|
+
const itemData = api.getItemData('gstcid-3');
|
|
31
|
+
expect(itemData.position.left).to.eq(0);
|
|
32
|
+
expect(itemData.width).to.be.greaterThan(0);
|
|
33
|
+
})
|
|
34
|
+
.get('.gstc__chart-timeline-items-row-item[data-gstcid="gstcid-3"]')
|
|
35
|
+
.then(($el) => {
|
|
36
|
+
const itemData: ItemData = api.getItemData('gstcid-3');
|
|
37
|
+
const itemDataWidth = Math.round(itemData.actualWidth - spacing);
|
|
38
|
+
const elementWidth = Math.round(parseFloat($el.css('width')));
|
|
39
|
+
expect(itemDataWidth).to.eq(elementWidth);
|
|
40
|
+
expect(itemDataWidth).to.be.greaterThan(0);
|
|
41
|
+
expect(itemData.position.right);
|
|
42
|
+
expect(fixed($el.css('left'))).to.eq(0);
|
|
43
|
+
api.plugins.Selection.selectItems(['gstcid-3']);
|
|
44
|
+
return $el;
|
|
45
|
+
})
|
|
46
|
+
.wait(Cypress.env('wait'))
|
|
47
|
+
.then(($el) => {
|
|
48
|
+
expect($el).to.have.class('gstc__selected');
|
|
49
|
+
})
|
|
50
|
+
.get(rightResizerSelector)
|
|
51
|
+
.should('be.visible')
|
|
52
|
+
.get('.gstc__chart-timeline-items-row-item[data-gstcid="gstcid-3"]')
|
|
53
|
+
.then(($el) => {
|
|
54
|
+
return cy.move(rightResizerSelector, -$el.width(), 0);
|
|
55
|
+
})
|
|
56
|
+
.then(() => {
|
|
57
|
+
const itemData: ItemData = state.get('$data.chart.items.gstcid-3');
|
|
58
|
+
api.scrollToTime(itemData.time.startDate.valueOf(), false);
|
|
59
|
+
})
|
|
60
|
+
.wait(Cypress.env('wait'))
|
|
61
|
+
.then(() => {
|
|
62
|
+
const itemData: ItemData = state.get('$data.chart.items.gstcid-3');
|
|
63
|
+
const time: DataChartTime = state.get('$data.chart.time');
|
|
64
|
+
const firstDate = time.levels[time.level][0];
|
|
65
|
+
if (url === '/examples/complex-1/index.html') {
|
|
66
|
+
expect(fixed(itemData.actualWidth)).to.eq(fixed(firstDate.currentView.width));
|
|
67
|
+
}
|
|
68
|
+
if (url === '/examples/item-types-plugin/index.html') {
|
|
69
|
+
const minWidth: number = state.get('config.chart.item.minWidth');
|
|
70
|
+
expect(fixed(itemData.actualWidth)).to.eq(fixed(minWidth));
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
.get('.gstc__chart-timeline-items-row-item-resizing-handle--right-outside[data-gstcid="gstcid-3"]')
|
|
74
|
+
.should('be.visible');
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
examples.forEach((example) => resizing(example));
|
|
79
|
+
|
|
80
|
+
it('should change item position programmatically in normal mode by changing item', () => {
|
|
81
|
+
let state, gstc;
|
|
82
|
+
cy.load('/examples/complex-1')
|
|
83
|
+
.window()
|
|
84
|
+
.then((win) => {
|
|
85
|
+
// @ts-ignore
|
|
86
|
+
state = win.state;
|
|
87
|
+
// @ts-ignore
|
|
88
|
+
gstc = win.gstc;
|
|
89
|
+
})
|
|
90
|
+
.then(() => {
|
|
91
|
+
state.update('config.chart.items.gstcid-15', (item) => {
|
|
92
|
+
item.time.start = gstc.api.time.date('2020-01-20').valueOf();
|
|
93
|
+
item.time.end = gstc.api.time.date('2020-01-24').endOf('day').valueOf();
|
|
94
|
+
return item;
|
|
95
|
+
});
|
|
96
|
+
})
|
|
97
|
+
.wait(Cypress.env('wait'))
|
|
98
|
+
.then(() => {
|
|
99
|
+
const item15 = state.get('$data.chart.items.gstcid-15');
|
|
100
|
+
expect(item15.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-20 00:00:00');
|
|
101
|
+
expect(item15.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-24 23:59:59');
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('should change item position programmatically in calculatedZoom mode by changing item', () => {
|
|
106
|
+
let state, gstc;
|
|
107
|
+
cy.load('/examples/one-month')
|
|
108
|
+
.window()
|
|
109
|
+
.then((win) => {
|
|
110
|
+
// @ts-ignore
|
|
111
|
+
state = win.state;
|
|
112
|
+
// @ts-ignore
|
|
113
|
+
gstc = win.gstc;
|
|
114
|
+
})
|
|
115
|
+
.then(() => {
|
|
116
|
+
state.update('config.chart.items.gstcid-15', (item) => {
|
|
117
|
+
item.time.start = gstc.api.time.date('2020-01-20').valueOf();
|
|
118
|
+
item.time.end = gstc.api.time.date('2020-01-24').endOf('day').valueOf();
|
|
119
|
+
return item;
|
|
120
|
+
});
|
|
121
|
+
})
|
|
122
|
+
.wait(Cypress.env('wait'))
|
|
123
|
+
.then(() => {
|
|
124
|
+
const item15 = state.get('$data.chart.items.gstcid-15');
|
|
125
|
+
expect(item15.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-20 00:00:00');
|
|
126
|
+
expect(item15.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-24 23:59:59');
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it('should move dependant items to the right position when all dates are available', () => {
|
|
131
|
+
let gstc, state;
|
|
132
|
+
const itemId = 'gstcid-5',
|
|
133
|
+
dep1Id = 'gstcid-7',
|
|
134
|
+
dep2Id = 'gstcid-9';
|
|
135
|
+
const itemClass = `.gstc__chart-timeline-items-row-item[data-gstcid="${itemId}"]`;
|
|
136
|
+
cy.load('/examples/complex-1')
|
|
137
|
+
.window()
|
|
138
|
+
.then((win) => {
|
|
139
|
+
// @ts-ignore
|
|
140
|
+
state = win.state;
|
|
141
|
+
// @ts-ignore
|
|
142
|
+
gstc = win.gstc;
|
|
143
|
+
state.update(`config.chart.items.${itemId}`, (item) => {
|
|
144
|
+
item.time.start = gstc.api.time.date('2020-02-18').valueOf();
|
|
145
|
+
item.time.end = gstc.api.time.date('2020-02-20').endOf('day').valueOf();
|
|
146
|
+
return item;
|
|
147
|
+
});
|
|
148
|
+
state.update(`config.chart.items.${dep1Id}`, (item) => {
|
|
149
|
+
item.time.start = gstc.api.time.date('2020-02-25').valueOf();
|
|
150
|
+
item.time.end = gstc.api.time.date('2020-02-26').endOf('day').valueOf();
|
|
151
|
+
return item;
|
|
152
|
+
});
|
|
153
|
+
state.update(`config.chart.items.${dep2Id}`, (item) => {
|
|
154
|
+
item.time.start = gstc.api.time.date('2020-02-26').valueOf();
|
|
155
|
+
item.time.end = gstc.api.time.date('2020-02-28').endOf('day').valueOf();
|
|
156
|
+
return item;
|
|
157
|
+
});
|
|
158
|
+
gstc.api.scrollToTime(gstc.api.time.date('2020-02-14').valueOf(), false);
|
|
159
|
+
})
|
|
160
|
+
.wait(Cypress.env('wait'))
|
|
161
|
+
.move(itemClass, -90, 0)
|
|
162
|
+
.then(() => {
|
|
163
|
+
const itemData: ItemData = gstc.api.getItemData(itemId);
|
|
164
|
+
expect(itemData.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-17 00:00:00');
|
|
165
|
+
expect(itemData.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-19 23:59:59');
|
|
166
|
+
const dep1Data: ItemData = gstc.api.getItemData(dep1Id);
|
|
167
|
+
expect(dep1Data.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-24 00:00:00');
|
|
168
|
+
expect(dep1Data.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-25 23:59:59');
|
|
169
|
+
const dep2Data: ItemData = gstc.api.getItemData(dep2Id);
|
|
170
|
+
expect(dep2Data.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-25 00:00:00');
|
|
171
|
+
expect(dep2Data.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-27 23:59:59');
|
|
172
|
+
})
|
|
173
|
+
.move(itemClass, 90, 0)
|
|
174
|
+
.then(() => {
|
|
175
|
+
const itemData: ItemData = gstc.api.getItemData(itemId);
|
|
176
|
+
expect(itemData.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-18 00:00:00');
|
|
177
|
+
expect(itemData.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-20 23:59:59');
|
|
178
|
+
const dep1Data: ItemData = gstc.api.getItemData(dep1Id);
|
|
179
|
+
expect(dep1Data.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-25 00:00:00');
|
|
180
|
+
expect(dep1Data.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-26 23:59:59');
|
|
181
|
+
const dep2Data: ItemData = gstc.api.getItemData(dep2Id);
|
|
182
|
+
expect(dep2Data.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-26 00:00:00');
|
|
183
|
+
expect(dep2Data.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-28 23:59:59');
|
|
184
|
+
})
|
|
185
|
+
.move(itemClass, -180, 0)
|
|
186
|
+
.then(() => {
|
|
187
|
+
const itemData: ItemData = gstc.api.getItemData(itemId);
|
|
188
|
+
expect(itemData.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-16 00:00:00');
|
|
189
|
+
expect(itemData.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-18 23:59:59');
|
|
190
|
+
const dep1Data: ItemData = gstc.api.getItemData(dep1Id);
|
|
191
|
+
expect(dep1Data.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-23 00:00:00');
|
|
192
|
+
expect(dep1Data.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-24 23:59:59');
|
|
193
|
+
const dep2Data: ItemData = gstc.api.getItemData(dep2Id);
|
|
194
|
+
expect(dep2Data.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-24 00:00:00');
|
|
195
|
+
expect(dep2Data.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-26 23:59:59');
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it('should move dependant items to the right position when some dates are removed (hide weekends)', () => {
|
|
200
|
+
let gstc, state;
|
|
201
|
+
const itemId = 'gstcid-5',
|
|
202
|
+
dep1Id = 'gstcid-7',
|
|
203
|
+
dep2Id = 'gstcid-9';
|
|
204
|
+
const itemClass = `.gstc__chart-timeline-items-row-item[data-gstcid="${itemId}"]`;
|
|
205
|
+
cy.load('/examples/complex-1')
|
|
206
|
+
.window()
|
|
207
|
+
.then((win) => {
|
|
208
|
+
// @ts-ignore
|
|
209
|
+
state = win.state;
|
|
210
|
+
// @ts-ignore
|
|
211
|
+
gstc = win.gstc;
|
|
212
|
+
state.update(`config.chart.items.${itemId}`, (item) => {
|
|
213
|
+
item.time.start = gstc.api.time.date('2020-02-18').valueOf();
|
|
214
|
+
item.time.end = gstc.api.time.date('2020-02-20').endOf('day').valueOf();
|
|
215
|
+
return item;
|
|
216
|
+
});
|
|
217
|
+
state.update(`config.chart.items.${dep1Id}`, (item) => {
|
|
218
|
+
item.time.start = gstc.api.time.date('2020-02-25').valueOf();
|
|
219
|
+
item.time.end = gstc.api.time.date('2020-02-26').endOf('day').valueOf();
|
|
220
|
+
return item;
|
|
221
|
+
});
|
|
222
|
+
state.update(`config.chart.items.${dep2Id}`, (item) => {
|
|
223
|
+
item.time.start = gstc.api.time.date('2020-02-26').valueOf();
|
|
224
|
+
item.time.end = gstc.api.time.date('2020-02-28').endOf('day').valueOf();
|
|
225
|
+
return item;
|
|
226
|
+
});
|
|
227
|
+
gstc.api.scrollToTime(gstc.api.time.date('2020-02-14').valueOf(), false);
|
|
228
|
+
})
|
|
229
|
+
.get('#hide-weekends')
|
|
230
|
+
.click()
|
|
231
|
+
.wait(Cypress.env('wait'))
|
|
232
|
+
.move(itemClass, -90, 0)
|
|
233
|
+
.then(() => {
|
|
234
|
+
const itemData: ItemData = gstc.api.getItemData(itemId);
|
|
235
|
+
expect(itemData.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-17 00:00:00');
|
|
236
|
+
expect(itemData.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-19 23:59:59');
|
|
237
|
+
const dep1Data: ItemData = gstc.api.getItemData(dep1Id);
|
|
238
|
+
expect(dep1Data.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-24 00:00:00');
|
|
239
|
+
expect(dep1Data.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-25 23:59:59');
|
|
240
|
+
const dep2Data: ItemData = gstc.api.getItemData(dep2Id);
|
|
241
|
+
expect(dep2Data.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-25 00:00:00');
|
|
242
|
+
expect(dep2Data.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-27 23:59:59');
|
|
243
|
+
})
|
|
244
|
+
.move(itemClass, 90, 0)
|
|
245
|
+
.then(() => {
|
|
246
|
+
const itemData: ItemData = gstc.api.getItemData(itemId);
|
|
247
|
+
expect(itemData.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-18 00:00:00');
|
|
248
|
+
expect(itemData.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-20 23:59:59');
|
|
249
|
+
const dep1Data: ItemData = gstc.api.getItemData(dep1Id);
|
|
250
|
+
expect(dep1Data.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-25 00:00:00');
|
|
251
|
+
expect(dep1Data.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-26 23:59:59');
|
|
252
|
+
const dep2Data: ItemData = gstc.api.getItemData(dep2Id);
|
|
253
|
+
expect(dep2Data.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-26 00:00:00');
|
|
254
|
+
expect(dep2Data.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-28 23:59:59');
|
|
255
|
+
})
|
|
256
|
+
.move(itemClass, -180, 0)
|
|
257
|
+
.then(() => {
|
|
258
|
+
const itemData: ItemData = gstc.api.getItemData(itemId);
|
|
259
|
+
expect(itemData.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-14 00:00:00');
|
|
260
|
+
expect(itemData.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-18 23:59:59');
|
|
261
|
+
const dep1Data: ItemData = gstc.api.getItemData(dep1Id);
|
|
262
|
+
expect(dep1Data.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-21 00:00:00');
|
|
263
|
+
expect(dep1Data.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-24 23:59:59');
|
|
264
|
+
const dep2Data: ItemData = gstc.api.getItemData(dep2Id);
|
|
265
|
+
expect(dep2Data.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-24 00:00:00');
|
|
266
|
+
expect(dep2Data.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-26 23:59:59');
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
it('should move dependant items to the right position when all dates are available in calculatedZoomMode', () => {
|
|
271
|
+
let gstc, state;
|
|
272
|
+
const itemId = 'gstcid-5',
|
|
273
|
+
dep1Id = 'gstcid-7',
|
|
274
|
+
dep2Id = 'gstcid-9';
|
|
275
|
+
const itemClass = `.gstc__chart-timeline-items-row-item[data-gstcid="${itemId}"]`;
|
|
276
|
+
const cellWidth = 36;
|
|
277
|
+
cy.load('/examples/one-month')
|
|
278
|
+
.window()
|
|
279
|
+
.then((win) => {
|
|
280
|
+
// @ts-ignore
|
|
281
|
+
state = win.state;
|
|
282
|
+
// @ts-ignore
|
|
283
|
+
gstc = win.gstc;
|
|
284
|
+
state.update(`config.chart.items.${itemId}`, (item) => {
|
|
285
|
+
item.time.start = gstc.api.time.date('2020-01-14').valueOf();
|
|
286
|
+
item.time.end = gstc.api.time.date('2020-01-16').endOf('day').valueOf();
|
|
287
|
+
return item;
|
|
288
|
+
});
|
|
289
|
+
state.update(`config.chart.items.${dep1Id}`, (item) => {
|
|
290
|
+
item.time.start = gstc.api.time.date('2020-01-21').valueOf();
|
|
291
|
+
item.time.end = gstc.api.time.date('2020-01-22').endOf('day').valueOf();
|
|
292
|
+
return item;
|
|
293
|
+
});
|
|
294
|
+
state.update(`config.chart.items.${dep2Id}`, (item) => {
|
|
295
|
+
item.time.start = gstc.api.time.date('2020-01-22').valueOf();
|
|
296
|
+
item.time.end = gstc.api.time.date('2020-01-24').endOf('day').valueOf();
|
|
297
|
+
return item;
|
|
298
|
+
});
|
|
299
|
+
})
|
|
300
|
+
.wait(Cypress.env('wait'))
|
|
301
|
+
.move(itemClass, -cellWidth, 0)
|
|
302
|
+
.then(() => {
|
|
303
|
+
const itemData: ItemData = gstc.api.getItemData(itemId);
|
|
304
|
+
expect(itemData.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-13 00:00:00');
|
|
305
|
+
expect(itemData.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-15 23:59:59');
|
|
306
|
+
const dep1Data: ItemData = gstc.api.getItemData(dep1Id);
|
|
307
|
+
expect(dep1Data.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-20 00:00:00');
|
|
308
|
+
expect(dep1Data.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-21 23:59:59');
|
|
309
|
+
const dep2Data: ItemData = gstc.api.getItemData(dep2Id);
|
|
310
|
+
expect(dep2Data.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-21 00:00:00');
|
|
311
|
+
expect(dep2Data.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-23 23:59:59');
|
|
312
|
+
})
|
|
313
|
+
.move(itemClass, cellWidth, 0)
|
|
314
|
+
.then(() => {
|
|
315
|
+
const itemData: ItemData = gstc.api.getItemData(itemId);
|
|
316
|
+
expect(itemData.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-14 00:00:00');
|
|
317
|
+
expect(itemData.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-16 23:59:59');
|
|
318
|
+
const dep1Data: ItemData = gstc.api.getItemData(dep1Id);
|
|
319
|
+
expect(dep1Data.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-21 00:00:00');
|
|
320
|
+
expect(dep1Data.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-22 23:59:59');
|
|
321
|
+
const dep2Data: ItemData = gstc.api.getItemData(dep2Id);
|
|
322
|
+
expect(dep2Data.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-22 00:00:00');
|
|
323
|
+
expect(dep2Data.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-24 23:59:59');
|
|
324
|
+
})
|
|
325
|
+
.move(itemClass, -(2 * cellWidth), 0)
|
|
326
|
+
.then(() => {
|
|
327
|
+
const itemData: ItemData = gstc.api.getItemData(itemId);
|
|
328
|
+
expect(itemData.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-12 00:00:00');
|
|
329
|
+
expect(itemData.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-14 23:59:59');
|
|
330
|
+
const dep1Data: ItemData = gstc.api.getItemData(dep1Id);
|
|
331
|
+
expect(dep1Data.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-19 00:00:00');
|
|
332
|
+
expect(dep1Data.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-20 23:59:59');
|
|
333
|
+
const dep2Data: ItemData = gstc.api.getItemData(dep2Id);
|
|
334
|
+
expect(dep2Data.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-20 00:00:00');
|
|
335
|
+
expect(dep2Data.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-22 23:59:59');
|
|
336
|
+
});
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
it('should move dependant items to the right position when some dates are removed (hide weekends) in calculatedZoomMode', () => {
|
|
340
|
+
let gstc, state;
|
|
341
|
+
const itemId = 'gstcid-5',
|
|
342
|
+
dep1Id = 'gstcid-7',
|
|
343
|
+
dep2Id = 'gstcid-9';
|
|
344
|
+
const itemClass = `.gstc__chart-timeline-items-row-item[data-gstcid="${itemId}"]`;
|
|
345
|
+
const cellWidth = 50;
|
|
346
|
+
cy.load('/examples/one-month')
|
|
347
|
+
.window()
|
|
348
|
+
.then((win) => {
|
|
349
|
+
// @ts-ignore
|
|
350
|
+
state = win.state;
|
|
351
|
+
// @ts-ignore
|
|
352
|
+
gstc = win.gstc;
|
|
353
|
+
state.update(`config.chart.items.${itemId}`, (item) => {
|
|
354
|
+
item.time.start = gstc.api.time.date('2020-01-14').valueOf();
|
|
355
|
+
item.time.end = gstc.api.time.date('2020-01-16').endOf('day').valueOf();
|
|
356
|
+
return item;
|
|
357
|
+
});
|
|
358
|
+
state.update(`config.chart.items.${dep1Id}`, (item) => {
|
|
359
|
+
item.time.start = gstc.api.time.date('2020-01-21').valueOf();
|
|
360
|
+
item.time.end = gstc.api.time.date('2020-01-22').endOf('day').valueOf();
|
|
361
|
+
return item;
|
|
362
|
+
});
|
|
363
|
+
state.update(`config.chart.items.${dep2Id}`, (item) => {
|
|
364
|
+
item.time.start = gstc.api.time.date('2020-01-22').valueOf();
|
|
365
|
+
item.time.end = gstc.api.time.date('2020-01-24').endOf('day').valueOf();
|
|
366
|
+
return item;
|
|
367
|
+
});
|
|
368
|
+
})
|
|
369
|
+
.get('#hide-weekends')
|
|
370
|
+
.click()
|
|
371
|
+
.wait(Cypress.env('wait'))
|
|
372
|
+
.move(itemClass, -cellWidth, 0)
|
|
373
|
+
.then(() => {
|
|
374
|
+
const itemData: ItemData = gstc.api.getItemData(itemId);
|
|
375
|
+
expect(itemData.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-13 00:00:00');
|
|
376
|
+
expect(itemData.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-15 23:59:59');
|
|
377
|
+
const dep1Data: ItemData = gstc.api.getItemData(dep1Id);
|
|
378
|
+
expect(dep1Data.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-20 00:00:00');
|
|
379
|
+
expect(dep1Data.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-21 23:59:59');
|
|
380
|
+
const dep2Data: ItemData = gstc.api.getItemData(dep2Id);
|
|
381
|
+
expect(dep2Data.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-21 00:00:00');
|
|
382
|
+
expect(dep2Data.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-23 23:59:59');
|
|
383
|
+
})
|
|
384
|
+
.move(itemClass, cellWidth, 0)
|
|
385
|
+
.then(() => {
|
|
386
|
+
const itemData: ItemData = gstc.api.getItemData(itemId);
|
|
387
|
+
expect(itemData.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-14 00:00:00');
|
|
388
|
+
expect(itemData.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-16 23:59:59');
|
|
389
|
+
const dep1Data: ItemData = gstc.api.getItemData(dep1Id);
|
|
390
|
+
expect(dep1Data.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-21 00:00:00');
|
|
391
|
+
expect(dep1Data.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-22 23:59:59');
|
|
392
|
+
const dep2Data: ItemData = gstc.api.getItemData(dep2Id);
|
|
393
|
+
expect(dep2Data.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-22 00:00:00');
|
|
394
|
+
expect(dep2Data.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-24 23:59:59');
|
|
395
|
+
})
|
|
396
|
+
.move(itemClass, -(2 * cellWidth), 0)
|
|
397
|
+
.then(() => {
|
|
398
|
+
const itemData: ItemData = gstc.api.getItemData(itemId);
|
|
399
|
+
expect(itemData.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-10 00:00:00');
|
|
400
|
+
expect(itemData.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-14 23:59:59');
|
|
401
|
+
const dep1Data: ItemData = gstc.api.getItemData(dep1Id);
|
|
402
|
+
expect(dep1Data.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-17 00:00:00');
|
|
403
|
+
expect(dep1Data.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-20 23:59:59');
|
|
404
|
+
const dep2Data: ItemData = gstc.api.getItemData(dep2Id);
|
|
405
|
+
expect(dep2Data.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-20 00:00:00');
|
|
406
|
+
expect(dep2Data.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-22 23:59:59');
|
|
407
|
+
});
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
it('should not change item width when item ends in missing date', () => {
|
|
411
|
+
let gstc, state;
|
|
412
|
+
const itemId = 'gstcid-15';
|
|
413
|
+
const itemClass = `.gstc__chart-timeline-items-row-item[data-gstcid="${itemId}"]`;
|
|
414
|
+
let cellWidth;
|
|
415
|
+
cy.load('/examples/complex-1')
|
|
416
|
+
.window()
|
|
417
|
+
.then((win) => {
|
|
418
|
+
// @ts-ignore
|
|
419
|
+
gstc = win.gstc;
|
|
420
|
+
// @ts-ignore
|
|
421
|
+
state = win.state;
|
|
422
|
+
state.update(`config.chart.items.${itemId}`, (item: Item) => {
|
|
423
|
+
item.time.start = gstc.api.time.date('2020-02-07').valueOf();
|
|
424
|
+
item.time.end = gstc.api.time.date('2020-02-08').endOf('day').valueOf();
|
|
425
|
+
return item;
|
|
426
|
+
});
|
|
427
|
+
})
|
|
428
|
+
.get('#hide-weekends')
|
|
429
|
+
.click()
|
|
430
|
+
.wait(Cypress.env('wait'))
|
|
431
|
+
.then(() => {
|
|
432
|
+
const cell: DataChartTimeLevelDate = state.get('$data.chart.time.allDates.1.0');
|
|
433
|
+
cellWidth = cell.width;
|
|
434
|
+
const itemData: ItemData = state.get(`$data.chart.items.${itemId}`);
|
|
435
|
+
expect(itemData.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-07 00:00:00');
|
|
436
|
+
expect(itemData.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-08 23:59:59');
|
|
437
|
+
expect(itemData.width).to.eq(itemData.actualWidth);
|
|
438
|
+
expect(itemData.width).to.eq(cellWidth);
|
|
439
|
+
expect(itemData.position.right).to.eq(cellWidth * 5);
|
|
440
|
+
})
|
|
441
|
+
.move(itemClass, 25, 0)
|
|
442
|
+
.then(() => {
|
|
443
|
+
const itemData: ItemData = state.get(`$data.chart.items.${itemId}`);
|
|
444
|
+
expect(itemData.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-07 00:00:00');
|
|
445
|
+
expect(itemData.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-02-07 23:59:59');
|
|
446
|
+
expect(itemData.width).to.eq(itemData.actualWidth);
|
|
447
|
+
expect(itemData.width).to.eq(cellWidth);
|
|
448
|
+
expect(itemData.position.right).to.eq(cellWidth * 5);
|
|
449
|
+
});
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
// it('should change item position programmatically in normal mode by changing item.time', () => {
|
|
453
|
+
// let state, gstc;
|
|
454
|
+
// cy.load('/examples/complex-1')
|
|
455
|
+
// .window()
|
|
456
|
+
// .then((win) => {
|
|
457
|
+
// // @ts-ignore
|
|
458
|
+
// state = win.state;
|
|
459
|
+
// // @ts-ignore
|
|
460
|
+
// gstc = win.gstc;
|
|
461
|
+
// })
|
|
462
|
+
// .then(() => {
|
|
463
|
+
// state.update('config.chart.items.gstcid-15.time', (itemTime) => {
|
|
464
|
+
// itemTime.start = gstc.api.time.date('2020-01-20').valueOf();
|
|
465
|
+
// itemTime.end = gstc.api.time.date('2020-01-24').endOf('day').valueOf();
|
|
466
|
+
// return itemTime;
|
|
467
|
+
// });
|
|
468
|
+
// })
|
|
469
|
+
// .wait(Cypress.env('wait'))
|
|
470
|
+
// .then(() => {
|
|
471
|
+
// const item15 = state.get('$data.chart.items.gstcid-15');
|
|
472
|
+
// expect(item15.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-20 00:00:00');
|
|
473
|
+
// expect(item15.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-24 23:59:59');
|
|
474
|
+
// });
|
|
475
|
+
// });
|
|
476
|
+
|
|
477
|
+
// it('should change item position programmatically in calculatedZoom mode by changing item.time', () => {
|
|
478
|
+
// let state, gstc;
|
|
479
|
+
// cy.load('/examples/one-month')
|
|
480
|
+
// .window()
|
|
481
|
+
// .then((win) => {
|
|
482
|
+
// // @ts-ignore
|
|
483
|
+
// state = win.state;
|
|
484
|
+
// // @ts-ignore
|
|
485
|
+
// gstc = win.gstc;
|
|
486
|
+
// })
|
|
487
|
+
// .then(() => {
|
|
488
|
+
// state.update('config.chart.items.gstcid-15.time', (itemTime) => {
|
|
489
|
+
// itemTime.start = gstc.api.time.date('2020-01-20').valueOf();
|
|
490
|
+
// itemTime.end = gstc.api.time.date('2020-01-24').endOf('day').valueOf();
|
|
491
|
+
// return itemTime;
|
|
492
|
+
// });
|
|
493
|
+
// })
|
|
494
|
+
// .wait(Cypress.env('wait'))
|
|
495
|
+
// .then(() => {
|
|
496
|
+
// const item15 = state.get('$data.chart.items.gstcid-15');
|
|
497
|
+
// expect(item15.time.startDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-20 00:00:00');
|
|
498
|
+
// expect(item15.time.endDate.format('YYYY-MM-DD HH:mm:ss')).to.eq('2020-01-24 23:59:59');
|
|
499
|
+
// });
|
|
500
|
+
// });
|
|
501
|
+
});
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import DeepState from 'deep-state-observer';
|
|
2
|
+
import { fixed } from '../helpers';
|
|
3
|
+
|
|
4
|
+
function getColumns(state) {
|
|
5
|
+
const id = state.get('config.list.columns.data.gstcid-id');
|
|
6
|
+
const name = state.get('config.list.columns.data.gstcid-name');
|
|
7
|
+
const surname = state.get('config.list.columns.data.gstcid-surname');
|
|
8
|
+
const progress = state.get('config.list.columns.data.gstcid-progress');
|
|
9
|
+
return { id, name, surname, progress };
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
describe('List columns toggle', () => {
|
|
13
|
+
it('should toggle columns', () => {
|
|
14
|
+
let state: DeepState;
|
|
15
|
+
cy.load('/examples/list-columns-toggle')
|
|
16
|
+
.window()
|
|
17
|
+
.then((win) => {
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
state = win.state;
|
|
20
|
+
const { id, name, surname, progress } = getColumns(state);
|
|
21
|
+
expect(id.width).to.eq(80);
|
|
22
|
+
expect(name.width).to.eq(230);
|
|
23
|
+
expect(surname.width).to.eq(230);
|
|
24
|
+
expect(progress.width).to.eq(50);
|
|
25
|
+
})
|
|
26
|
+
.get('.gstc__list-column-header[data-gstcid="gstcid-id"]')
|
|
27
|
+
.should('be.visible')
|
|
28
|
+
.get('.gstc__list-column-header[data-gstcid="gstcid-name"]')
|
|
29
|
+
.should('be.visible')
|
|
30
|
+
.get('.gstc__list-column-header[data-gstcid="gstcid-surname"]')
|
|
31
|
+
.should('be.visible')
|
|
32
|
+
.get('.gstc__list-column-header[data-gstcid="gstcid-progress"]')
|
|
33
|
+
.should('be.visible')
|
|
34
|
+
.get('.gstc__list')
|
|
35
|
+
.then(($el) => {
|
|
36
|
+
const { id, name, surname, progress } = getColumns(state);
|
|
37
|
+
expect(id.hidden).to.eq(false);
|
|
38
|
+
expect(name.hidden).to.eq(false);
|
|
39
|
+
expect(surname.hidden).to.eq(false);
|
|
40
|
+
expect(progress.hidden).to.eq(false);
|
|
41
|
+
expect(fixed($el.width())).to.eq(fixed(id.width + name.width + surname.width + progress.width));
|
|
42
|
+
})
|
|
43
|
+
//
|
|
44
|
+
.get('#id')
|
|
45
|
+
.click()
|
|
46
|
+
.get('.gstc__list-column-header[data-gstcid="gstcid-id"]')
|
|
47
|
+
.should('not.exist')
|
|
48
|
+
.get('.gstc__list-column-header[data-gstcid="gstcid-name"]')
|
|
49
|
+
.should('be.visible')
|
|
50
|
+
.get('.gstc__list-column-header[data-gstcid="gstcid-surname"]')
|
|
51
|
+
.should('be.visible')
|
|
52
|
+
.get('.gstc__list-column-header[data-gstcid="gstcid-progress"]')
|
|
53
|
+
.should('be.visible')
|
|
54
|
+
.get('.gstc__list')
|
|
55
|
+
.then(($el) => {
|
|
56
|
+
const { id, name, surname, progress } = getColumns(state);
|
|
57
|
+
expect(id.hidden).to.eq(true);
|
|
58
|
+
expect(name.hidden).to.eq(false);
|
|
59
|
+
expect(surname.hidden).to.eq(false);
|
|
60
|
+
expect(progress.hidden).to.eq(false);
|
|
61
|
+
expect(fixed($el.width())).to.eq(fixed(name.width + surname.width + progress.width));
|
|
62
|
+
})
|
|
63
|
+
//
|
|
64
|
+
.get('#name')
|
|
65
|
+
.click()
|
|
66
|
+
.get('.gstc__list-column-header[data-gstcid="gstcid-id"]')
|
|
67
|
+
.should('not.exist')
|
|
68
|
+
.get('.gstc__list-column-header[data-gstcid="gstcid-name"]')
|
|
69
|
+
.should('not.exist')
|
|
70
|
+
.get('.gstc__list-column-header[data-gstcid="gstcid-surname"]')
|
|
71
|
+
.should('be.visible')
|
|
72
|
+
.get('.gstc__list-column-header[data-gstcid="gstcid-progress"]')
|
|
73
|
+
.should('be.visible')
|
|
74
|
+
.get('.gstc__list')
|
|
75
|
+
.then(($el) => {
|
|
76
|
+
const { id, name, surname, progress } = getColumns(state);
|
|
77
|
+
expect(id.hidden).to.eq(true);
|
|
78
|
+
expect(name.hidden).to.eq(true);
|
|
79
|
+
expect(surname.hidden).to.eq(false);
|
|
80
|
+
expect(progress.hidden).to.eq(false);
|
|
81
|
+
expect(fixed($el.width())).to.eq(fixed(surname.width + progress.width));
|
|
82
|
+
})
|
|
83
|
+
//
|
|
84
|
+
.get('#surname')
|
|
85
|
+
.click()
|
|
86
|
+
.get('.gstc__list-column-header[data-gstcid="gstcid-id"]')
|
|
87
|
+
.should('not.exist')
|
|
88
|
+
.get('.gstc__list-column-header[data-gstcid="gstcid-name"]')
|
|
89
|
+
.should('not.exist')
|
|
90
|
+
.get('.gstc__list-column-header[data-gstcid="gstcid-surname"]')
|
|
91
|
+
.should('not.exist')
|
|
92
|
+
.get('.gstc__list-column-header[data-gstcid="gstcid-progress"]')
|
|
93
|
+
.should('be.visible')
|
|
94
|
+
.get('.gstc__list')
|
|
95
|
+
.then(($el) => {
|
|
96
|
+
const { id, name, surname, progress } = getColumns(state);
|
|
97
|
+
expect(id.hidden).to.eq(true);
|
|
98
|
+
expect(name.hidden).to.eq(true);
|
|
99
|
+
expect(surname.hidden).to.eq(true);
|
|
100
|
+
expect(progress.hidden).to.eq(false);
|
|
101
|
+
expect(fixed($el.width())).to.eq(fixed(progress.width));
|
|
102
|
+
})
|
|
103
|
+
//
|
|
104
|
+
.get('#progress')
|
|
105
|
+
.click()
|
|
106
|
+
.get('.gstc__list-column-header[data-gstcid="gstcid-id"]')
|
|
107
|
+
.should('not.exist')
|
|
108
|
+
.get('.gstc__list-column-header[data-gstcid="gstcid-name"]')
|
|
109
|
+
.should('not.exist')
|
|
110
|
+
.get('.gstc__list-column-header[data-gstcid="gstcid-surname"]')
|
|
111
|
+
.should('not.exist')
|
|
112
|
+
.get('.gstc__list-column-header[data-gstcid="gstcid-progress"]')
|
|
113
|
+
.should('not.exist')
|
|
114
|
+
.get('.gstc__list')
|
|
115
|
+
.then(($el) => {
|
|
116
|
+
const { id, name, surname, progress } = getColumns(state);
|
|
117
|
+
expect(id.hidden).to.eq(true);
|
|
118
|
+
expect(name.hidden).to.eq(true);
|
|
119
|
+
expect(surname.hidden).to.eq(true);
|
|
120
|
+
expect(progress.hidden).to.eq(true);
|
|
121
|
+
expect(fixed($el.width())).to.eq(0);
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
describe('List header', () => {
|
|
2
|
+
it('should stay at similar time when changing list column width', () => {
|
|
3
|
+
let state,
|
|
4
|
+
initialDataIndex = 0,
|
|
5
|
+
timeFrom;
|
|
6
|
+
cy.load('/examples/add-rows-items')
|
|
7
|
+
.window()
|
|
8
|
+
.then((win) => {
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
state = win.state;
|
|
11
|
+
})
|
|
12
|
+
.wait(200) // wait for scroll event on gstc-loaded
|
|
13
|
+
.get('.gstc__chart-timeline-grid-row-cell.current')
|
|
14
|
+
.should('be.visible')
|
|
15
|
+
.then(() => {
|
|
16
|
+
initialDataIndex = state.get('$data.scroll.horizontal.dataIndex');
|
|
17
|
+
timeFrom = state.get('$data.chart.time.fromDate');
|
|
18
|
+
state.update('config.list.columns.data.gstcid-label.width', 100);
|
|
19
|
+
})
|
|
20
|
+
.wait(100)
|
|
21
|
+
.then(() => {
|
|
22
|
+
const currentDataIndex = state.get('$data.scroll.horizontal.dataIndex');
|
|
23
|
+
const currentTimeFrom = state.get('$data.chart.time.fromDate');
|
|
24
|
+
expect(initialDataIndex).to.eq(currentDataIndex);
|
|
25
|
+
expect(timeFrom.format('YYYY-MM-DD')).to.eq(currentTimeFrom.format('YYYY-MM-DD'));
|
|
26
|
+
})
|
|
27
|
+
.get('.gstc__chart-timeline-grid-row-cell.current')
|
|
28
|
+
.should('be.visible');
|
|
29
|
+
});
|
|
30
|
+
});
|