@3t-transform/threeteeui 0.1.6 → 0.1.7
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/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/css-shim-211819bc.js +6 -0
- package/dist/cjs/dom-9deb26c8.js +75 -0
- package/dist/cjs/index-11cfdabe.js +3297 -0
- package/dist/cjs/{index-b3010e55.js → index-451f61dd.js} +1 -3
- package/dist/cjs/loader.cjs.js +18 -2
- package/dist/cjs/shadow-css-bf3843d2.js +389 -0
- package/dist/cjs/tttx-button.cjs.entry.js +1 -1
- package/dist/cjs/tttx-form.cjs.entry.js +1 -1
- package/dist/cjs/tttx-icon.cjs.entry.js +1 -1
- package/dist/cjs/tttx-keyvalue-block.cjs.entry.js +1 -1
- package/dist/cjs/tttx-list.cjs.entry.js +34 -4
- package/dist/cjs/tttx-loading-spinner.cjs.entry.js +1 -1
- package/dist/cjs/tttx-standalone-input.cjs.entry.js +1 -1
- package/dist/cjs/tttx-toolbar.cjs.entry.js +20 -0
- package/dist/cjs/tttx.cjs.js +116 -4
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/atoms/tttx-button/test/tttx-button.e2e.js +9 -0
- package/dist/collection/components/atoms/tttx-button/test/tttx-button.spec.js +83 -0
- package/dist/collection/components/atoms/tttx-icon/test/tttx-icon.e2e.js +9 -0
- package/dist/collection/components/atoms/tttx-icon/test/tttx-icon.spec.js +16 -0
- package/dist/collection/components/atoms/tttx-keyvalue-block/test/tttx-keyvalue-block.spec.js +216 -0
- package/dist/collection/components/atoms/tttx-loading-spinner/Test/tttx-loading-spinner.spec.js +64 -0
- package/dist/collection/components/molecules/tttx-form/lib/setErrorState.spec.js +38 -0
- package/dist/collection/components/molecules/tttx-form/lib/validityCheck.spec.js +214 -0
- package/dist/collection/components/molecules/tttx-form/test/tttx-form.e2e.js +9 -0
- package/dist/collection/components/molecules/tttx-form/test/tttx-form.spec.js +232 -0
- package/dist/collection/components/molecules/tttx-list/test/ttttx-list.spec.e2e.js +26 -0
- package/dist/collection/components/molecules/tttx-list/test/tttx-list.spec.js +183 -0
- package/dist/collection/components/molecules/tttx-standalone-input/test/tttx-standalone-input.e2e.js +9 -0
- package/dist/collection/components/molecules/tttx-standalone-input/test/tttx-standalone-input.spec.js +219 -0
- package/dist/collection/components/molecules/tttx-toolbar/test/tttx-toolbar.test.js +0 -0
- package/dist/collection/components/molecules/tttx-toolbar/tttx-toolbar.css +30 -0
- package/dist/collection/components/molecules/tttx-toolbar/tttx-toolbar.js +44 -0
- package/dist/collection/components/molecules/tttx-toolbar/tttx-toolbar.stories.js +20 -0
- package/dist/collection/shared/test/domsanitiser.options.spec.js +23 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +5 -0
- package/dist/components/tttx-list.js +33 -3
- package/dist/components/tttx-toolbar.d.ts +11 -0
- package/dist/components/tttx-toolbar.js +36 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/css-shim-9d54a2f2.js +4 -0
- package/dist/esm/dom-6be6f662.js +73 -0
- package/dist/esm/{index-31631990.js → index-0350f122.js} +1 -3
- package/dist/esm/index-dbe25028.js +3262 -0
- package/dist/esm/loader.js +18 -2
- package/dist/esm/shadow-css-ed4599f8.js +387 -0
- package/dist/esm/tttx-button.entry.js +1 -1
- package/dist/esm/tttx-form.entry.js +1 -1
- package/dist/esm/tttx-icon.entry.js +1 -1
- package/dist/esm/tttx-keyvalue-block.entry.js +1 -1
- package/dist/esm/tttx-list.entry.js +34 -4
- package/dist/esm/tttx-loading-spinner.entry.js +1 -1
- package/dist/esm/tttx-standalone-input.entry.js +1 -1
- package/dist/esm/tttx-toolbar.entry.js +16 -0
- package/dist/esm/tttx.js +116 -4
- package/dist/tttx/app-globals-0f993ce5.js +3 -0
- package/dist/tttx/css-shim-9d54a2f2.js +4 -0
- package/dist/tttx/dom-6be6f662.js +73 -0
- package/dist/tttx/index-dbe25028.js +3262 -0
- package/dist/tttx/index.esm.js +1 -0
- package/dist/tttx/p-0a85dda4.entry.js +1 -0
- package/dist/tttx/{p-1f3d39fc.entry.js → p-1b015a9d.entry.js} +1 -1
- package/dist/tttx/{p-2e7f486e.entry.js → p-4f3958fa.entry.js} +1 -1
- package/dist/tttx/{p-14270585.entry.js → p-5cae1beb.entry.js} +1 -1
- package/dist/tttx/{p-0c6a665d.js → p-62869344.js} +1 -1
- package/dist/tttx/{p-979ebe65.entry.js → p-92465671.entry.js} +1 -1
- package/dist/tttx/{p-84d90779.entry.js → p-a0179cb1.entry.js} +1 -1
- package/dist/tttx/{p-263d093c.entry.js → p-cc6644c9.entry.js} +1 -1
- package/dist/tttx/{p-39f991c3.entry.js → p-cd1565e0.entry.js} +1 -1
- package/dist/tttx/shadow-css-ed4599f8.js +387 -0
- package/dist/tttx/tttx-button.entry.js +30 -0
- package/dist/tttx/tttx-form.entry.js +373 -0
- package/dist/tttx/tttx-icon.entry.js +17 -0
- package/dist/tttx/tttx-keyvalue-block.entry.js +63 -0
- package/dist/tttx/tttx-list.entry.js +1730 -0
- package/dist/tttx/tttx-loading-spinner.entry.js +22 -0
- package/dist/tttx/tttx-standalone-input.entry.js +66 -0
- package/dist/tttx/tttx-toolbar.entry.js +16 -0
- package/dist/tttx/tttx.esm.js +129 -1
- package/dist/types/components/atoms/tttx-button/test/tttx-button.e2e.d.ts +1 -0
- package/dist/types/components/atoms/tttx-button/test/tttx-button.spec.d.ts +1 -0
- package/dist/types/components/atoms/tttx-icon/test/tttx-icon.e2e.d.ts +1 -0
- package/dist/types/components/atoms/tttx-icon/test/tttx-icon.spec.d.ts +1 -0
- package/dist/types/components/atoms/tttx-keyvalue-block/test/tttx-keyvalue-block.spec.d.ts +1 -0
- package/dist/types/components/atoms/tttx-loading-spinner/Test/tttx-loading-spinner.spec.d.ts +1 -0
- package/dist/types/components/molecules/tttx-form/lib/setErrorState.spec.d.ts +1 -0
- package/dist/types/components/molecules/tttx-form/lib/validityCheck.spec.d.ts +1 -0
- package/dist/types/components/molecules/tttx-form/test/tttx-form.e2e.d.ts +1 -0
- package/dist/types/components/molecules/tttx-form/test/tttx-form.spec.d.ts +1 -0
- package/dist/types/components/molecules/tttx-list/test/ttttx-list.spec.e2e.d.ts +1 -0
- package/dist/types/components/molecules/tttx-list/test/tttx-list.spec.d.ts +1 -0
- package/dist/types/components/molecules/tttx-standalone-input/test/tttx-standalone-input.e2e.d.ts +1 -0
- package/dist/types/components/molecules/tttx-standalone-input/test/tttx-standalone-input.spec.d.ts +1 -0
- package/dist/types/components/molecules/tttx-toolbar/test/tttx-toolbar.test.d.ts +0 -0
- package/dist/types/components/molecules/tttx-toolbar/tttx-toolbar.d.ts +4 -0
- package/dist/types/components/molecules/tttx-toolbar/tttx-toolbar.stories.d.ts +13 -0
- package/dist/types/components.d.ts +15 -0
- package/dist/types/shared/test/domsanitiser.options.spec.d.ts +1 -0
- package/package.json +1 -1
package/dist/cjs/tttx.cjs.js
CHANGED
|
@@ -1,19 +1,131 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
3
|
+
const index = require('./index-11cfdabe.js');
|
|
4
|
+
const appGlobals = require('./app-globals-3a1e7e63.js');
|
|
4
5
|
|
|
5
6
|
/*
|
|
6
7
|
Stencil Client Patch Browser v2.20.0 | MIT Licensed | https://stenciljs.com
|
|
7
8
|
*/
|
|
9
|
+
const getDynamicImportFunction = (namespace) => `__sc_import_${namespace.replace(/\s|-/g, '_')}`;
|
|
8
10
|
const patchBrowser = () => {
|
|
11
|
+
// NOTE!! This fn cannot use async/await!
|
|
12
|
+
if (index.BUILD.isDev && !index.BUILD.isTesting) {
|
|
13
|
+
index.consoleDevInfo('Running in development mode.');
|
|
14
|
+
}
|
|
15
|
+
if (index.BUILD.cssVarShim) {
|
|
16
|
+
// shim css vars
|
|
17
|
+
index.plt.$cssShim$ = index.win.__cssshim;
|
|
18
|
+
}
|
|
19
|
+
if (index.BUILD.cloneNodeFix) {
|
|
20
|
+
// opted-in to polyfill cloneNode() for slot polyfilled components
|
|
21
|
+
patchCloneNodeFix(index.H.prototype);
|
|
22
|
+
}
|
|
23
|
+
if (index.BUILD.profile && !performance.mark) {
|
|
24
|
+
// not all browsers support performance.mark/measure (Safari 10)
|
|
25
|
+
// because the mark/measure APIs are designed to write entries to a buffer in the browser that does not exist,
|
|
26
|
+
// simply stub the implementations out.
|
|
27
|
+
// TODO(STENCIL-323): Remove this patch when support for older browsers is removed (breaking)
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
performance.mark = performance.measure = () => {
|
|
30
|
+
/*noop*/
|
|
31
|
+
};
|
|
32
|
+
performance.getEntriesByName = () => [];
|
|
33
|
+
}
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
const scriptElm = index.BUILD.scriptDataOpts || index.BUILD.safari10 || index.BUILD.dynamicImportShim
|
|
36
|
+
? Array.from(index.doc.querySelectorAll('script')).find((s) => new RegExp(`\/${index.NAMESPACE}(\\.esm)?\\.js($|\\?|#)`).test(s.src) ||
|
|
37
|
+
s.getAttribute('data-stencil-namespace') === index.NAMESPACE)
|
|
38
|
+
: null;
|
|
9
39
|
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('tttx.cjs.js', document.baseURI).href));
|
|
10
|
-
const opts = {};
|
|
11
|
-
if (
|
|
40
|
+
const opts = index.BUILD.scriptDataOpts ? scriptElm['data-opts'] || {} : {};
|
|
41
|
+
if (index.BUILD.safari10 && 'onbeforeload' in scriptElm && !history.scrollRestoration /* IS_ESM_BUILD */) {
|
|
42
|
+
// Safari < v11 support: This IF is true if it's Safari below v11.
|
|
43
|
+
// This fn cannot use async/await since Safari didn't support it until v11,
|
|
44
|
+
// however, Safari 10 did support modules. Safari 10 also didn't support "nomodule",
|
|
45
|
+
// so both the ESM file and nomodule file would get downloaded. Only Safari
|
|
46
|
+
// has 'onbeforeload' in the script, and "history.scrollRestoration" was added
|
|
47
|
+
// to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue.
|
|
48
|
+
// IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds.
|
|
49
|
+
return {
|
|
50
|
+
then() {
|
|
51
|
+
/* promise noop */
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
if (!index.BUILD.safari10 && importMeta !== '') {
|
|
12
56
|
opts.resourcesUrl = new URL('.', importMeta).href;
|
|
13
57
|
}
|
|
58
|
+
else if (index.BUILD.dynamicImportShim || index.BUILD.safari10) {
|
|
59
|
+
opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, index.win.location.href)).href;
|
|
60
|
+
if (index.BUILD.dynamicImportShim) {
|
|
61
|
+
patchDynamicImport(opts.resourcesUrl, scriptElm);
|
|
62
|
+
}
|
|
63
|
+
if (index.BUILD.dynamicImportShim && !index.win.customElements) {
|
|
64
|
+
// module support, but no custom elements support (Old Edge)
|
|
65
|
+
// @ts-ignore
|
|
66
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "polyfills-dom" */ './dom-9deb26c8.js'); }).then(() => opts);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
14
69
|
return index.promiseResolve(opts);
|
|
15
70
|
};
|
|
71
|
+
const patchDynamicImport = (base, orgScriptElm) => {
|
|
72
|
+
const importFunctionName = getDynamicImportFunction(index.NAMESPACE);
|
|
73
|
+
try {
|
|
74
|
+
// test if this browser supports dynamic imports
|
|
75
|
+
// There is a caching issue in V8, that breaks using import() in Function
|
|
76
|
+
// By generating a random string, we can workaround it
|
|
77
|
+
// Check https://bugs.chromium.org/p/chromium/issues/detail?id=990810 for more info
|
|
78
|
+
index.win[importFunctionName] = new Function('w', `return import(w);//${Math.random()}`);
|
|
79
|
+
}
|
|
80
|
+
catch (e) {
|
|
81
|
+
// this shim is specifically for browsers that do support "esm" imports
|
|
82
|
+
// however, they do NOT support "dynamic" imports
|
|
83
|
+
// basically this code is for old Edge, v18 and below
|
|
84
|
+
const moduleMap = new Map();
|
|
85
|
+
index.win[importFunctionName] = (src) => {
|
|
86
|
+
const url = new URL(src, base).href;
|
|
87
|
+
let mod = moduleMap.get(url);
|
|
88
|
+
if (!mod) {
|
|
89
|
+
const script = index.doc.createElement('script');
|
|
90
|
+
script.type = 'module';
|
|
91
|
+
script.crossOrigin = orgScriptElm.crossOrigin;
|
|
92
|
+
script.src = URL.createObjectURL(new Blob([`import * as m from '${url}'; window.${importFunctionName}.m = m;`], {
|
|
93
|
+
type: 'application/javascript',
|
|
94
|
+
}));
|
|
95
|
+
mod = new Promise((resolve) => {
|
|
96
|
+
script.onload = () => {
|
|
97
|
+
resolve(index.win[importFunctionName].m);
|
|
98
|
+
script.remove();
|
|
99
|
+
};
|
|
100
|
+
});
|
|
101
|
+
moduleMap.set(url, mod);
|
|
102
|
+
index.doc.head.appendChild(script);
|
|
103
|
+
}
|
|
104
|
+
return mod;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const patchCloneNodeFix = (HTMLElementPrototype) => {
|
|
109
|
+
const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;
|
|
110
|
+
HTMLElementPrototype.cloneNode = function (deep) {
|
|
111
|
+
if (this.nodeName === 'TEMPLATE') {
|
|
112
|
+
return nativeCloneNodeFn.call(this, deep);
|
|
113
|
+
}
|
|
114
|
+
const clonedNode = nativeCloneNodeFn.call(this, false);
|
|
115
|
+
const srcChildNodes = this.childNodes;
|
|
116
|
+
if (deep) {
|
|
117
|
+
for (let i = 0; i < srcChildNodes.length; i++) {
|
|
118
|
+
// Node.ATTRIBUTE_NODE === 2, and checking because IE11
|
|
119
|
+
if (srcChildNodes[i].nodeType !== 2) {
|
|
120
|
+
clonedNode.appendChild(srcChildNodes[i].cloneNode(true));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return clonedNode;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
16
127
|
|
|
17
128
|
patchBrowser().then(options => {
|
|
18
|
-
|
|
129
|
+
appGlobals.globalScripts();
|
|
130
|
+
return index.bootstrapLazy([["tttx-button.cjs",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"design":[1]}]]],["tttx-list.cjs",[[1,"tttx-list",{"data":[1025],"name":[1]}]]],["tttx-standalone-input.cjs",[[2,"tttx-standalone-input",{"label":[1],"showerrormsg":[4],"showerrorbubble":[4],"errormsg":[1],"iconleft":[1],"iconright":[1],"inputicon":[1],"inline":[4],"inputAutocapitalize":[1,"input-autocapitalize"],"inputAutofocus":[4,"input-autofocus"],"inputKeyhint":[1,"input-keyhint"],"inputIndex":[8,"input-index"],"inputTitle":[1,"input-title"],"autocomplete":[1],"checked":[4],"disabled":[4],"max":[8],"maxlength":[8],"min":[8],"minlength":[8],"name":[1],"pattern":[1],"placeholder":[1],"readonly":[8],"required":[4],"step":[8],"type":[1],"value":[1032]}]]],["tttx-form.cjs",[[1,"tttx-form",{"formschema":[1032],"submitValue":[1032,"submit-value"]}]]],["tttx-keyvalue-block.cjs",[[1,"tttx-keyvalue-block",{"keyvalues":[8],"horizontal":[4]}]]],["tttx-loading-spinner.cjs",[[1,"tttx-loading-spinner",{"loadingMessage":[1028,"loading-message"],"size":[1025]}]]],["tttx-toolbar.cjs",[[1,"tttx-toolbar",{"border":[4]}]]],["tttx-icon.cjs",[[1,"tttx-icon",{"icon":[1],"color":[1]}]]]], options);
|
|
19
131
|
});
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
"./components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.js",
|
|
7
7
|
"./components/atoms/tttx-loading-spinner/tttx-loading-spinner.js",
|
|
8
8
|
"./components/molecules/tttx-form/tttx-form.js",
|
|
9
|
-
"./components/molecules/tttx-list/tttx-list.js"
|
|
9
|
+
"./components/molecules/tttx-list/tttx-list.js",
|
|
10
|
+
"./components/molecules/tttx-toolbar/tttx-toolbar.js"
|
|
10
11
|
],
|
|
11
12
|
"compiler": {
|
|
12
13
|
"name": "@stencil/core",
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { newE2EPage } from '@stencil/core/testing';
|
|
2
|
+
describe('tttx-button', () => {
|
|
3
|
+
it('renders', async () => {
|
|
4
|
+
const page = await newE2EPage();
|
|
5
|
+
await page.setContent('<tttx-button></tttx-button>');
|
|
6
|
+
const element = await page.find('tttx-button');
|
|
7
|
+
expect(element).toHaveClass('hydrated');
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { newSpecPage } from '@stencil/core/testing';
|
|
2
|
+
import { TttxButton } from '../tttx-button';
|
|
3
|
+
describe('tttx-button', () => {
|
|
4
|
+
it('renders', async () => {
|
|
5
|
+
const page = await newSpecPage({
|
|
6
|
+
components: [TttxButton],
|
|
7
|
+
html: '<tttx-button></tttx-button>',
|
|
8
|
+
});
|
|
9
|
+
expect(page.root).toEqualHtml(`
|
|
10
|
+
<tttx-button>
|
|
11
|
+
<mock:shadow-root>
|
|
12
|
+
<button class="button default">
|
|
13
|
+
<div class="button-content">
|
|
14
|
+
<slot></slot>
|
|
15
|
+
</div>
|
|
16
|
+
</button>
|
|
17
|
+
</mock:shadow-root>
|
|
18
|
+
</tttx-button>
|
|
19
|
+
`);
|
|
20
|
+
});
|
|
21
|
+
it('renders a white icon', async () => {
|
|
22
|
+
const page = await newSpecPage({
|
|
23
|
+
components: [TttxButton],
|
|
24
|
+
html: '<tttx-button design="primary" icon="person"></tttx-button>',
|
|
25
|
+
});
|
|
26
|
+
expect(page.root).toEqualHtml(`
|
|
27
|
+
<tttx-button design="primary" icon="person">
|
|
28
|
+
<mock:shadow-root>
|
|
29
|
+
<button class="button iconleft primary withicon">
|
|
30
|
+
<div class="icon-left">
|
|
31
|
+
<tttx-icon color="white" icon="person"></tttx-icon>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="button-content">
|
|
34
|
+
<slot></slot>
|
|
35
|
+
</div>
|
|
36
|
+
</button>
|
|
37
|
+
</mock:shadow-root>
|
|
38
|
+
</tttx-button>
|
|
39
|
+
`);
|
|
40
|
+
});
|
|
41
|
+
it('design doesn\'t exist', async () => {
|
|
42
|
+
const page = await newSpecPage({
|
|
43
|
+
components: [TttxButton],
|
|
44
|
+
html: '<tttx-button design="memphis" icon="person"></tttx-button>',
|
|
45
|
+
});
|
|
46
|
+
expect(page.root).toEqualHtml(`
|
|
47
|
+
<tttx-button design="memphis" icon="person">
|
|
48
|
+
<mock:shadow-root>
|
|
49
|
+
<button class="button default iconleft withicon">
|
|
50
|
+
<div class="icon-left">
|
|
51
|
+
<tttx-icon color="black" icon="person"></tttx-icon>
|
|
52
|
+
</div>
|
|
53
|
+
<div class="button-content">
|
|
54
|
+
<slot></slot>
|
|
55
|
+
</div>
|
|
56
|
+
</button>
|
|
57
|
+
</mock:shadow-root>
|
|
58
|
+
</tttx-button>
|
|
59
|
+
`);
|
|
60
|
+
});
|
|
61
|
+
it('clicks', async () => {
|
|
62
|
+
const page = await newSpecPage({
|
|
63
|
+
components: [TttxButton],
|
|
64
|
+
html: '<tttx-button></tttx-button>',
|
|
65
|
+
});
|
|
66
|
+
expect(page.root).toEqualHtml(`
|
|
67
|
+
<tttx-button>
|
|
68
|
+
<mock:shadow-root>
|
|
69
|
+
<button class="button default">
|
|
70
|
+
<div class="button-content">
|
|
71
|
+
<slot></slot>
|
|
72
|
+
</div>
|
|
73
|
+
</button>
|
|
74
|
+
</mock:shadow-root>
|
|
75
|
+
</tttx-button>
|
|
76
|
+
`);
|
|
77
|
+
const callbackFn = jest.fn();
|
|
78
|
+
// add an event listener directly to the tttx-button host and click it
|
|
79
|
+
page.root.addEventListener('click', callbackFn);
|
|
80
|
+
page.root.click();
|
|
81
|
+
expect(callbackFn).toHaveBeenCalled();
|
|
82
|
+
});
|
|
83
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { newE2EPage } from '@stencil/core/testing';
|
|
2
|
+
describe('tttx-icon', () => {
|
|
3
|
+
it('renders', async () => {
|
|
4
|
+
const page = await newE2EPage();
|
|
5
|
+
await page.setContent('<tttx-icon></tttx-icon>');
|
|
6
|
+
const element = await page.find('tttx-icon');
|
|
7
|
+
expect(element).toHaveClass('hydrated');
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { newSpecPage } from '@stencil/core/testing';
|
|
2
|
+
import { TttxIcon } from '../tttx-icon';
|
|
3
|
+
describe('tttx-icon', () => {
|
|
4
|
+
it('renders', async () => {
|
|
5
|
+
const page = await newSpecPage({
|
|
6
|
+
components: [TttxIcon],
|
|
7
|
+
html: '<tttx-icon color="danger" icon="warning"></tttx-icon>',
|
|
8
|
+
});
|
|
9
|
+
expect(page.root).toEqualHtml(`
|
|
10
|
+
<tttx-icon color="danger" icon="warning">
|
|
11
|
+
<mock:shadow-root>
|
|
12
|
+
<span class="material-symbols-rounded danger">warning</span>
|
|
13
|
+
</mock:shadow-root>
|
|
14
|
+
</tttx-icon>`);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { h } from '@stencil/core';
|
|
2
|
+
import { newSpecPage } from '@stencil/core/testing';
|
|
3
|
+
import { TttxKeyvalueBlock } from '../tttx-keyvalue-block';
|
|
4
|
+
describe('tttx-keyvalue-block', () => {
|
|
5
|
+
it('renders multiple key value pairs', async () => {
|
|
6
|
+
const keyValuePair = {
|
|
7
|
+
'Name': 'John Doe',
|
|
8
|
+
'Date of birth': '14 Jan 1981',
|
|
9
|
+
'Start of postcode': 'AB10'
|
|
10
|
+
};
|
|
11
|
+
const page = await newSpecPage({
|
|
12
|
+
components: [TttxKeyvalueBlock],
|
|
13
|
+
html: `<tttx-keyvalue-block keyvalues='${JSON.stringify(keyValuePair)}' />`
|
|
14
|
+
});
|
|
15
|
+
await page.waitForChanges();
|
|
16
|
+
expect(page.root).toEqualHtml(`
|
|
17
|
+
<tttx-keyvalue-block keyvalues='{"Name":"John Doe","Date of birth":"14 Jan 1981","Start of postcode":"AB10"}'>
|
|
18
|
+
<mock:shadow-root>
|
|
19
|
+
<dl>
|
|
20
|
+
<dt>
|
|
21
|
+
Name
|
|
22
|
+
</dt>
|
|
23
|
+
<dd>
|
|
24
|
+
John Doe
|
|
25
|
+
</dd>
|
|
26
|
+
<dt>
|
|
27
|
+
Date of birth
|
|
28
|
+
</dt>
|
|
29
|
+
<dd>
|
|
30
|
+
14 Jan 1981
|
|
31
|
+
</dd>
|
|
32
|
+
<dt>
|
|
33
|
+
Start of postcode
|
|
34
|
+
</dt>
|
|
35
|
+
<dd>
|
|
36
|
+
AB10
|
|
37
|
+
</dd>
|
|
38
|
+
</dl>
|
|
39
|
+
</mock:shadow-root>
|
|
40
|
+
</tttx-keyvalue-block>
|
|
41
|
+
`);
|
|
42
|
+
});
|
|
43
|
+
it('renders multiple key value pairs from a stencil template', async () => {
|
|
44
|
+
const keyValuePair = {
|
|
45
|
+
'Name': 'John Doe',
|
|
46
|
+
'Date of birth': '14 Jan 1981',
|
|
47
|
+
'Start of postcode': 'AB10'
|
|
48
|
+
};
|
|
49
|
+
const page = await newSpecPage({
|
|
50
|
+
components: [TttxKeyvalueBlock],
|
|
51
|
+
template: () => (h("tttx-keyvalue-block", { keyvalues: keyValuePair }))
|
|
52
|
+
});
|
|
53
|
+
await page.waitForChanges();
|
|
54
|
+
expect(page.root).toEqualHtml(`
|
|
55
|
+
<tttx-keyvalue-block>
|
|
56
|
+
<mock:shadow-root>
|
|
57
|
+
<dl>
|
|
58
|
+
<dt>
|
|
59
|
+
Name
|
|
60
|
+
</dt>
|
|
61
|
+
<dd>
|
|
62
|
+
John Doe
|
|
63
|
+
</dd>
|
|
64
|
+
<dt>
|
|
65
|
+
Date of birth
|
|
66
|
+
</dt>
|
|
67
|
+
<dd>
|
|
68
|
+
14 Jan 1981
|
|
69
|
+
</dd>
|
|
70
|
+
<dt>
|
|
71
|
+
Start of postcode
|
|
72
|
+
</dt>
|
|
73
|
+
<dd>
|
|
74
|
+
AB10
|
|
75
|
+
</dd>
|
|
76
|
+
</dl>
|
|
77
|
+
</mock:shadow-root>
|
|
78
|
+
</tttx-keyvalue-block>
|
|
79
|
+
`);
|
|
80
|
+
});
|
|
81
|
+
it('renders with missing keyvalue object', async () => {
|
|
82
|
+
const page = await newSpecPage({
|
|
83
|
+
components: [TttxKeyvalueBlock],
|
|
84
|
+
template: () => (h("tttx-keyvalue-block", null))
|
|
85
|
+
});
|
|
86
|
+
await page.waitForChanges();
|
|
87
|
+
expect(page.root).toEqualHtml(`
|
|
88
|
+
<tttx-keyvalue-block>
|
|
89
|
+
<mock:shadow-root>
|
|
90
|
+
</mock:shadow-root>
|
|
91
|
+
</tttx-keyvalue-block>
|
|
92
|
+
`);
|
|
93
|
+
});
|
|
94
|
+
it('renders an array of key value subtitles', async () => {
|
|
95
|
+
const keyValueArray = [
|
|
96
|
+
{ title: 'title', subTitle: 'sub', data: 'data' },
|
|
97
|
+
{ title: 'title2', subTitle: 'sub2', data: 'data2' }
|
|
98
|
+
];
|
|
99
|
+
const page = await newSpecPage({
|
|
100
|
+
components: [TttxKeyvalueBlock],
|
|
101
|
+
html: `<tttx-keyvalue-block keyvalues='${JSON.stringify(keyValueArray)}' />`
|
|
102
|
+
});
|
|
103
|
+
await page.waitForChanges();
|
|
104
|
+
expect(page.root).toEqualHtml(`
|
|
105
|
+
<tttx-keyvalue-block keyvalues='[{"title":"title","subTitle":"sub","data":"data"},{"title":"title2","subTitle":"sub2","data":"data2"}]'>
|
|
106
|
+
<mock:shadow-root>
|
|
107
|
+
<dl>
|
|
108
|
+
<dt class="mainTitle">
|
|
109
|
+
title
|
|
110
|
+
</dt>
|
|
111
|
+
<dt class="subTitle">
|
|
112
|
+
sub
|
|
113
|
+
</dt>
|
|
114
|
+
<dd>
|
|
115
|
+
data
|
|
116
|
+
</dd>
|
|
117
|
+
<dt class="mainTitle">
|
|
118
|
+
title2
|
|
119
|
+
</dt>
|
|
120
|
+
<dt class="subTitle">
|
|
121
|
+
sub2
|
|
122
|
+
</dt>
|
|
123
|
+
<dd>
|
|
124
|
+
data2
|
|
125
|
+
</dd>
|
|
126
|
+
</dl>
|
|
127
|
+
</mock:shadow-root>
|
|
128
|
+
</tttx-keyvalue-block>
|
|
129
|
+
`);
|
|
130
|
+
});
|
|
131
|
+
it('renders multiple horizontal key value pairs', async () => {
|
|
132
|
+
const keyValuePair = {
|
|
133
|
+
'Name': 'John Doe',
|
|
134
|
+
'Date of birth': '14 Jan 1981',
|
|
135
|
+
'Start of postcode': 'AB10'
|
|
136
|
+
};
|
|
137
|
+
const page = await newSpecPage({
|
|
138
|
+
components: [TttxKeyvalueBlock],
|
|
139
|
+
html: `<tttx-keyvalue-block horizontal="true" keyvalues='${JSON.stringify(keyValuePair)}' />`
|
|
140
|
+
});
|
|
141
|
+
await page.waitForChanges();
|
|
142
|
+
expect(page.root).toEqualHtml(`
|
|
143
|
+
<tttx-keyvalue-block horizontal="true" keyvalues='{"Name":"John Doe","Date of birth":"14 Jan 1981","Start of postcode":"AB10"}'>
|
|
144
|
+
<mock:shadow-root>
|
|
145
|
+
<dl class="horizontal">
|
|
146
|
+
<div>
|
|
147
|
+
<dt>
|
|
148
|
+
Name
|
|
149
|
+
</dt>
|
|
150
|
+
<dd>
|
|
151
|
+
John Doe
|
|
152
|
+
</dd>
|
|
153
|
+
</div>
|
|
154
|
+
<div>
|
|
155
|
+
<dt>
|
|
156
|
+
Date of birth
|
|
157
|
+
</dt>
|
|
158
|
+
<dd>
|
|
159
|
+
14 Jan 1981
|
|
160
|
+
</dd>
|
|
161
|
+
</div>
|
|
162
|
+
<div>
|
|
163
|
+
<dt>
|
|
164
|
+
Start of postcode
|
|
165
|
+
</dt>
|
|
166
|
+
<dd>
|
|
167
|
+
AB10
|
|
168
|
+
</dd>
|
|
169
|
+
</div>
|
|
170
|
+
</dl>
|
|
171
|
+
</mock:shadow-root>
|
|
172
|
+
</tttx-keyvalue-block>
|
|
173
|
+
`);
|
|
174
|
+
});
|
|
175
|
+
it('renders an array of horizontal key value subtitles', async () => {
|
|
176
|
+
const keyValueArray = [
|
|
177
|
+
{ title: 'title', subTitle: 'sub', data: 'data' },
|
|
178
|
+
{ title: 'title2', subTitle: 'sub2', data: 'data2' }
|
|
179
|
+
];
|
|
180
|
+
const page = await newSpecPage({
|
|
181
|
+
components: [TttxKeyvalueBlock],
|
|
182
|
+
html: `<tttx-keyvalue-block horizontal="true" keyvalues='${JSON.stringify(keyValueArray)}' />`
|
|
183
|
+
});
|
|
184
|
+
await page.waitForChanges();
|
|
185
|
+
expect(page.root).toEqualHtml(`
|
|
186
|
+
<tttx-keyvalue-block horizontal="true" keyvalues='[{"title":"title","subTitle":"sub","data":"data"},{"title":"title2","subTitle":"sub2","data":"data2"}]'>
|
|
187
|
+
<mock:shadow-root>
|
|
188
|
+
<dl class="horizontal">
|
|
189
|
+
<div>
|
|
190
|
+
<dt class="mainTitle">
|
|
191
|
+
title
|
|
192
|
+
</dt>
|
|
193
|
+
<dt class="subTitle">
|
|
194
|
+
sub
|
|
195
|
+
</dt>
|
|
196
|
+
<dd>
|
|
197
|
+
data
|
|
198
|
+
</dd>
|
|
199
|
+
</div>
|
|
200
|
+
<div>
|
|
201
|
+
<dt class="mainTitle">
|
|
202
|
+
title2
|
|
203
|
+
</dt>
|
|
204
|
+
<dt class="subTitle">
|
|
205
|
+
sub2
|
|
206
|
+
</dt>
|
|
207
|
+
<dd>
|
|
208
|
+
data2
|
|
209
|
+
</dd>
|
|
210
|
+
</div>
|
|
211
|
+
</dl>
|
|
212
|
+
</mock:shadow-root>
|
|
213
|
+
</tttx-keyvalue-block>
|
|
214
|
+
`);
|
|
215
|
+
});
|
|
216
|
+
});
|
package/dist/collection/components/atoms/tttx-loading-spinner/Test/tttx-loading-spinner.spec.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { newSpecPage } from '@stencil/core/testing';
|
|
2
|
+
import { TttxLoadingSpinner } from '../tttx-loading-spinner';
|
|
3
|
+
describe('tttx-loading-spinner', () => {
|
|
4
|
+
it('renders the loading text when the loading message prop is set to true', async () => {
|
|
5
|
+
const page = await newSpecPage({
|
|
6
|
+
components: [TttxLoadingSpinner],
|
|
7
|
+
html: '<tttx-loading-spinner></tttx-loading-spinner>',
|
|
8
|
+
});
|
|
9
|
+
page.rootInstance.loadingMessage = true;
|
|
10
|
+
await page.waitForChanges();
|
|
11
|
+
expect(page.root).toEqualHtml(`
|
|
12
|
+
<tttx-loading-spinner>
|
|
13
|
+
<mock:shadow-root>
|
|
14
|
+
<div class='spinner-container'><div class="loading-box"><span class='spinner large'></span></div><div class='loading-text'>Loading, please wait...</div></div>
|
|
15
|
+
</mock:shadow-root>
|
|
16
|
+
</tttx-loading-spinner>
|
|
17
|
+
`);
|
|
18
|
+
});
|
|
19
|
+
it('renders without the loading text when the loading message prop is set to false', async () => {
|
|
20
|
+
const page = await newSpecPage({
|
|
21
|
+
components: [TttxLoadingSpinner],
|
|
22
|
+
html: '<tttx-loading-spinner></tttx-loading-spinner>',
|
|
23
|
+
});
|
|
24
|
+
page.rootInstance.loadingMessage = false;
|
|
25
|
+
await page.waitForChanges();
|
|
26
|
+
expect(page.root).toEqualHtml(`
|
|
27
|
+
<tttx-loading-spinner>
|
|
28
|
+
<mock:shadow-root>
|
|
29
|
+
<div class='spinner-container'><div class="loading-box"><span class='spinner large'></span></div></div>
|
|
30
|
+
</mock:shadow-root>
|
|
31
|
+
</tttx-loading-spinner>
|
|
32
|
+
`);
|
|
33
|
+
});
|
|
34
|
+
it('renders the small spinner when the size prop is set to small', async () => {
|
|
35
|
+
const page = await newSpecPage({
|
|
36
|
+
components: [TttxLoadingSpinner],
|
|
37
|
+
html: '<tttx-loading-spinner></tttx-loading-spinner>',
|
|
38
|
+
});
|
|
39
|
+
page.rootInstance.size = 'small';
|
|
40
|
+
await page.waitForChanges();
|
|
41
|
+
expect(page.root).toEqualHtml(`
|
|
42
|
+
<tttx-loading-spinner>
|
|
43
|
+
<mock:shadow-root>
|
|
44
|
+
<div class='spinner-container'><div class="loading-box"><span class='spinner small'></span></div></div>
|
|
45
|
+
</mock:shadow-root>
|
|
46
|
+
</tttx-loading-spinner>
|
|
47
|
+
`);
|
|
48
|
+
});
|
|
49
|
+
it('renders the large spinner when the size prop is set to large', async () => {
|
|
50
|
+
const page = await newSpecPage({
|
|
51
|
+
components: [TttxLoadingSpinner],
|
|
52
|
+
html: '<tttx-loading-spinner></tttx-loading-spinner>',
|
|
53
|
+
});
|
|
54
|
+
page.rootInstance.size = 'large';
|
|
55
|
+
await page.waitForChanges();
|
|
56
|
+
expect(page.root).toEqualHtml(`
|
|
57
|
+
<tttx-loading-spinner>
|
|
58
|
+
<mock:shadow-root>
|
|
59
|
+
<div class='spinner-container'><div class="loading-box"><span class='spinner large'></span></div></div>
|
|
60
|
+
</mock:shadow-root>
|
|
61
|
+
</tttx-loading-spinner>
|
|
62
|
+
`);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import setErrorState from './setErrorState';
|
|
2
|
+
describe('setErrorState', () => {
|
|
3
|
+
let target;
|
|
4
|
+
let errorBubble;
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
target = document.createElement('input');
|
|
7
|
+
errorBubble = document.createElement('div');
|
|
8
|
+
errorBubble.className = 'errorBubble';
|
|
9
|
+
target.parentElement = document.createElement('div');
|
|
10
|
+
target.parentElement.appendChild(errorBubble);
|
|
11
|
+
});
|
|
12
|
+
afterEach(() => {
|
|
13
|
+
target = null;
|
|
14
|
+
errorBubble = null;
|
|
15
|
+
});
|
|
16
|
+
test('should set error state correctly when hasError is true', () => {
|
|
17
|
+
setErrorState(target, true, 'Invalid value');
|
|
18
|
+
expect(target.className).toBe('invalid');
|
|
19
|
+
expect(errorBubble.innerHTML).toBe('<span class="material-symbols-rounded">warning</span>Invalid value');
|
|
20
|
+
});
|
|
21
|
+
test('should clear error state correctly when hasError is false', () => {
|
|
22
|
+
target.className = 'invalid';
|
|
23
|
+
errorBubble.innerHTML = '<span class="material-symbols-rounded">warning</span>Invalid value';
|
|
24
|
+
setErrorState(target, false, '');
|
|
25
|
+
expect(target.className).toBe('');
|
|
26
|
+
expect(errorBubble.innerHTML).toBe('');
|
|
27
|
+
});
|
|
28
|
+
test('should set error state correctly with custom error message', () => {
|
|
29
|
+
setErrorState(target, true, 'Custom error message');
|
|
30
|
+
expect(target.className).toBe('invalid');
|
|
31
|
+
expect(errorBubble.innerHTML).toBe('<span class="material-symbols-rounded">warning</span>Custom error message');
|
|
32
|
+
});
|
|
33
|
+
test('should set error state correctly with no error message', () => {
|
|
34
|
+
setErrorState(target, true, '');
|
|
35
|
+
expect(target.className).toBe('invalid');
|
|
36
|
+
expect(errorBubble.innerHTML).toBe('<span class="material-symbols-rounded">warning</span> ');
|
|
37
|
+
});
|
|
38
|
+
});
|