Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lion/field

Package Overview
Dependencies
Maintainers
1
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lion/field - npm Package Compare versions

Comparing version 0.1.32 to 0.1.33

src/FormRegisteringMixin.js

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

## [0.1.33](https://github.com/ing-bank/lion/compare/@lion/field@0.1.32...@lion/field@0.1.33) (2019-07-19)
### Bug Fixes
* **field:** make sure RegistrationSystem works well with ShadyDom ([2a0d18b](https://github.com/ing-bank/lion/commit/2a0d18b))
## [0.1.32](https://github.com/ing-bank/lion/compare/@lion/field@0.1.31...@lion/field@0.1.32) (2019-07-19)

@@ -8,0 +19,0 @@

2

index.js

@@ -7,1 +7,3 @@ export { FieldCustomMixin } from './src/FieldCustomMixin.js';

export { LionField } from './src/LionField.js';
export { FormRegisteringMixin } from './src/FormRegisteringMixin.js';
export { FormRegistrarMixin } from './src/FormRegistrarMixin.js';

4

package.json
{
"name": "@lion/field",
"version": "0.1.32",
"version": "0.1.33",
"description": "Fields are the most fundamental building block of the Form System",

@@ -44,3 +44,3 @@ "author": "ing-bank",

},
"gitHead": "d3599fd664ee11ab986c504835e4d7b644bcbdaa"
"gitHead": "6bc96cbba06cf3979137598cc9d79443ff6aa8f0"
}
import { html, css, nothing, dedupeMixin, SlotMixin } from '@lion/core';
import { ObserverMixin } from '@lion/core/src/ObserverMixin.js';
import { FormRegisteringMixin } from './FormRegisteringMixin.js';

@@ -17,3 +18,3 @@ /**

// eslint-disable-next-line no-shadow, no-unused-vars
class FormControlMixin extends ObserverMixin(SlotMixin(superclass)) {
class FormControlMixin extends FormRegisteringMixin(ObserverMixin(SlotMixin(superclass))) {
static get properties() {

@@ -109,4 +110,2 @@ return {

this._enhanceLightDomA11y();
this._registerFormElement();
this._requestParentFormGroupUpdateOfResetModelValue();
}

@@ -156,38 +155,2 @@

/**
* Fires a registration event in the next frame.
*
* Why next frame?
* if ShadyDOM is used and you add a listener and fire the event in the same frame
* it will not bubble and there can not be cought by a parent element
* for more details see: https://github.com/Polymer/lit-element/issues/658
* will requires a `await nextFrame()` in tests
*/
_registerFormElement() {
this.updateComplete.then(() => {
this.dispatchEvent(
new CustomEvent('form-element-register', {
detail: { element: this },
bubbles: true,
}),
);
});
}
/**
* Makes sure our parentFormGroup has the most up to date resetModelValue
* FormGroups will call the same on their parentFormGroup so the full tree gets the correct
* values.
*
* Why next frame?
* @see {@link this._registerFormElement}
*/
_requestParentFormGroupUpdateOfResetModelValue() {
this.updateComplete.then(() => {
if (this.__parentFormGroup) {
this.__parentFormGroup._updateResetModelValue();
}
});
}
/**
* Enhances additional slots(prefix, suffix, before, after) defined by developer.

@@ -194,0 +157,0 @@ *

@@ -1,3 +0,2 @@

import { expect, fixture, html, defineCE, unsafeStatic, nextFrame } from '@open-wc/testing';
import sinon from 'sinon';
import { expect, fixture, html, defineCE, unsafeStatic } from '@open-wc/testing';
import { SlotMixin } from '@lion/core';

@@ -29,38 +28,2 @@ import { LionLitElement } from '@lion/core/src/LionLitElement.js';

it('dispatches event to register in Light DOM', async () => {
const registerSpy = sinon.spy();
await fixture(html`
<div @form-element-register=${registerSpy}>
<${tag}></${tag}>
</div>
`);
await nextFrame();
expect(registerSpy.callCount).to.equal(1);
});
it('can by caught by listening in the appropriate dom', async () => {
const registerSpy = sinon.spy();
const testTag = unsafeStatic(
defineCE(
class extends LionLitElement {
connectedCallback() {
super.connectedCallback();
this.shadowRoot.addEventListener('form-element-register', registerSpy);
}
render() {
return html`
<${tag}></${tag}>
`;
}
},
),
);
await fixture(html`
<${testTag}></${testTag}>
`);
await nextFrame();
expect(registerSpy.callCount).to.equal(1);
});
it('has the capability to override the help text', async () => {

@@ -67,0 +30,0 @@ const lionFieldAttr = await fixture(html`

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc