@muonic/muon 0.0.2-beta.42 → 0.0.2-beta.44

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/.nycrc CHANGED
@@ -7,7 +7,8 @@
7
7
  "exclude": [
8
8
  "**/modular-scale.js",
9
9
  "tests",
10
- "tokens/**/string.js"
10
+ "tokens/**/string.js",
11
+ "js"
11
12
  ],
12
13
  "check-coverage": true,
13
14
  "lines": 99,
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.0.2-beta.44](https://github.com/centrica-engineering/muon/compare/v0.0.2-beta.43...v0.0.2-beta.44) (2023-09-15)
6
+
7
+
8
+ ### Features
9
+
10
+ * ignoreSeparator inputter property ([769e872](https://github.com/centrica-engineering/muon/commit/769e872137986ffd9beaa76d4271d75d6833b2b1))
11
+
12
+ ### [0.0.2-beta.43](https://github.com/centrica-engineering/muon/compare/v0.0.2-beta.42...v0.0.2-beta.43) (2023-09-07)
13
+
14
+
15
+ ### Features
16
+
17
+ * move registry to internal ([ed355c0](https://github.com/centrica-engineering/muon/commit/ed355c07bbd673f715470a75e44df1636e0035a3))
18
+
5
19
  ### [0.0.2-beta.42](https://github.com/centrica-engineering/muon/compare/v0.0.2-beta.39...v0.0.2-beta.42) (2023-09-01)
6
20
 
7
21
 
@@ -0,0 +1,65 @@
1
+ (function () {
2
+ /*
3
+
4
+ Copyright (c) 2020 The Polymer Project Authors. All rights reserved.
5
+ This code may only be used under the BSD style license found at
6
+ http://polymer.github.io/LICENSE.txt
7
+ The complete set of authors may be found at
8
+ http://polymer.github.io/AUTHORS.txt
9
+ The complete set of contributors may be found at
10
+ http://polymer.github.io/CONTRIBUTORS.txt
11
+ Code distributed by Google as part of the polymer project is also
12
+ subject to an additional IP rights grant found at
13
+ http://polymer.github.io/PATENTS.txt
14
+ */
15
+ 'use strict'; function h(b) { var c = 0; return function () { return c < b.length ? { done: !1, value: b[c++] } : { done: !0 } } } function l(b) { var c = "undefined" != typeof Symbol && Symbol.iterator && b[Symbol.iterator]; return c ? c.call(b) : { next: h(b) } } function m(b) { if (!(b instanceof Array)) { b = l(b); for (var c, a = []; !(c = b.next()).done;)a.push(c.value); b = a } return b } var n = "function" == typeof Object.create ? Object.create : function (b) { function c() { } c.prototype = b; return new c };
16
+ function p(b) { b = ["object" == typeof globalThis && globalThis, b, "object" == typeof window && window, "object" == typeof self && self, "object" == typeof global && global]; for (var c = 0; c < b.length; ++c) { var a = b[c]; if (a && a.Math == Math) return a } throw Error("Cannot find global object"); }
17
+ var q = p(this), r = function () { function b() { function a() { } new a; Reflect.construct(a, [], function () { }); return new a instanceof a } if ("undefined" != typeof Reflect && Reflect.construct) { if (b()) return Reflect.construct; var c = Reflect.construct; return function (a, d, e) { a = c(a, d); e && Reflect.setPrototypeOf(a, e.prototype); return a } } return function (a, d, e) { void 0 === e && (e = a); e = n(e.prototype || Object.prototype); return Function.prototype.apply.call(a, e, d) || e } }(), t;
18
+ if ("function" == typeof Object.setPrototypeOf) t = Object.setPrototypeOf; else { var u; a: { var v = { a: !0 }, w = {}; try { w.__proto__ = v; u = w.a; break a } catch (b) { } u = !1 } t = u ? function (b, c) { b.__proto__ = c; if (b.__proto__ !== c) throw new TypeError(b + " is not extensible"); return b } : null } var x = t;
19
+ if (!ShadowRoot.prototype.createElement) {
20
+ var y = window.HTMLElement, A = window.customElements.define, B = window.customElements.get, C = window.customElements, D = new WeakMap, E = new WeakMap, F = new WeakMap, G = new WeakMap; window.CustomElementRegistry = function () { this.l = new Map; this.o = new Map; this.j = new Map; this.h = new Map }; window.CustomElementRegistry.prototype.define = function (b, c) {
21
+ b = b.toLowerCase(); if (void 0 !== this.i(b)) throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': the name \"" + b + '" has already been used with this registry');
22
+ if (void 0 !== this.o.get(c)) throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry"); var a = c.prototype.attributeChangedCallback, d = new Set(c.observedAttributes || []); H(c, d, a); a = {
23
+ g: c, connectedCallback: c.prototype.connectedCallback, disconnectedCallback: c.prototype.disconnectedCallback, adoptedCallback: c.prototype.adoptedCallback, attributeChangedCallback: a, formAssociated: c.formAssociated, formAssociatedCallback: c.prototype.formAssociatedCallback,
24
+ formDisabledCallback: c.prototype.formDisabledCallback, formResetCallback: c.prototype.formResetCallback, formStateRestoreCallback: c.prototype.formStateRestoreCallback, observedAttributes: d
25
+ }; this.l.set(b, a); this.o.set(c, a); d = B.call(C, b); d || (d = I(b), A.call(C, b, d)); this === window.customElements && (F.set(c, a), a.s = d); if (d = this.h.get(b)) { this.h.delete(b); d = l(d); for (var e = d.next(); !e.done; e = d.next())e = e.value, E.delete(e), J(e, a, !0) } a = this.j.get(b); void 0 !== a && (a.resolve(c), this.j.delete(b)); return c
26
+ }; window.CustomElementRegistry.prototype.upgrade =
27
+ function () { K.push(this); C.upgrade.apply(C, arguments); K.pop() }; window.CustomElementRegistry.prototype.get = function (b) { var c; return null == (c = this.l.get(b)) ? void 0 : c.g }; window.CustomElementRegistry.prototype.i = function (b) { return this.l.get(b) }; window.CustomElementRegistry.prototype.whenDefined = function (b) { var c = this.i(b); if (void 0 !== c) return Promise.resolve(c.g); var a = this.j.get(b); void 0 === a && (a = {}, a.promise = new Promise(function (d) { return a.resolve = d }), this.j.set(b, a)); return a.promise }; window.CustomElementRegistry.prototype.m =
28
+ function (b, c, a) { var d = this.h.get(c); d || this.h.set(c, d = new Set); a ? d.add(b) : d.delete(b) }; var L; window.HTMLElement = function () { var b = L; if (b) return L = void 0, b; var c = F.get(this.constructor); if (!c) throw new TypeError("Illegal constructor (custom element class must be registered with global customElements registry to be newable)"); b = Reflect.construct(y, [], c.s); Object.setPrototypeOf(b, this.constructor.prototype); D.set(b, c); return b }; window.HTMLElement.prototype = y.prototype; var I = function (b) {
29
+ function c() {
30
+ var a =
31
+ Reflect.construct(y, [], this.constructor); Object.setPrototypeOf(a, HTMLElement.prototype); a: { var d = a.getRootNode(); if (!(d === document || d instanceof ShadowRoot)) { d = K[K.length - 1]; if (d instanceof CustomElementRegistry) { var e = d; break a } d = d.getRootNode(); d === document || d instanceof ShadowRoot || (d = (null == (e = G.get(d)) ? void 0 : e.getRootNode()) || document) } e = d.customElements } e = e || window.customElements; (d = e.i(b)) ? J(a, d) : E.set(a, e); return a
32
+ } q.Object.defineProperty(c, "formAssociated", {
33
+ configurable: !0, enumerable: !0,
34
+ get: function () { var a = window.customElements.i(b); return a ? a.formAssociated : !1 }
35
+ }); c.prototype.connectedCallback = function () { var a = D.get(this); a ? a.connectedCallback && a.connectedCallback.apply(this, arguments) : E.get(this).m(this, b, !0) }; c.prototype.disconnectedCallback = function () { var a = D.get(this); a ? a.disconnectedCallback && a.disconnectedCallback.apply(this, arguments) : E.get(this).m(this, b, !1) }; c.prototype.adoptedCallback = function () {
36
+ var a, d; null == (a = D.get(this)) || null == (d = a.adoptedCallback) || d.apply(this,
37
+ arguments)
38
+ }; c.prototype.formAssociatedCallback = function () { var a = D.get(this); if (a && a.formAssociated) { var d; null == a || null == (d = a.formAssociatedCallback) || d.apply(this, arguments) } }; c.prototype.formDisabledCallback = function () { var a = D.get(this); if (null == a ? 0 : a.formAssociated) { var d; null == a || null == (d = a.formDisabledCallback) || d.apply(this, arguments) } }; c.prototype.formResetCallback = function () { var a = D.get(this); if (null == a ? 0 : a.formAssociated) { var d; null == a || null == (d = a.formResetCallback) || d.apply(this, arguments) } };
39
+ c.prototype.formStateRestoreCallback = function () { var a = D.get(this); if (null == a ? 0 : a.formAssociated) { var d; null == a || null == (d = a.formStateRestoreCallback) || d.apply(this, arguments) } }; return c
40
+ }, H = function (b, c, a) {
41
+ if (0 !== c.size && void 0 !== a) {
42
+ var d = b.prototype.setAttribute; d && (b.prototype.setAttribute = function (f, k) { f = f.toLowerCase(); if (c.has(f)) { var z = this.getAttribute(f); d.call(this, f, k); a.call(this, f, z, k) } else d.call(this, f, k) }); var e = b.prototype.removeAttribute; e && (b.prototype.removeAttribute = function (f) {
43
+ f =
44
+ f.toLowerCase(); if (c.has(f)) { var k = this.getAttribute(f); e.call(this, f); a.call(this, f, k, null) } else e.call(this, f)
45
+ }); var g = b.prototype.toggleAttribute; g && (b.prototype.toggleAttribute = function (f, k) { f = f.toLowerCase(); if (c.has(f)) { var z = this.getAttribute(f); g.call(this, f, k); k = this.getAttribute(f); a.call(this, f, z, k) } else g.call(this, f, k) })
46
+ }
47
+ }, M = function (b) { var c = Object.getPrototypeOf(b); if (c !== window.HTMLElement) return c === y ? Object.setPrototypeOf(b, window.HTMLElement) : M(c) }, J = function (b, c, a) {
48
+ a = void 0 ===
49
+ a ? !1 : a; Object.setPrototypeOf(b, c.g.prototype); D.set(b, c); L = b; try { new c.g } catch (d) { M(c.g), new c.g } c.attributeChangedCallback && c.observedAttributes.forEach(function (d) { b.hasAttribute(d) && c.attributeChangedCallback.call(b, d, null, b.getAttribute(d)) }); a && c.connectedCallback && b.isConnected && c.connectedCallback.call(b)
50
+ }, N = Element.prototype.attachShadow; Element.prototype.attachShadow = function (b) { var c = N.apply(this, arguments); b.customElements && (c.customElements = b.customElements); return c }; var K = [document],
51
+ O = function (b, c, a) { var d = (a ? Object.getPrototypeOf(a) : b.prototype)[c]; b.prototype[c] = function () { K.push(this); var e = d.apply(a || this, arguments); void 0 !== e && G.set(e, this); K.pop(); return e } }; O(ShadowRoot, "createElement", document); O(ShadowRoot, "importNode", document); O(Element, "insertAdjacentHTML"); var P = function (b) { var c = Object.getOwnPropertyDescriptor(b.prototype, "innerHTML"); Object.defineProperty(b.prototype, "innerHTML", Object.assign({}, c, { set: function (a) { K.push(this); c.set.call(this, a); K.pop() } })) }; P(Element);
52
+ P(ShadowRoot); Object.defineProperty(window, "customElements", { value: new CustomElementRegistry, configurable: !0, writable: !0 }); if (window.ElementInternals && window.ElementInternals.prototype.setFormValue) {
53
+ var Q = new WeakMap, R = HTMLElement.prototype.attachInternals, methods = ["setFormValue", "setValidity", "checkValidity", "reportValidity"]; HTMLElement.prototype.attachInternals = function (b) { for (var c = [], a = 0; a < arguments.length; ++a)c[a] = arguments[a]; c = R.call.apply(R, [this].concat(m(c))); Q.set(c, this); return c }; methods.forEach(function (b) {
54
+ var c =
55
+ window.ElementInternals.prototype, a = c[b]; c[b] = function (d) { for (var e = [], g = 0; g < arguments.length; ++g)e[g] = arguments[g]; g = Q.get(this); if (!0 === D.get(g).formAssociated) return null == a ? void 0 : a.call.apply(a, [this].concat(m(e))); throw new DOMException("Failed to execute " + a + " on 'ElementInternals': The target element is not a form-associated custom element."); }
56
+ }); var RadioNodeList = function (b) { var c = r(Array, [].concat(m(b)), this.constructor); c.h = b; return c }, S = RadioNodeList, T = Array; S.prototype = n(T.prototype);
57
+ S.prototype.constructor = S; if (x) x(S, T); else for (var U in T) if ("prototype" != U) if (Object.defineProperties) { var V = Object.getOwnPropertyDescriptor(T, U); V && Object.defineProperty(S, U, V) } else S[U] = T[U]; S.u = T.prototype; q.Object.defineProperty(RadioNodeList.prototype, "value", { configurable: !0, enumerable: !0, get: function () { var b; return (null == (b = this.h.find(function (c) { return !0 === c.checked })) ? void 0 : b.value) || "" } }); var HTMLFormControlsCollection = function (b) {
58
+ var c = this, a = new Map; b.forEach(function (d, e) {
59
+ var g = d.getAttribute("name"),
60
+ f = a.get(g) || []; c[+e] = d; f.push(d); a.set(g, f)
61
+ }); this.length = b.length; a.forEach(function (d, e) { d && (c[e] = 1 === d.length ? d[0] : new RadioNodeList(d)) })
62
+ }; HTMLFormControlsCollection.prototype.namedItem = function (b) { return this[b] }; var W = Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, "elements"); Object.defineProperty(HTMLFormElement.prototype, "elements", { get: function () { var b = W.get.call(this, []), c = []; b = l(b); for (var a = b.next(); !a.done; a = b.next()) { a = a.value; var d = D.get(a); d && !0 !== d.formAssociated || c.push(a) } return new HTMLFormControlsCollection(c) } })
63
+ }
64
+ };
65
+ }).call(typeof globalThis === 'object' ? globalThis : window);
@@ -1,5 +1,5 @@
1
1
  import { dedupeMixin } from '@muonic/muon';
2
-
2
+ import 'element-internals-polyfill';
3
3
  /**
4
4
  * A mixin to associate the component to the enclosing native form.
5
5
  *
@@ -19,6 +19,11 @@ export const MaskMixin = dedupeMixin((superclass) =>
19
19
 
20
20
  separator: {
21
21
  type: String
22
+ },
23
+
24
+ ignoreSeparator: {
25
+ type: Boolean,
26
+ attribute: 'ignore-separator'
22
27
  }
23
28
  };
24
29
  }
@@ -28,6 +33,7 @@ export const MaskMixin = dedupeMixin((superclass) =>
28
33
 
29
34
  this.mask = '';
30
35
  this.separator = '';
36
+ this.ignoreSeparator = false;
31
37
  }
32
38
 
33
39
  firstUpdated() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muonic/muon",
3
- "version": "0.0.2-beta.42",
3
+ "version": "0.0.2-beta.44",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -28,7 +28,6 @@
28
28
  "@web/dev-server-rollup": "0.5.2",
29
29
  "@web/dev-server-storybook": "0.7.4",
30
30
  "@web/storybook-prebuilt": "0.1.37",
31
- "@webcomponents/scoped-custom-element-registry": "0.0.9",
32
31
  "app-root-path": "3.1.0",
33
32
  "autoprefixer": "10.4.14",
34
33
  "chokidar": "3.5.3",
@@ -36,9 +35,10 @@
36
35
  "command-line-args": "5.2.1",
37
36
  "cssnano": "6.0.1",
38
37
  "deepmerge": "4.3.1",
38
+ "element-internals-polyfill": "^1.3.8",
39
39
  "glob": "10.2.2",
40
40
  "glob-to-regexp": "0.4.1",
41
- "lit": "2.7.3",
41
+ "lit": "2.8.0",
42
42
  "lodash": "4.17.21",
43
43
  "path-is-inside": "1.0.2",
44
44
  "postcss": "8.4.27",
@@ -293,7 +293,7 @@ const createTokens = async () => {
293
293
 
294
294
  const componentDefiner = async () => {
295
295
  const compList = await analyze();
296
- let componentDefinition = `import '@webcomponents/scoped-custom-element-registry';`;
296
+ let componentDefinition = `import '@muonic/muon/js/scoped-custom-element-registry.min.js';`;
297
297
 
298
298
  componentDefinition += compList.map(({ file, exportName }) => {
299
299
  return `import { ${exportName} } from '${file}';
@@ -315,7 +315,7 @@ const componentDefiner = async () => {
315
315
 
316
316
  const componentImportExport = async () => {
317
317
  const compList = await analyze();
318
- let componentDefinition = `import '@webcomponents/scoped-custom-element-registry';`;
318
+ let componentDefinition = `import '@muonic/muon/js/scoped-custom-element-registry.min.js';`;
319
319
 
320
320
  componentDefinition += compList.map(({ file, exportName }) => {
321
321
  return `import { ${exportName} } from '${file}';
@@ -219,3 +219,21 @@ snapshots["Inputter date standard date"] =
219
219
  `;
220
220
  /* end snapshot Inputter date standard date */
221
221
 
222
+ snapshots["Inputter text mask & separator text"] =
223
+ `<div class="has-mask inputter type-text">
224
+ <slot name="label">
225
+ </slot>
226
+ <div class="wrapper">
227
+ <slot>
228
+ </slot>
229
+ <div
230
+ aria-hidden="true"
231
+ class="input-mask"
232
+ >
233
+ 00-00
234
+ </div>
235
+ </div>
236
+ </div>
237
+ `;
238
+ /* end snapshot Inputter text mask & separator text */
239
+
@@ -262,6 +262,63 @@ describe('Inputter', () => {
262
262
  inputMask = shadowRoot.querySelector('.input-mask');
263
263
  expect(inputMask.textContent).to.be.equal(' 0', '`input-mask` has correct value');
264
264
  });
265
+
266
+ it('mask & separator text', async () => {
267
+ const inputter = await fixture(html`
268
+ <${tag} mask="00-00" separator="-" ignore-separator="" validation=["isRequired","minLength(4)"]>
269
+ <label slot="label">input label</label>
270
+ <input type="text" value=""/>
271
+ </${tag}>`);
272
+ const shadowRoot = inputter.shadowRoot;
273
+
274
+ await defaultChecks(inputter);
275
+ const changeEventSpy = sinon.spy();
276
+ inputter.addEventListener('change', changeEventSpy);
277
+
278
+ expect(inputter.type).to.equal('standard', 'default type is set');
279
+ expect(inputter.separator).to.be.equal('-', 'seperator should be present');
280
+ expect(inputter.id).to.not.be.null; // eslint-disable-line no-unused-expressions
281
+
282
+ const mask = shadowRoot.querySelector('.has-mask');
283
+ expect(mask).to.not.be.null; // eslint-disable-line no-unused-expressions
284
+
285
+ let inputMask = shadowRoot.querySelector('.input-mask');
286
+ expect(inputMask).to.not.be.null; // eslint-disable-line no-unused-expressions
287
+
288
+ const inputElement = inputter.querySelector('input');
289
+ await fillIn(inputElement, '0', 'input');
290
+
291
+ await inputter.updateComplete;
292
+ expect(changeEventSpy.callCount).to.equal(1, '`change` event fired');
293
+ expect(changeEventSpy.lastCall.args[0].detail.value).to.equal('0', '`change` event has value `0`');
294
+ let validation = shadowRoot.querySelector('.validation');
295
+ expect(validation).to.be.not.null; // eslint-disable-line no-unused-expressions
296
+
297
+ await fillIn(inputElement, '', 'input');
298
+ await inputter.updateComplete;
299
+ expect(changeEventSpy.callCount).to.equal(2, '`change` event fired');
300
+ expect(changeEventSpy.lastCall.args[0].detail.value).to.equal('', '`change` event has value ``');
301
+ validation = shadowRoot.querySelector('.validation');
302
+ expect(validation).to.not.be.null; // eslint-disable-line no-unused-expressions
303
+ expect(getComputedStyle(validation).color).to.equal('rgb(227, 102, 14)', 'validation has correct color');
304
+
305
+ const validationMessage = shadowRoot.querySelector('.validation .message');
306
+ expect(validationMessage).to.not.be.null; // eslint-disable-line no-unused-expressions
307
+ expect(validationMessage.textContent.trim()).to.equal('This field is required.', 'validation message has correct value');
308
+
309
+ const validationIcon = shadowRoot.querySelector('.validation .icon');
310
+ expect(validationIcon).to.not.be.null; // eslint-disable-line no-unused-expressions
311
+ expect(validationIcon.name).to.equal('exclamation-circle', 'validation icon has correct value');
312
+
313
+ await fillIn(inputElement, '123', 'input');
314
+ await inputter.updateComplete;
315
+ expect(changeEventSpy.callCount).to.equal(3, '`change` event fired');
316
+ expect(changeEventSpy.lastCall.args[0].detail.value).to.equal('12-3', '`change` event has value `12-3`');
317
+ expect(validationMessage.textContent.trim()).to.equal('Length must be at least 4 characters.', 'validation message has correct value');
318
+
319
+ inputMask = shadowRoot.querySelector('.input-mask');
320
+ expect(inputMask.textContent).to.be.equal(' 0', '`input-mask` has correct value');
321
+ });
265
322
  });
266
323
 
267
324
  describe('radio', async () => {
@@ -64,7 +64,7 @@ testRunner('getConfig config file', async (t) => {
64
64
  const componentsDefinitionMacro = async (t, expected) => {
65
65
  const componentDefinition = await utilsLibrary.componentDefiner();
66
66
  t.true(componentDefinition !== undefined);
67
- t.true(componentDefinition.indexOf(`import '@webcomponents/scoped-custom-element-registry';`) > -1);
67
+ t.true(componentDefinition.indexOf(`import '@muonic/muon/js/scoped-custom-element-registry.min.js';`) > -1);
68
68
  Object.keys(expected).forEach((component) => {
69
69
  t.true(componentDefinition.indexOf(`import { ${expected[component]} } from '${process.cwd()}/components/${component}/src/${component}-component.js';`) > -1);
70
70
  t.true(componentDefinition.indexOf(`customElements.define('muon-${component}', ${expected[component]});`) > -1);
@@ -204,7 +204,7 @@ testRunner('sourceFilesAnalyzer', async (t) => {
204
204
  'muon-form': ['standardTemplate', 'type'],
205
205
  'muon-icon': ['size', 'classes', 'inlineStyles', 'sizes', 'iconSize', 'standardTemplate', 'name', 'category', 'allSizes', 'describe', 'type'],
206
206
  'muon-image': ['src', 'classes', 'inlineStyles', 'placeholderImage', 'standardTemplate', 'background', 'backgroundsize', 'alt', 'ratio', 'placeholder', 'loading', 'type'],
207
- 'muon-inputter': ['helper', 'classes', 'inlineStyles', 'slottedStyles', 'isHelperOpen', 'isPristine', 'isDirty', 'validity', 'validationMessage', 'validation', 'disableNative', 'showMessage', 'name', 'value', 'labelID', 'heading', 'mask', 'separator', 'type'],
207
+ 'muon-inputter': ['helper', 'classes', 'inlineStyles', 'slottedStyles', 'isHelperOpen', 'isPristine', 'isDirty', 'validity', 'validationMessage', 'validation', 'disableNative', 'showMessage', 'name', 'value', 'labelID', 'heading', 'mask', 'separator', 'ignoreSeparator', 'type'],
208
208
  'inputter-detail': ['icon', 'classes', 'inlineStyles', 'standardTemplate', 'open', 'type']
209
209
  };
210
210
  t.deepEqual(jsonResult.tags?.map((tag) => tag.name).sort(), components.sort());
@@ -230,7 +230,7 @@ testRunner('sourceFilesAnalyzer with prefix override', async (t) => {
230
230
  const components = ['muon-cta', 'muon-inputter', 'inputter-detail', 'mnx-cta'];
231
231
  const propertiesMap = {
232
232
  'muon-cta': ['href', 'classes', 'inlineStyles', 'standardTemplate', 'submitTemplate', 'resetTemplate', 'loading', 'loadingMessage', 'disabled', 'icon', 'type'],
233
- 'muon-inputter': ['helper', 'classes', 'inlineStyles', 'slottedStyles', 'isHelperOpen', 'isPristine', 'isDirty', 'validity', 'validationMessage', 'validation', 'disableNative', 'showMessage', 'name', 'value', 'labelID', 'heading', 'mask', 'separator', 'type'],
233
+ 'muon-inputter': ['helper', 'classes', 'inlineStyles', 'slottedStyles', 'isHelperOpen', 'isPristine', 'isDirty', 'validity', 'validationMessage', 'validation', 'disableNative', 'showMessage', 'name', 'value', 'labelID', 'heading', 'mask', 'separator', 'ignoreSeparator', 'type'],
234
234
  'inputter-detail': ['icon', 'classes', 'inlineStyles', 'standardTemplate', 'open', 'type'],
235
235
  'mnx-cta': ['enabled', 'type']
236
236
  };
@@ -23,6 +23,13 @@ describe('validation', () => {
23
23
  validation = customValidations.isNumber(inputElement, '343');
24
24
  expect(validation).to.equal(false, 'validation has correct value');
25
25
 
26
+ validation = customValidations.isNumber(inputElement, '343-23');
27
+ expect(validation).to.equal('Needs to be a number', 'validation has correct value');
28
+
29
+ inputElement = { separator: '-', ignoreSeparator: true };
30
+ validation = customValidations.isNumber(inputElement, 'fdgd-fdf');
31
+ expect(validation).to.equal('Needs to be a number', 'validation has correct value');
32
+
26
33
  validation = customValidations.isNumber(inputElement, '343-23');
27
34
  expect(validation).to.equal(false, 'validation has correct value');
28
35
  });
@@ -39,6 +46,10 @@ describe('validation', () => {
39
46
  validation = customValidations.isInteger(inputElement, 'Infinity');
40
47
  expect(validation).to.equal('Needs to be a whole number', 'validation has correct value');
41
48
 
49
+ validation = customValidations.isInteger(inputElement, '343-67');
50
+ expect(validation).to.equal('Needs to be a whole number', 'validation has correct value');
51
+
52
+ inputElement = { separator: '-', ignoreSeparator: true };
42
53
  validation = customValidations.isInteger(inputElement, '343-67');
43
54
  expect(validation).to.equal(false, 'validation has correct value');
44
55
  });
@@ -72,6 +83,13 @@ describe('validation', () => {
72
83
 
73
84
  inputElement = { separator: '-' };
74
85
  validation = customValidations.minLength(inputElement, 'djfg-dfg', 8);
86
+ expect(validation).to.equal(false, 'validation has correct value');
87
+
88
+ validation = customValidations.minLength(inputElement, 'djfg-dfg8', 8);
89
+ expect(validation).to.equal(false, 'validation has correct value');
90
+
91
+ inputElement = { separator: '-', ignoreSeparator: true };
92
+ validation = customValidations.minLength(inputElement, 'djfg-dfg', 8);
75
93
  expect(validation).to.equal('Length must be at least 8 characters', 'validation has correct value');
76
94
 
77
95
  validation = customValidations.minLength(inputElement, 'djfg-dfg8', 8);
@@ -91,10 +109,14 @@ describe('validation', () => {
91
109
 
92
110
  inputElement = { separator: '-' };
93
111
  validation = customValidations.maxLength(inputElement, '353-434', 6);
94
- expect(validation).to.equal(false, 'validation has correct value');
112
+ expect(validation).to.equal('Length must be no longer than 6 characters', 'validation has correct value');
95
113
 
96
114
  validation = customValidations.maxLength(inputElement, 'fer', 2);
97
115
  expect(validation).to.equal('Length must be no longer than 2 characters', 'validation has correct value');
116
+
117
+ inputElement = { separator: '-', ignoreSeparator: true };
118
+ validation = customValidations.maxLength(inputElement, '353-434', 6);
119
+ expect(validation).to.equal(false, 'validation has correct value');
98
120
  });
99
121
 
100
122
  it('isBetween', async () => {
@@ -116,6 +138,13 @@ describe('validation', () => {
116
138
 
117
139
  inputElement = { separator: '-' };
118
140
  validation = customValidations.isBetween(inputElement, 'd-', 2, 8);
141
+ expect(validation).to.equal(false, 'validation has correct value');
142
+
143
+ validation = customValidations.isBetween(inputElement, 'd-jfg-dfg', 2, 8);
144
+ expect(validation).to.equal('Length must be between 2 and 8 characters', 'validation has correct value');
145
+
146
+ inputElement = { separator: '-', ignoreSeparator: true };
147
+ validation = customValidations.isBetween(inputElement, 'd-', 2, 8);
119
148
  expect(validation).to.equal('Length must be between 2 and 8 characters', 'validation has correct value');
120
149
 
121
150
  validation = customValidations.isBetween(inputElement, 'd-jfg-dfg', 2, 8);
@@ -31,14 +31,14 @@ const isRequired = (inputter, value) => {
31
31
  };
32
32
 
33
33
  const isNumber = (inputter, value) => {
34
- const number = inputter.separator ? withoutChar(value, inputter.separator) : value;
34
+ const number = inputter.ignoreSeparator ? withoutChar(value, inputter.separator) : value;
35
35
  const val = Number(number);
36
36
  const isNum = typeof val === 'number' && !isNaN(val);
37
37
  return value.length > 0 && !isNum && VALIDATION_IS_NUMBER_MESSAGE;
38
38
  };
39
39
 
40
40
  const isInteger = (inputter, value) => {
41
- const number = inputter.separator ? withoutChar(value, inputter.separator) : value;
41
+ const number = inputter.ignoreSeparator ? withoutChar(value, inputter.separator) : value;
42
42
  const val = Number(number);
43
43
  const isInt = typeof val === 'number' && isFinite(val) && Math.floor(val) === val;
44
44
 
@@ -51,17 +51,17 @@ const isEmail = (inputter, value) => {
51
51
  };
52
52
 
53
53
  const minLength = (inputter, value, min) => {
54
- const str = inputter.separator ? withoutChar(value, inputter.separator) : value;
54
+ const str = inputter.ignoreSeparator ? withoutChar(value, inputter.separator) : value;
55
55
  return value.length > 0 && str.length < min && VALIDATION_MIN_LENGTH_MESSAGE.replace('$min', min);
56
56
  };
57
57
 
58
58
  const maxLength = (inputter, value, max) => {
59
- const str = inputter.separator ? withoutChar(value, inputter.separator) : value;
59
+ const str = inputter.ignoreSeparator ? withoutChar(value, inputter.separator) : value;
60
60
  return value.length > 0 && str.length > max && VALIDATION_MAX_LENGTH_MESSAGE.replace('$max', max);
61
61
  };
62
62
 
63
63
  const isBetween = (inputter, value, min, max) => {
64
- const str = inputter.separator ? withoutChar(value, inputter.separator) : value;
64
+ const str = inputter.ignoreSeparator ? withoutChar(value, inputter.separator) : value;
65
65
  return value.length > 0 && (str.length < min || str.length > max) && VALIDATION_IS_BETWEEN_MESSAGE.replace('$min', min).replace('$max', max);
66
66
  };
67
67
 
@@ -23,7 +23,7 @@ export default {
23
23
  `<html>
24
24
  <head>
25
25
  <script type="module">
26
- import '@webcomponents/scoped-custom-element-registry';
26
+ import '@muonic/muon/js/scoped-custom-element-registry.min.js';
27
27
  </script>
28
28
  </head>
29
29
  <body>
@@ -7,7 +7,7 @@ export default {
7
7
  `<html>
8
8
  <head>
9
9
  <script type="module">
10
- import '@webcomponents/scoped-custom-element-registry';
10
+ import '@muonic/muon/js/scoped-custom-element-registry.min.js';
11
11
  </script>
12
12
  </head>
13
13
  <body>
@@ -39,6 +39,10 @@ export default {
39
39
  branches: 99,
40
40
  functions: 99,
41
41
  lines: 99
42
- }
42
+ },
43
+ exclude: [
44
+ '**/node_modules/**',
45
+ '**/js/*.min.js'
46
+ ]
43
47
  }
44
48
  };