@progress/kendo-common-tasks 8.0.7-dev.0 → 8.0.7-dev.18
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/README.md +2 -3
- package/index.js +5 -50
- package/package.json +13 -52
- package/docs-layout.hbs +0 -51
- package/docs-public/bootstrap.css +0 -6759
- package/docs-public/bootstrap.min.js +0 -7
- package/docs-public/codemirror/clike.min.js +0 -1
- package/docs-public/codemirror/codemirror.min.js +0 -5
- package/docs-public/codemirror/css.min.js +0 -1
- package/docs-public/codemirror/htmlmixed.min.js +0 -1
- package/docs-public/codemirror/javascript.min.js +0 -1
- package/docs-public/codemirror/jsx.min.js +0 -1
- package/docs-public/codemirror/php.min.js +0 -1
- package/docs-public/codemirror/runmode.min.js +0 -1
- package/docs-public/codemirror/xml.min.js +0 -1
- package/docs-public/docs.css +0 -208
- package/docs-public/docs.scss +0 -253
- package/docs-public/editor/angular/app/app.component.ts +0 -3
- package/docs-public/editor/angular/app/app.module.ts +0 -14
- package/docs-public/editor/angular/index.html +0 -32
- package/docs-public/editor/angular/main.ts +0 -15
- package/docs-public/editor/angular/polyfills.ts +0 -73
- package/docs-public/editor/angular/styles.css +0 -13
- package/docs-public/editor/builder/app/app.component.html +0 -1
- package/docs-public/editor/builder/app/app.component.ts +0 -17
- package/docs-public/editor/builder/app/app.css +0 -449
- package/docs-public/editor/builder/app/app.module.ts +0 -53
- package/docs-public/editor/builder/app/core/core.module.ts +0 -19
- package/docs-public/editor/builder/app/core/data/data-services.exports.ts +0 -71
- package/docs-public/editor/builder/app/core/data/data.service.ts +0 -183
- package/docs-public/editor/builder/app/core/data/odata-service-factory.ts +0 -23
- package/docs-public/editor/builder/app/core/data/odata.service.ts +0 -88
- package/docs-public/editor/builder/app/core/module.config.ts +0 -19
- package/docs-public/editor/builder/app/data/odata-provider/customer.config.ts +0 -17
- package/docs-public/editor/builder/app/data/odata-provider/customer.model.ts +0 -17
- package/docs-public/editor/builder/app/grid-demo.base.component.ts +0 -107
- package/docs-public/editor/builder/app/grid-demo.component.html +0 -37
- package/docs-public/editor/builder/app/grid-demo.component.ts +0 -1
- package/docs-public/editor/builder/app/shared/components/grid/grid.component.html +0 -5
- package/docs-public/editor/builder/app/shared/components/grid/grid.component.ts +0 -243
- package/docs-public/editor/builder/app/shared/services/grid-incell-editing.service.ts +0 -120
- package/docs-public/editor/builder/app/topSection.html +0 -12
- package/docs-public/editor/builder/app/topSection.ts +0 -25
- package/docs-public/editor/builder/assets/themes/metro.css +0 -18877
- package/docs-public/editor/builder/index.html +0 -14
- package/docs-public/editor/builder/main.ts +0 -14
- package/docs-public/editor/builder/polyfills.ts +0 -67
- package/docs-public/editor/builder/styles.css +0 -1
- package/docs-public/editor/builder/tsconfig.app.json +0 -13
- package/docs-public/editor/builder/typings.d.ts +0 -5
- package/docs-public/editor/react/app/main.jsx +0 -6
- package/docs-public/editor/react/index.html +0 -32
- package/docs-public/editor/vue/app/main.js +0 -5
- package/docs-public/editor/vue/index.html +0 -29
- package/docs-public/example-runner.js +0 -802
- package/docs-public/github.css +0 -99
- package/docs-public/snippets.js +0 -1722
- package/docs-public/tomorrow-night.css +0 -75
- package/docs-server.js +0 -152
- package/lint-slugs.js +0 -25
- package/markdown-serve/index.js +0 -10
- package/markdown-serve/parser.js +0 -234
- package/markdown-serve/resolver.js +0 -86
- package/markdown-serve/server.js +0 -370
- package/test/jest-setup.js +0 -2
- package/test/snippets.test.js +0 -373
package/test/snippets.test.js
DELETED
|
@@ -1,373 +0,0 @@
|
|
|
1
|
-
const snippets = require('../docs-public/snippets.js');
|
|
2
|
-
|
|
3
|
-
describe('inferring stackblitz templates', () => {
|
|
4
|
-
const templateName = snippets.getStackBlitzTemplate;
|
|
5
|
-
|
|
6
|
-
// ```ts in Angular examples
|
|
7
|
-
test('marks ts examples as angular-cli', () => {
|
|
8
|
-
expect(templateName({ ts: 'foo' })).toBe('angular-cli');
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
// ```jsx in all React examples
|
|
12
|
-
test('marks jsx examples as create-react-app', () => {
|
|
13
|
-
expect(templateName({ jsx: 'foo' })).toBe('create-react-app');
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
// ```js in all Vue examples
|
|
17
|
-
test('marks js examples as javascript', () => {
|
|
18
|
-
expect(templateName({ js: 'foo' })).toBe('javascript');
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
// ```html in the Styling/Icons help topic
|
|
22
|
-
test('marks html examples as javascript', () => {
|
|
23
|
-
expect(templateName({ html: 'foo' })).toBe('javascript');
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
// embed_file in DataQuery/Drawing examples
|
|
27
|
-
test('marks js examples as javascript', () => {
|
|
28
|
-
expect(templateName({
|
|
29
|
-
'multifile-listing': [
|
|
30
|
-
{ name: 'main.js' }
|
|
31
|
-
]
|
|
32
|
-
})).toBe('javascript');
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
// embed_file in Angular examples
|
|
36
|
-
test('marks multi-file ts examples as angular-cli', () => {
|
|
37
|
-
expect(templateName({
|
|
38
|
-
'multifile-listing': [
|
|
39
|
-
{ name: 'main.ts' }
|
|
40
|
-
]
|
|
41
|
-
})).toBe('angular-cli');
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
describe('preparing snippets for editing', () => {
|
|
46
|
-
test('returns a promise', () => {
|
|
47
|
-
expect(typeof snippets.prepareSnippet({}, {}).then).toBe('function');
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
test('resolves to an object', () => {
|
|
51
|
-
expect(snippets.prepareSnippet({}, {})).resolves.toBe({});
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
test('adds .angular-cli.json for angular snippets', async () => {
|
|
55
|
-
const files = await snippets.prepareSnippet({ platform: 'angular' }, {});
|
|
56
|
-
|
|
57
|
-
expect(files['.angular-cli.json']).not.toBeFalsy();
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
test('adds index.js for react snippets', async () => {
|
|
61
|
-
const files = await snippets.prepareSnippet(
|
|
62
|
-
{ platform: 'react' },
|
|
63
|
-
{ jsx: 'foo' }
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
expect(files['index.js']).toBe('import "./app/main";');
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
test('posts HTML-only snippets', async () => {
|
|
70
|
-
const files = await snippets.prepareSnippet(
|
|
71
|
-
{ npmUrl: 'https://unpkg.com' },
|
|
72
|
-
{ html: 'foobar' }
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
expect(files['index.html']).toBeTruthy();
|
|
76
|
-
expect(files['index.html']).toContain('foobar');
|
|
77
|
-
expect(files['index.html']).toContain('unpkg.com/@progress/kendo-theme-default');
|
|
78
|
-
|
|
79
|
-
expect(files['index.js']).toBe(''); // because stackblitz
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
test('adds index.js for vanilla js snippets', async () => {
|
|
83
|
-
const files = await snippets.prepareSnippet(
|
|
84
|
-
{},
|
|
85
|
-
{
|
|
86
|
-
'multifile-listing': [
|
|
87
|
-
{ name: 'main.js', content: 'foo' }
|
|
88
|
-
],
|
|
89
|
-
js: 'foo'
|
|
90
|
-
}
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
expect(files['index.js']).toBe('foo');
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
test('passes argument files in result', async () => {
|
|
97
|
-
const files = await snippets.prepareSnippet(
|
|
98
|
-
{}, {}, { 'foo.js': 'foo' }
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
expect(files['foo.js']).toBe('foo');
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
test('removes angular module from angular-cli template', async () => {
|
|
105
|
-
const files = await snippets.prepareSnippet(
|
|
106
|
-
{ platform: 'angular' }, {}, { 'app/main.ts': 'foo' }
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
expect(files['app/main.ts']).toBeFalsy();
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
test('runs vue snippets in javascript templates', async () => {
|
|
113
|
-
const files = await snippets.prepareSnippet(
|
|
114
|
-
{},
|
|
115
|
-
{
|
|
116
|
-
js: "foo",
|
|
117
|
-
html: "bar"
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
'app/main.es': 'foo',
|
|
121
|
-
'index.html': 'baz'
|
|
122
|
-
}
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
expect(files['index.html']).toBe('baz');
|
|
126
|
-
expect(files['index.js']).toBe('import "./app/main";');
|
|
127
|
-
expect(files['app/main.js']).toBe('foo');
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
test('imports @progress/kendo-ui package correctly', async () => {
|
|
131
|
-
const exportStatement = snippets.toModuleImport({
|
|
132
|
-
import: "kendo",
|
|
133
|
-
main: "js/kendo.all.js",
|
|
134
|
-
module: "@progress/kendo-ui"
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
expect(exportStatement).toBe("import '@progress/kendo-ui';");
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
// required as long as stackblitz has no jsx file support
|
|
141
|
-
// see https://github.com/stackblitz/core/issues/370#issuecomment-379365823
|
|
142
|
-
describe('renames jsx to js', () => {
|
|
143
|
-
test('with embed_file of single main.jsx', async () => {
|
|
144
|
-
const files = await snippets.prepareSnippet(
|
|
145
|
-
{ platform: 'react' },
|
|
146
|
-
{
|
|
147
|
-
'multifile-listing': [
|
|
148
|
-
{ name: 'main.jsx', content: 'foo' }
|
|
149
|
-
],
|
|
150
|
-
jsx: 'foo'
|
|
151
|
-
}
|
|
152
|
-
);
|
|
153
|
-
|
|
154
|
-
expect(files['app/main.js']).toBe('foo');
|
|
155
|
-
expect(files['app/main.jsx']).toBeFalsy();
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
test('in all embedded jsx files', async () => {
|
|
159
|
-
const files = await snippets.prepareSnippet(
|
|
160
|
-
{ platform: 'react' },
|
|
161
|
-
{
|
|
162
|
-
'multifile-listing': [
|
|
163
|
-
{ name: 'main.jsx', content: 'foo' },
|
|
164
|
-
{ name: 'other.jsx', content: 'bar' }
|
|
165
|
-
],
|
|
166
|
-
jsx: 'foo'
|
|
167
|
-
}
|
|
168
|
-
);
|
|
169
|
-
|
|
170
|
-
expect(files['app/main.js']).toBe('foo');
|
|
171
|
-
expect(files['app/main.jsx']).toBeFalsy();
|
|
172
|
-
|
|
173
|
-
expect(files['app/other.js']).toBe('bar');
|
|
174
|
-
expect(files['app/other.jsx']).toBeFalsy();
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
test('replaces .jsx imports in file content', async () => {
|
|
178
|
-
const files = await snippets.prepareSnippet(
|
|
179
|
-
{ platform: 'react' },
|
|
180
|
-
{
|
|
181
|
-
'multifile-listing': [
|
|
182
|
-
{ name: 'main.jsx', content: 'import { foo } from "./other.jsx";' },
|
|
183
|
-
{ name: 'other.jsx', content: 'export const foo = "bar";' }
|
|
184
|
-
],
|
|
185
|
-
jsx: 'foo'
|
|
186
|
-
}
|
|
187
|
-
);
|
|
188
|
-
|
|
189
|
-
expect(files['app/main.js']).toBe('import { foo } from "./other";');
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
test('replaces jsx file in single-file snippet', async () => {
|
|
193
|
-
const files = await snippets.prepareSnippet(
|
|
194
|
-
{ platform: 'react' },
|
|
195
|
-
{ jsx: 'foo' },
|
|
196
|
-
{ 'app/main.jsx': 'foo' }
|
|
197
|
-
);
|
|
198
|
-
|
|
199
|
-
expect(files['app/main.jsx']).toBeFalsy();
|
|
200
|
-
expect(files['app/main.js']).toBe('foo');
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
describe('stackblitz dependencies', () => {
|
|
206
|
-
describe('getExampleImports', () => {
|
|
207
|
-
const defaultChannel = 'dev';
|
|
208
|
-
const productionChannelVersion = 'latest';
|
|
209
|
-
const devChannelVersion = 'dev';
|
|
210
|
-
const anyChannelVersion = '*';
|
|
211
|
-
|
|
212
|
-
test('extract default import from single file', () => {
|
|
213
|
-
const packageName = 'foo';
|
|
214
|
-
const importStatement = `import foo from "${packageName}"`;
|
|
215
|
-
const files = {
|
|
216
|
-
'app/main.js': importStatement
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
const imports = snippets.getExampleImports(files, defaultChannel);
|
|
220
|
-
|
|
221
|
-
expect(imports[packageName]).not.toBe(undefined);
|
|
222
|
-
});
|
|
223
|
-
test('extract default imports from multiple files', () => {
|
|
224
|
-
const fooPackageName = 'foo';
|
|
225
|
-
const barPackageName = 'bar';
|
|
226
|
-
|
|
227
|
-
const importFooStatement = `import foo from "${fooPackageName}"`;
|
|
228
|
-
const importBarStatement = `import bar from "${barPackageName}"`;
|
|
229
|
-
|
|
230
|
-
const files = {
|
|
231
|
-
'foo.js': importFooStatement,
|
|
232
|
-
'bar.js': importBarStatement
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
const imports = snippets.getExampleImports(files, defaultChannel);
|
|
236
|
-
|
|
237
|
-
expect(imports[fooPackageName]).not.toBe(undefined);
|
|
238
|
-
expect(imports[barPackageName]).not.toBe(undefined);
|
|
239
|
-
});
|
|
240
|
-
test('should ignore progress/telerik packages', () => {
|
|
241
|
-
const channel = 'latest';
|
|
242
|
-
const progressPackageName = '@progress/foo';
|
|
243
|
-
const telerikPackageName = '@telerik/bar';
|
|
244
|
-
|
|
245
|
-
const importFooStatement = `import foo from "${progressPackageName}"`;
|
|
246
|
-
const importBarStatement = `import bar from "${telerikPackageName}"`;
|
|
247
|
-
|
|
248
|
-
const files = {
|
|
249
|
-
'foo.js': importFooStatement,
|
|
250
|
-
'bar.js': importBarStatement
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
const imports = snippets.getExampleImports(files, channel);
|
|
254
|
-
|
|
255
|
-
expect(imports[progressPackageName]).toEqual(undefined);
|
|
256
|
-
expect(imports[telerikPackageName]).toEqual(undefined);
|
|
257
|
-
});
|
|
258
|
-
test('should **not** apply dev channel for non-progress/telerik packages', () => {
|
|
259
|
-
const channel = 'dev';
|
|
260
|
-
const fooPackageName = 'foo';
|
|
261
|
-
const barPackageName = 'bar';
|
|
262
|
-
|
|
263
|
-
const importFooStatement = `import foo from "${fooPackageName}"`;
|
|
264
|
-
const importBarStatement = `import bar from "${barPackageName}"`;
|
|
265
|
-
|
|
266
|
-
const files = {
|
|
267
|
-
'foo.js': importFooStatement,
|
|
268
|
-
'bar.js': importBarStatement
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
const imports = snippets.getExampleImports(files, channel);
|
|
272
|
-
|
|
273
|
-
expect(imports[fooPackageName]).toEqual(anyChannelVersion);
|
|
274
|
-
expect(imports[barPackageName]).toEqual(anyChannelVersion);
|
|
275
|
-
});
|
|
276
|
-
test('should **not** recognize local module imports as external packages', () => {
|
|
277
|
-
const channel = 'dev';
|
|
278
|
-
const localFileImport = './foo';
|
|
279
|
-
|
|
280
|
-
const importFooStatement = `import foo from "${localFileImport}"`;
|
|
281
|
-
|
|
282
|
-
const files = {
|
|
283
|
-
'foo.js': importFooStatement
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
const imports = snippets.getExampleImports(files, channel);
|
|
287
|
-
|
|
288
|
-
expect(imports).toEqual({});
|
|
289
|
-
});
|
|
290
|
-
});
|
|
291
|
-
describe('buildExampleDependencies', () => {
|
|
292
|
-
[
|
|
293
|
-
'react',
|
|
294
|
-
'angular',
|
|
295
|
-
'builder',
|
|
296
|
-
'react-wrappers'
|
|
297
|
-
].forEach(platform => {
|
|
298
|
-
[
|
|
299
|
-
'production',
|
|
300
|
-
'development'
|
|
301
|
-
].forEach(env => {
|
|
302
|
-
test(`should apply platformDependencies for ${platform} in ${env} environment`, () => {
|
|
303
|
-
window.env = env;
|
|
304
|
-
const channel = env === 'production' ? 'latest' : 'dev';
|
|
305
|
-
const stackBlitzDependencies = snippets.stackBlitzDependencies[platform](channel);
|
|
306
|
-
const dependencies = snippets.buildExampleDependencies(platform);
|
|
307
|
-
|
|
308
|
-
expect(dependencies).toEqual(stackBlitzDependencies);
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
test(`should apply example imports as dependencies on top of default ${platform} dependencies`, () => {
|
|
312
|
-
window.env = env;
|
|
313
|
-
const channel = env === 'production' ? 'latest' : 'dev';
|
|
314
|
-
const imports = { 'foo': channel, 'bar': channel };
|
|
315
|
-
const stackBlitzDependencies = snippets.stackBlitzDependencies[platform](channel);
|
|
316
|
-
const dependencies = snippets.buildExampleDependencies(platform, imports);
|
|
317
|
-
|
|
318
|
-
expect(dependencies).toEqual(global.$.extend({}, stackBlitzDependencies, imports));
|
|
319
|
-
});
|
|
320
|
-
});
|
|
321
|
-
});
|
|
322
|
-
test('should dependencies for react-wrappers when window.wrappers is set to true', () => {
|
|
323
|
-
window.wrappers = true;
|
|
324
|
-
const stackBlitzDependencies = snippets.stackBlitzDependencies['react-wrappers']('dev');
|
|
325
|
-
const dependencies = snippets.buildExampleDependencies('react');
|
|
326
|
-
|
|
327
|
-
expect(dependencies).toEqual(stackBlitzDependencies);
|
|
328
|
-
});
|
|
329
|
-
});
|
|
330
|
-
describe('getPackageName', () => {
|
|
331
|
-
it('should get normal package', () => {
|
|
332
|
-
const importPath = 'foo';
|
|
333
|
-
const result = snippets.getPackageName(importPath);
|
|
334
|
-
|
|
335
|
-
expect(result).toEqual('foo');
|
|
336
|
-
});
|
|
337
|
-
it('should get scoped package', () => {
|
|
338
|
-
const importPath = '@foo/bar';
|
|
339
|
-
const result = snippets.getPackageName(importPath);
|
|
340
|
-
|
|
341
|
-
expect(result).toEqual('@foo/bar');
|
|
342
|
-
});
|
|
343
|
-
it('should get nested package', () => {
|
|
344
|
-
const importPath = 'foo/bar';
|
|
345
|
-
const result = snippets.getPackageName(importPath);
|
|
346
|
-
|
|
347
|
-
expect(result).toEqual('foo');
|
|
348
|
-
});
|
|
349
|
-
it('should get scoped and nested package', () => {
|
|
350
|
-
const importPath = '@foo/bar/baz';
|
|
351
|
-
const result = snippets.getPackageName(importPath);
|
|
352
|
-
|
|
353
|
-
expect(result).toEqual('@foo/bar');
|
|
354
|
-
});
|
|
355
|
-
it('should get really long nested imports', () => {
|
|
356
|
-
const importPath = 'foo/bar/baz/gez/guz/kus';
|
|
357
|
-
const result = snippets.getPackageName(importPath);
|
|
358
|
-
|
|
359
|
-
expect(result).toEqual('foo');
|
|
360
|
-
});
|
|
361
|
-
it('should get really long scoped imports', () => {
|
|
362
|
-
const importPath = '@foo/bar/baz/gez/guz/kus';
|
|
363
|
-
const result = snippets.getPackageName(importPath);
|
|
364
|
-
|
|
365
|
-
expect(result).toEqual('@foo/bar');
|
|
366
|
-
})
|
|
367
|
-
it('should **not** fail with empty string', () => {
|
|
368
|
-
const importPath = '';
|
|
369
|
-
|
|
370
|
-
expect(() => {snippets.getPackageName(importPath);}).not.toThrow();
|
|
371
|
-
});
|
|
372
|
-
});
|
|
373
|
-
});
|