@justeattakeaway/pie-webc-core
Advanced tools
Comparing version 0.11.0 to 0.12.0-next.0
# Changelog | ||
## 0.12.0-next.0 | ||
### Minor Changes | ||
- [Changed] - `@validPropertyValues` and `@requiredProperty` decorators to support Lit 3. ([#999](https://github.com/justeattakeaway/pie/pull/999)) by [@siggerzz](https://github.com/siggerzz) | ||
## 0.11.0 | ||
@@ -4,0 +10,0 @@ |
{ | ||
"name": "@justeattakeaway/pie-webc-core", | ||
"version": "0.11.0", | ||
"version": "0.12.0-next.0", | ||
"description": "PIE design system base classes, mixins and utilities for web components", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -14,4 +14,2 @@ /** | ||
set (value: T): void { | ||
const oldValue = this[privatePropertyKey]; | ||
if (value === undefined || value === null || (typeof value === 'string' && value.trim() === '')) { | ||
@@ -21,7 +19,5 @@ console.error(`<${componentName}> Missing required attribute "${propertyKey}"`); | ||
this[privatePropertyKey] = value; | ||
this.requestUpdate(propertyKey, oldValue); | ||
}, | ||
configurable: true, | ||
}); | ||
}; | ||
@@ -28,12 +28,2 @@ import { | ||
color?: string | null; | ||
private _requestUpdateArgs = {}; | ||
requestUpdate (propertyKey: string, oldValue: unknown) { | ||
this._requestUpdateArgs = { propertyKey, oldValue }; | ||
} | ||
requestUpdateCalledWith () { | ||
return this._requestUpdateArgs; | ||
} | ||
} | ||
@@ -84,13 +74,2 @@ | ||
}); | ||
it('should call requestUpdate when the property is set', () => { | ||
// Arrange | ||
const mockComponent = new MockComponent(); | ||
// Act | ||
mockComponent.color = 'blue'; | ||
// Assert | ||
expect(mockComponent.requestUpdateCalledWith()).toStrictEqual({ propertyKey: 'color', oldValue: undefined }); | ||
}); | ||
}); |
@@ -28,12 +28,2 @@ import { | ||
color = 'red'; | ||
private _requestUpdateArgs = {}; | ||
requestUpdate (propertyKey: string, oldValue: unknown) { | ||
this._requestUpdateArgs = { propertyKey, oldValue }; | ||
} | ||
requestUpdateCalledWith () { | ||
return this._requestUpdateArgs; | ||
} | ||
} | ||
@@ -79,14 +69,2 @@ | ||
}); | ||
it('should call requestUpdate when the property is set', () => { | ||
// Arrange | ||
const mockComponent = new MockComponent(); | ||
// Act | ||
mockComponent.color = 'yellow'; | ||
// Assert | ||
expect(mockComponent.color).toBe('red'); | ||
expect(mockComponent.requestUpdateCalledWith()).toStrictEqual({ propertyKey: 'color', oldValue: 'red' }); | ||
}); | ||
}); |
@@ -8,3 +8,3 @@ /** | ||
*/ | ||
export const validPropertyValues = <T>(componentName: string, validValues: readonly T[], defaultValue: T) => function validatePropertyValues (target: object, propertyKey: string): void { | ||
export const validPropertyValues = <T>(componentName: string, validValues: readonly T[], defaultValue: T) => function validatePropertyValues (target: object, propertyKey: string) : void { | ||
const privatePropertyKey = `#${propertyKey}`; | ||
@@ -17,4 +17,2 @@ | ||
set (value: T): void { | ||
const oldValue = this[privatePropertyKey]; | ||
if (!validValues.includes(value)) { | ||
@@ -30,6 +28,5 @@ console.error( | ||
} | ||
this.requestUpdate(propertyKey, oldValue); | ||
}, | ||
configurable: true, | ||
}); | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25046
536